Add persistent destructible world structures and building kits

This commit is contained in:
dingo
2026-09-09 22:46:06 -04:00
parent c2bef2a45f
commit e80064976a
36 changed files with 932 additions and 43 deletions
+26
View File
@@ -0,0 +1,26 @@
package content
import "testing"
func TestBuildingKitsAndRequirements(t *testing.T) {
c, e := DefaultCatalog()
if e != nil {
t.Fatal(e)
}
c.Crafting.Recipes = append(c.Crafting.Recipes, CraftRecipe{ID: "wall_kit_recipe", Name: "Wall kit", Revision: 1, Profession: "builder", Level: 1, XP: 20, Inputs: map[string]int64{"wood": 6, "ore": 2}, Outputs: map[string]int64{"kit_timber_wall": 1}})
if e = c.Validate(); e != nil {
t.Fatal("could not author kit recipe", e)
}
d := c.Building.Definitions[0]
d.Height = -1
c.Building.Definitions[0] = d
if e = c.Validate(); e == nil {
t.Fatal("negative height allowed")
}
d.Height = 2
d.Profession = "missing"
c.Building.Definitions[0] = d
if e = c.Validate(); e == nil {
t.Fatal("missing profession allowed")
}
}