Example #1
0
func MakePlant(u *mud.Universe, name string) *Plant {
	p := new(Plant)
	p.universe = u
	p.name = name
	p.ping = make(chan int)
	p.stage = plantStages[0]

	u.Add(p)

	go AgeLoop(p)

	return p
}
Example #2
0
func MakeFruitTree(u *mud.Universe, fruitName string) *FruitTree {
	ft := new(FruitTree)
	ft.universe = u
	ft.fruitName = fruitName
	ft.nextFlowering = -1
	ft.ping = make(chan int)

	u.Add(ft)

	go ft.UpdateTimeLoop()

	return ft
}
Example #3
0
func MakeFruit(u *mud.Universe, name string) *Fruit {
	f := new(Fruit)
	f.universe = u
	f.name = name
	f.ping = make(chan int)
	f.stage = fruitStages[0]
	f.visible = true

	u.Add(f)

	go AgeLoop(f)

	return f
}
Example #4
0
func NewFlipFlop(u *mud.Universe) *simple.NPC {
	ff := simple.NewNPC(u)
	persister := new(flipFlopPersister)

	persister.npc = ff
	persister.universe = u

	ff.SetUniverse(u)
	ff.AddStimHandler("say", ffHandleSay)
	ff.Meta["lastText"] = "Unchanged."
	ff.SetDescription(ff.Meta["lastText"].(string))
	ff.SetVisible(true)

	u.Add(ff)
	u.Add(persister)

	go mud.StimuliLoop(ff)

	return ff
}
Example #5
0
func InitUniverse(universe *mud.Universe) *mud.Room {
	townSquare := mud.NewRoom(universe, 0,
		`Parallax Town Square.

The social and geographic center of the town of Parallax. To the
north is General Seed. The road headed east is Old Town Ave. The
road headed south is Artery Rd.`)
	universe.Add(townSquare)

	oldAve1 := mud.NewRoom(universe, 0,
		`Old Ave.

Old Ave. runs east and west. To the west is town square. There is
a shabby tenement house to the south.`)
	universe.Add(oldAve1)
	mud.ConnectEastWest(townSquare, oldAve1)

	oldAve2 := mud.NewRoom(universe, 0,
		`Old Ave.

Old Ave. runs east and west. To the north is a grocer. To the south
is a church.`)
	universe.Add(oldAve2)
	mud.ConnectEastWest(oldAve1, oldAve2)

	oldAve3 := mud.NewRoom(universe, 0, `
Old Ave./Gold St. Intersection

Old Ave. runs west. To the northeast is Gilroy Estate. 
To the north is Gold Street.`)
	universe.Add(oldAve3)
	mud.ConnectEastWest(oldAve2, oldAve3)

	gilroyEstate := mud.NewRoom(universe, 0, `
Gilroy Estate

You are at the entrance to Gilroy Estate. It is a mansion with sprawling
grounds. The garden runs north and east. The foyer is northeast.
`)
	universe.Add(gilroyEstate)
	mud.ConnectNEtoSW(oldAve3, gilroyEstate)

	goldSt1 := mud.NewRoom(universe, 0, `
Gold St.

Gold Street runs south. There is a Patrician Foods to the northeast.`)
	universe.Add(goldSt1)
	mud.ConnectNorthSouth(goldSt1, oldAve3)

	puritan := NewPuritan(universe)
	theBall := NewBall(universe, "&red;red&;")
	theClock := NewClock(universe)
	ff := NewFlipFlop(universe)

	universe.Add(theClock)

	room := mud.NewRoom(universe, 0, "You are in a bedroom.")
	room.AddChild(theBall)
	room.AddChild(theClock)
	room.AddChild(puritan)
	room.AddChild(ff)
	puritan.SetRoom(room)

	room2 := mud.NewRoom(universe, 0, "You are in a bathroom.")

	tree := MakeFruitTree(universe, "peach")
	room2.AddChild(tree)
	tree.room = room2

	mud.ConnectEastWest(room, room2)

	return townSquare
}