Пример #1
0
func NewPuritan(universe *mud.Universe) *simple.NPC {
	puritan := simple.NewNPC(universe)
	puritan.AddStimHandler("say", puritanHandleSay)
	puritan.SetVisible(true)
	puritan.SetDescription("Penelope Proper")
	puritan.SetCarryable(false)
	puritan.AddCommand("buy", buy)
	go mud.StimuliLoop(puritan)
	return puritan
}
Пример #2
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
}