Пример #1
0
func LoadFruitTree(u *mud.Universe, id int) interface{} {
	ft := MakeFruitTree(u, "peach")
	vals := u.Store.LoadStructure(mud.PersistentKeys["fruitTree"],
		mud.FieldJoin(":", "fruitTree", strconv.Itoa(id)))
	ft.id = id
	ft.fruitName = vals["fruitName"].(string)
	nextFloweringS := vals["nextFlowering"].(string)
	ft.nextFlowering, _ = strconv.Atoi(nextFloweringS)
	return ft
}
Пример #2
0
func LoadFlipFlop(u *mud.Universe, id int) interface{} {
	var ok bool
	vals := u.Store.LoadStructure(mud.PersistentKeys["flipFlop"],
		mud.FieldJoin(":", "flipFlop", strconv.Itoa(id)))
	ff := NewFlipFlop(u)
	ff.SetId(id)
	ff.Meta["lastText"], ok = vals["bling"].(string)
	ff.SetDescription(ff.Meta["lastText"].(string))
	if !ok {
		panic("flipFlop:bling not string")
	}
	return ff
}