From 704627c3410a1dcab12e35cf67628bd014b4b5d8 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 20 Jun 2026 04:44:44 -0400 Subject: feat: added verbs command (probably janky) --- internal/game/action.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'internal/game/action.go') 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) -- cgit v1.2.3