diff options
| author | historia <[not public]> | 2026-07-01 03:21:52 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-01 03:21:52 -0400 |
| commit | fbe5090ac3325ff8ea6989cdf4515c7f077c975b (patch) | |
| tree | 1811ad9c6a596e7177bb2c42944c389c0a120066 /internal/game/cmd_use.go | |
| parent | 5f37dc9b6f6b79da04da70ae0c33ec8d02998587 (diff) | |
| download | thehouseoficarus-fbe5090ac3325ff8ea6989cdf4515c7f077c975b.tar.gz | |
feat: item messaging standardized, custom messages for production paths implemented
Diffstat (limited to 'internal/game/cmd_use.go')
| -rw-r--r-- | internal/game/cmd_use.go | 32 |
1 files changed, 21 insertions, 11 deletions
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 } |
