示例#1
0
func LoadAllEntities() {
	base.RemoveRegistry("entities")
	base.RegisterRegistry("entities", make(map[string]*entityDef))
	basedir := base.GetDataDir()
	base.RegisterAllObjectsInDir("entities", filepath.Join(basedir, "entities"), ".json", "json")
	base.RegisterAllObjectsInDir("entities", filepath.Join(basedir, "objects"), ".json", "json")
}
示例#2
0
文件: move.go 项目: hilerchyn/haunts
func registerMoves() map[string]func() game.Action {
	move_actions := make(map[string]*MoveDef)
	base.RemoveRegistry("actions-move_actions")
	base.RegisterRegistry("actions-move_actions", move_actions)
	base.RegisterAllObjectsInDir("actions-move_actions", filepath.Join(base.GetDataDir(), "actions", "movement"), ".json", "json")
	makers := make(map[string]func() game.Action)
	for name := range move_actions {
		cname := name
		makers[cname] = func() game.Action {
			a := Move{Defname: cname}
			base.GetObject("actions-move_actions", &a)
			return &a
		}
	}
	return makers
}
示例#3
0
func registerInteracts() map[string]func() game.Action {
	interact_actions := make(map[string]*InteractDef)
	base.RemoveRegistry("actions-interact_actions")
	base.RegisterRegistry("actions-interact_actions", interact_actions)
	base.RegisterAllObjectsInDir("actions-interact_actions", filepath.Join(base.GetDataDir(), "actions", "interacts"), ".json", "json")
	makers := make(map[string]func() game.Action)
	for name := range interact_actions {
		cname := name
		makers[cname] = func() game.Action {
			a := Interact{Defname: cname}
			base.GetObject("actions-interact_actions", &a)
			return &a
		}
	}
	return makers
}
示例#4
0
func registerBasicConditions() {
	registry_name := "conditions-basic_conditions"
	base.RemoveRegistry(registry_name)
	base.RegisterRegistry(registry_name, make(map[string]*BasicConditionDef))
	base.RegisterAllObjectsInDir(registry_name, filepath.Join(base.GetDataDir(), "conditions", "basic_conditions"), ".json", "json")
	names := base.GetAllNamesInRegistry(registry_name)
	for _, name := range names {
		cname := name
		f := func() Condition {
			c := BasicCondition{Defname: cname}
			base.GetObject(registry_name, &c)
			return &c
		}
		condition_makers[name] = f
	}
}
示例#5
0
func registerSummonActions() map[string]func() game.Action {
	summons_actions := make(map[string]*SummonActionDef)
	base.RemoveRegistry("actions-summons_actions")
	base.RegisterRegistry("actions-summons_actions", summons_actions)
	base.RegisterAllObjectsInDir("actions-summons_actions", filepath.Join(base.GetDataDir(), "actions", "summons"), ".json", "json")
	makers := make(map[string]func() game.Action)
	for name := range summons_actions {
		cname := name
		makers[cname] = func() game.Action {
			a := SummonAction{Defname: cname}
			base.GetObject("actions-summons_actions", &a)
			if a.Ammo > 0 {
				a.Current_ammo = a.Ammo
			} else {
				a.Current_ammo = -1
			}
			return &a
		}
	}
	return makers
}
示例#6
0
func LoadAllFurnitureInDir(dir string) {
	base.RemoveRegistry("furniture")
	base.RegisterRegistry("furniture", make(map[string]*furnitureDef))
	base.RegisterAllObjectsInDir("furniture", dir, ".json", "json")
}
示例#7
0
func LoadAllWallTexturesInDir(dir string) {
	base.RemoveRegistry("wall_textures")
	base.RegisterRegistry("wall_textures", make(map[string]*wallTextureDef))
	base.RegisterAllObjectsInDir("wall_textures", dir, ".json", "json")
}
示例#8
0
文件: gear.go 项目: RickDakan/haunts
func LoadAllGearInDir(dir string) {
	base.RemoveRegistry("gear")
	base.RegisterRegistry("gear", make(map[string]*gearDef))
	base.RegisterAllObjectsInDir("gear", dir, ".json", "json")
}
示例#9
0
文件: house.go 项目: FlyingCar/haunts
func LoadAllDoorsInDir(dir string) {
	base.RemoveRegistry("doors")
	base.RegisterRegistry("doors", make(map[string]*doorDef))
	base.RegisterAllObjectsInDir("doors", dir, ".json", "json")
}
示例#10
0
文件: house.go 项目: FlyingCar/haunts
func LoadAllHousesInDir(dir string) {
	base.RemoveRegistry("houses")
	base.RegisterRegistry("houses", make(map[string]*HouseDef))
	base.RegisterAllObjectsInDir("houses", dir, ".house", "json")
}
示例#11
0
文件: room.go 项目: RickDakan/haunts
func LoadAllRoomsInDir(dir string) {
	base.RemoveRegistry("rooms")
	base.RegisterRegistry("rooms", make(map[string]*roomDef))
	base.RegisterAllObjectsInDir("rooms", dir, ".room", "json")
}