aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_farm.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-16 15:00:46 -0400
committerhistoria <[not public]>2026-09-16 15:00:46 -0400
commita6cf03a6ae98e4fb675da25046d148e92bcf7206 (patch)
tree194499fe9e696be8c31cd915b7ad92678f9f95e0 /internal/game/act_farm.go
parent9192d94dea6be5498ab080f3e2df5667af871d7a (diff)
downloadthehouseoficarus-a6cf03a6ae98e4fb675da25046d148e92bcf7206.tar.gz
chore: staticcheck and gofmt cleanups
Diffstat (limited to 'internal/game/act_farm.go')
-rw-r--r--internal/game/act_farm.go55
1 files changed, 3 insertions, 52 deletions
diff --git a/internal/game/act_farm.go b/internal/game/act_farm.go
index 8ed0d1b..cc7ddc4 100644
--- a/internal/game/act_farm.go
+++ b/internal/game/act_farm.go
@@ -456,55 +456,6 @@ func (g *Game) toolShedLookSuffix(p *player.Player) string {
return fmt.Sprintf("Inside: %s.", strings.Join(stored, ", "))
}
-func (g *Game) farmMatchPrefix(p *player.Player, input string) (prefix string, defID string, index int) {
- objInstances := g.World.AllObjInstances(p.RoomID)
- if len(objInstances) == 0 {
- return "", "", -1
- }
-
- type indexedFarm struct {
- prefix string
- defID string
- index int
- name string
- }
- var farms []indexedFarm
-
- for _, obj := range objInstances {
- if !farmPatchDefIDs[obj.DefID] {
- continue
- }
- pref := farmFlagPrefix(obj.DefID, obj.Index)
- if pref == "" {
- continue
- }
- var name string
- if def, err := g.ObjectStore.Load(obj.DefID); err == nil {
- name = def.Name
- } else {
- name = obj.DefID
- }
- farms = append(farms, indexedFarm{prefix: pref, defID: obj.DefID, index: obj.Index, name: name})
- }
-
- if len(farms) == 0 {
- return "", "", -1
- }
-
- if input == "" {
- return farms[0].prefix, farms[0].defID, farms[0].index
- }
-
- lower := strings.ToLower(input)
- for _, f := range farms {
- if strings.Contains(lower, strings.ToLower(f.name)) || behavior.WordPrefixMatch(lower, f.name) {
- return f.prefix, f.defID, f.index
- }
- }
-
- return "", "", -1
-}
-
func (g *Game) farmObjSuffix(p *player.Player, defID string, index int) string {
if defID == "tool_shed" {
return g.toolShedLookSuffix(p)
@@ -559,7 +510,7 @@ func (g *Game) showFarmPatches(sess *net.Session, p *player.Player) []string {
if weeds {
displays = append(displays, farmDisplay{
name: fmt.Sprintf("%s%s", patchName, idxStr),
- line: fmt.Sprintf("overgrown with weeds"),
+ line: "overgrown with weeds",
})
continue
}
@@ -568,7 +519,7 @@ func (g *Game) showFarmPatches(sess *net.Session, p *player.Player) []string {
if seedID == "" {
displays = append(displays, farmDisplay{
name: fmt.Sprintf("%s%s", patchName, idxStr),
- line: fmt.Sprintf("empty and ready for planting"),
+ line: "empty and ready for planting",
})
continue
}
@@ -582,7 +533,7 @@ func (g *Game) showFarmPatches(sess *net.Session, p *player.Player) []string {
if dead {
displays = append(displays, farmDisplay{
name: fmt.Sprintf("%s%s", patchName, idxStr),
- line: fmt.Sprintf("contains a dead plant"),
+ line: "contains a dead plant",
})
continue
}