From abd612c15799f604e671e83dc7c410ed2b44185f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 25 Jun 2026 15:40:48 -0400 Subject: slop refactor --- internal/game/act_state.go | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 internal/game/act_state.go (limited to 'internal/game/act_state.go') diff --git a/internal/game/act_state.go b/internal/game/act_state.go new file mode 100644 index 0000000..a219875 --- /dev/null +++ b/internal/game/act_state.go @@ -0,0 +1,97 @@ +package game + +import ( + "thehouseoficarus/internal/behavior" + "thehouseoficarus/internal/player" +) + +func (g *Game) playerActionDisplay(p *player.Player) string { + if cs := g.Combat.Get(p.Name); cs != nil { + mob := g.MobStore.GetInstance(cs.MobID) + if mob != nil { + if mob.IsTask() { + return "working on a " + mob.Name + } + return "fighting a " + mob.Name + } + } + + if p.MoveTicks > 0 { + return "heading " + p.MoveDirection + } + if len(p.WalkSequence) > 0 { + return "walking somewhere with a purpose!" + } + + if ss, ok := g.safespot.Get(p.Name); ok && ss.Active { + obj, err := g.ObjectStore.Load(ss.ObjectDefID) + if err == nil { + return "positioning behind a " + obj.Name + } + return "hiding" + } + + if a := p.Action; a != nil { + switch a.Type { + case behavior.TypeGather: + if d, ok := a.Data.(*behavior.GatherData); ok { + desc := d.Verb + " a " + a.TargetName + if d.ToolName != "" { + desc += " with a " + d.ToolName + } + return desc + } + case behavior.TypeSteal: + return "stealing from " + a.TargetName + case behavior.TypeTalk: + return "talking to " + a.TargetName + case behavior.TypeUse: + return "using a " + a.TargetName + case behavior.TypeBurn: + return "trying to start a fire" + case behavior.TypeStoke: + return "tending to a fire" + case behavior.TypeSearch: + return "digging through a " + a.TargetName + case behavior.TypeIdentify: + return "identifying scrap at " + a.TargetName + case behavior.TypePlant: + return "planting " + a.TargetName + case behavior.TypeHarvest: + return "harvesting " + a.TargetName + case behavior.TypeRake: + return "raking a " + a.TargetName + case behavior.TypeWater: + return "watering a " + a.TargetName + case behavior.TypeCure: + return "curing a " + a.TargetName + case behavior.TypeObstacle: + return "traversing across " + a.TargetName + case behavior.TypeCook: + return "cooking some " + a.TargetName + case behavior.TypeSmelt: + return "smelting some " + a.TargetName + case behavior.TypeSmith: + return "smithing some " + a.TargetName + case behavior.TypeCraft: + return "crafting some " + a.TargetName + case behavior.TypeCombine: + return "combining some " + a.TargetName + case behavior.TypeMix: + return "mixing some " + a.TargetName + case behavior.TypeConstruct: + return "constructing some " + a.TargetName + } + } + + if a := p.BackgroundAction; a != nil { + switch a.Type { + case behavior.TypeFletch: + return "fletching " + a.TargetName + case behavior.TypeClean: + return "cleaning herbs" + } + } + + return "" +} -- cgit v1.2.3