From fbe5090ac3325ff8ea6989cdf4515c7f077c975b Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 03:21:52 -0400 Subject: feat: item messaging standardized, custom messages for production paths implemented --- internal/game/cmd_use.go | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'internal/game/cmd_use.go') diff --git a/internal/game/cmd_use.go b/internal/game/cmd_use.go index 033fd62..1989a3e 100644 --- a/internal/game/cmd_use.go +++ b/internal/game/cmd_use.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "thehouseoficarus/internal/behavior" "thehouseoficarus/internal/item" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" @@ -97,13 +98,17 @@ func (g *Game) useRoomObject(sess *net.Session, p *player.Player, input string) if ui.Condition != nil && !g.checkCondition(sess, ui.Condition) { continue } - if ui.Message != "" { - sess.WriteLine(ui.Message) + g.cancelAction(p) + p.Action = &behavior.Action{ + Type: behavior.TypeUseInteraction, + TargetName: def.Name, + WaitLeft: 1, + Data: &behavior.UseInteractionData{ + Message: ui.Message, + Action: ui.Action, + ObjName: def.Name, + }, } - if ui.Action != nil { - g.applyNodeAction(sess, ui.Action) - } - g.broadcastAction(sess, "%s uses the %s.", p.Name, def.Name) return true } if len(def.UseInteractions) > 0 { @@ -286,11 +291,16 @@ func (g *Game) doUseItemOnTarget(sess *net.Session, p *player.Player, itemAName, if ui.Condition != nil && !g.checkCondition(sess, ui.Condition) { continue } - if ui.Message != "" { - sess.WriteLine(ui.Message) - } - if ui.Action != nil { - g.applyNodeAction(sess, ui.Action) + g.cancelAction(p) + p.Action = &behavior.Action{ + Type: behavior.TypeUseInteraction, + TargetName: def.Name, + WaitLeft: 1, + Data: &behavior.UseInteractionData{ + Message: ui.Message, + Action: ui.Action, + ObjName: def.Name, + }, } return } -- cgit v1.2.3