Add terrain biomes jumping and extensible gathering professions
This commit is contained in:
@@ -35,6 +35,18 @@ func (d *DB) PreviewCatalog(ctx context.Context, change CatalogChange) (CatalogP
|
||||
}
|
||||
// Preview validates a provisional identity but does not reserve or expose it.
|
||||
if !change.HasDefinitionID() {
|
||||
if resolved.GatheringSkill != nil {
|
||||
resolved.GatheringSkill.ID = ""
|
||||
}
|
||||
if resolved.Resource != nil {
|
||||
resolved.Resource.ID = ""
|
||||
}
|
||||
if resolved.Biome != nil {
|
||||
resolved.Biome.ID = ""
|
||||
}
|
||||
if resolved.Consumable != nil {
|
||||
resolved.Consumable.ID = ""
|
||||
}
|
||||
if resolved.Title != nil {
|
||||
resolved.Title.ID = ""
|
||||
}
|
||||
@@ -64,7 +76,48 @@ func buildCatalog(c content.Catalog, change CatalogChange) (content.Catalog, str
|
||||
resolved.RequirementSetIDs = nil
|
||||
resolved.EffectSetIDs = nil
|
||||
target := "stats"
|
||||
if c.Gathering == nil {
|
||||
b, e := content.Load()
|
||||
if e != nil {
|
||||
return invalid(e)
|
||||
}
|
||||
c.Gathering = b.Gathering
|
||||
}
|
||||
gathering := *c.Gathering
|
||||
c.Gathering = &gathering
|
||||
switch change.Op {
|
||||
case "create-gathering-skill":
|
||||
v := *change.GatheringSkill
|
||||
if v.ID == "" {
|
||||
v.ID = "skill_" + game.ID()
|
||||
}
|
||||
resolved.GatheringSkill = &v
|
||||
c.Gathering.Skills = append(slices.Clone(c.Gathering.Skills), v)
|
||||
target = v.ID
|
||||
case "create-resource":
|
||||
v := *change.Resource
|
||||
if v.ID == "" {
|
||||
v.ID = "resource_" + game.ID()
|
||||
}
|
||||
resolved.Resource = &v
|
||||
c.Gathering.Resources = append(slices.Clone(c.Gathering.Resources), v)
|
||||
target = v.ID
|
||||
case "create-biome":
|
||||
v := *change.Biome
|
||||
if v.ID == "" {
|
||||
v.ID = "biome_" + game.ID()
|
||||
}
|
||||
resolved.Biome = &v
|
||||
c.Gathering.Biomes = append(slices.Clone(c.Gathering.Biomes), v)
|
||||
target = v.ID
|
||||
case "create-consumable":
|
||||
v := *change.Consumable
|
||||
if v.ID == "" {
|
||||
v.ID = "consumable_" + game.ID()
|
||||
}
|
||||
resolved.Consumable = &v
|
||||
c.Gathering.Consumables = append(slices.Clone(c.Gathering.Consumables), v)
|
||||
target = v.ID
|
||||
case "create-title":
|
||||
title := *change.Title
|
||||
if title.ID == "" {
|
||||
|
||||
Reference in New Issue
Block a user