diff options
| author | historia <[not public]> | 2026-07-09 22:15:54 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-09 22:15:54 -0400 |
| commit | ecba7f726f70b37126d852c38c7e3eec7b04d730 (patch) | |
| tree | 9129215c6e5015336fde1116395336d82bb952d1 /internal/game/cmd_use.go | |
| parent | b3d4c616f59ad2519f3a0b77e3b47d6571cd2486 (diff) | |
| download | thehouseoficarus-ecba7f726f70b37126d852c38c7e3eec7b04d730.tar.gz | |
feat: old standalone trigger systems completely unified into trigger->condition->action system
Diffstat (limited to 'internal/game/cmd_use.go')
| -rw-r--r-- | internal/game/cmd_use.go | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/internal/game/cmd_use.go b/internal/game/cmd_use.go index a2cb135..975eddb 100644 --- a/internal/game/cmd_use.go +++ b/internal/game/cmd_use.go @@ -90,17 +90,10 @@ func (g *Game) useRoomObject(sess *net.Session, p *player.Player, input string) g.startAction(sess, bt, def.Name) return true } - for _, ui := range def.OnUse { - if ui.Item != "" { - continue - } - if ui.Condition != nil && !g.checkCondition(sess, ui.Condition) { - continue - } - g.cancelAction(p) - name := def.Name - g.broadcastAction(sess, "%s uses the %s.", p.Name, name) - g.runInteraction(sess, p, ui.Action, p.RoomID, scopePlayer, nil) + g.cancelAction(p) + name := def.Name + g.broadcastAction(sess, "%s uses the %s.", p.Name, name) + if g.runTrigger(sess, p, def.OnUse, p.RoomID, func(id string) bool { return false }, false) { return true } if len(def.OnUse) > 0 { @@ -276,17 +269,10 @@ func (g *Game) doUseItemOnTarget(sess *net.Session, p *player.Player, itemAName, return } - for _, ui := range def.OnUse { - if ui.Item != itemAID { - continue - } - if ui.Condition != nil && !g.checkCondition(sess, ui.Condition) { - continue - } - g.cancelAction(p) - name := def.Name - g.broadcastAction(sess, "%s uses the %s.", p.Name, name) - g.runInteraction(sess, p, ui.Action, p.RoomID, scopePlayer, nil) + g.cancelAction(p) + name := def.Name + g.broadcastAction(sess, "%s uses the %s.", p.Name, name) + if g.runTrigger(sess, p, def.OnUse, p.RoomID, func(id string) bool { return id == itemAID }, false) { return } |
