Add persistent destructible world structures and building kits
This commit is contained in:
@@ -19,6 +19,7 @@ type Recipe struct {
|
||||
}
|
||||
|
||||
type Balance struct {
|
||||
Building *BuildingContent `yaml:"building"`
|
||||
Powers *PowerContent `yaml:"powers"`
|
||||
Crafting *CraftingContent `yaml:"crafting"`
|
||||
Combat *CombatContent `yaml:"combat"`
|
||||
@@ -82,10 +83,13 @@ func Parse(data []byte) (Balance, error) {
|
||||
return b, b.Validate()
|
||||
}
|
||||
func (b Balance) Validate() error {
|
||||
if err := (Catalog{Powers: b.Powers, Combat: b.Combat, Items: b.Items, Titles: b.Titles}).validatePowers(); err != nil {
|
||||
if e := (Catalog{Building: b.Building, Crafting: b.Crafting, Items: b.Items}).validateBuilding(); e != nil {
|
||||
return e
|
||||
}
|
||||
if err := (Catalog{Building: b.Building, Powers: b.Powers, Combat: b.Combat, Items: b.Items, Titles: b.Titles}).validatePowers(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := (Catalog{Powers: b.Powers, Crafting: b.Crafting, Items: b.Items, Titles: b.Titles, Gathering: b.Gathering}).validateCrafting(); err != nil {
|
||||
if err := (Catalog{Building: b.Building, Powers: b.Powers, Crafting: b.Crafting, Items: b.Items, Titles: b.Titles, Gathering: b.Gathering}).validateCrafting(); err != nil {
|
||||
return err
|
||||
}
|
||||
if b.CombatRules != nil {
|
||||
@@ -93,7 +97,7 @@ func (b Balance) Validate() error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := (Catalog{Powers: b.Powers, Crafting: b.Crafting, Combat: b.Combat, Items: b.Items, Gathering: b.Gathering}).validateCombat(); err != nil {
|
||||
if err := (Catalog{Building: b.Building, Powers: b.Powers, Crafting: b.Crafting, Combat: b.Combat, Items: b.Items, Gathering: b.Gathering}).validateCombat(); err != nil {
|
||||
return err
|
||||
}
|
||||
if b.Gathering != nil {
|
||||
|
||||
Reference in New Issue
Block a user