Beispiel #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")
}
Beispiel #2
0
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
}
Beispiel #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
}
Beispiel #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
	}
}
Beispiel #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
}
Beispiel #6
0
func LoadAllFurnitureInDir(dir string) {
	base.RemoveRegistry("furniture")
	base.RegisterRegistry("furniture", make(map[string]*furnitureDef))
	base.RegisterAllObjectsInDir("furniture", dir, ".json", "json")
}
Beispiel #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")
}
Beispiel #8
0
func LoadAllGearInDir(dir string) {
	base.RemoveRegistry("gear")
	base.RegisterRegistry("gear", make(map[string]*gearDef))
	base.RegisterAllObjectsInDir("gear", dir, ".json", "json")
}
Beispiel #9
0
func LoadAllDoorsInDir(dir string) {
	base.RemoveRegistry("doors")
	base.RegisterRegistry("doors", make(map[string]*doorDef))
	base.RegisterAllObjectsInDir("doors", dir, ".json", "json")
}
Beispiel #10
0
func LoadAllHousesInDir(dir string) {
	base.RemoveRegistry("houses")
	base.RegisterRegistry("houses", make(map[string]*HouseDef))
	base.RegisterAllObjectsInDir("houses", dir, ".house", "json")
}
Beispiel #11
0
func LoadAllRoomsInDir(dir string) {
	base.RemoveRegistry("rooms")
	base.RegisterRegistry("rooms", make(map[string]*roomDef))
	base.RegisterAllObjectsInDir("rooms", dir, ".room", "json")
}