diff options
| author | historia <[not public]> | 2026-06-20 04:44:44 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-20 04:44:44 -0400 |
| commit | 704627c3410a1dcab12e35cf67628bd014b4b5d8 (patch) | |
| tree | 4b298bfef86c43af970890c5450e8721aeac8a9d /internal/game/action.go | |
| parent | dde563e6810124a73de5ef12e92774c540f9d62e (diff) | |
| download | thehouseoficarus-704627c3410a1dcab12e35cf67628bd014b4b5d8.tar.gz | |
feat: added verbs command (probably janky)
Diffstat (limited to 'internal/game/action.go')
| -rw-r--r-- | internal/game/action.go | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/internal/game/action.go b/internal/game/action.go index 2f5dbaf..d6ef1bc 100644 --- a/internal/game/action.go +++ b/internal/game/action.go @@ -75,6 +75,7 @@ func (g *Game) startAction(sess *net.Session, verb, target string) { var obj *object.ObjectDef var mob *world.MobInstance + var chosen *world.ObjState if len(instances) > 0 { uniqueDefs := make(map[string]bool) @@ -86,7 +87,6 @@ func (g *Game) startAction(sess *net.Session, verb, target string) { return } - var chosen *world.ObjState if instanceIdx >= 0 && instanceIdx < len(instances) { chosen = &instances[instanceIdx] } else { @@ -163,29 +163,11 @@ func (g *Game) startAction(sess *net.Session, verb, target string) { switch bhType { case "gather": - if obj == nil { + if obj == nil || chosen == nil { sess.WriteLine(fmt.Sprintf("You can't %s that.", verb)) return } - chosenObj := g.World.FindObjInstances(p.RoomID, obj.ID) - sort.Slice(chosenObj, func(i, j int) bool { - return chosenObj[i].Index < chosenObj[j].Index - }) - var st *world.ObjState - for i := range chosenObj { - if !chosenObj[i].Depleted { - st = &chosenObj[i] - break - } - } - if st == nil && len(chosenObj) > 0 { - st = &chosenObj[0] - } - if st == nil { - sess.WriteLine(fmt.Sprintf("There's nothing here to %s.", verb)) - return - } - g.startGather(sess, p, obj, st) + g.startGather(sess, p, obj, chosen) case "talk": if mob != nil { g.startMobTalk(sess, p, mob) |
