diff options
| author | historia <[not public]> | 2026-07-08 19:59:14 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-08 19:59:14 -0400 |
| commit | 09d325dcf5e779eab5550d3fd3377bde50101428 (patch) | |
| tree | a433be903aabbf1d2eadce2aacdac12a9eb8dde0 /internal/player | |
| parent | 9184377301c2604e003f36426788c032fb0ca524 (diff) | |
| download | thehouseoficarus-09d325dcf5e779eab5550d3fd3377bde50101428.tar.gz | |
feat: unify on use, on look, and on kill. all support same conditions/actions now.
Diffstat (limited to 'internal/player')
| -rw-r--r-- | internal/player/player.go | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index fcf274b..f56521e 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -180,14 +180,13 @@ type Player struct { WalkSequence []string `yaml:"-"` ConsumeCooldown int `yaml:"-"` HomeTransportCooldown int `yaml:"-"` - MoveTicks int `yaml:"-"` + MoveTicks int `yaml:"-"` MoveDirection string `yaml:"-"` - MoveTarget int `yaml:"-"` - MovePendingGlobalFlags map[string]any `yaml:"-"` - MovePendingPlayerFlags map[string]any `yaml:"-"` - VisualTickCurrent int `yaml:"-"` - AutotriggerMod string `yaml:"-"` - QueuedTrigger string `yaml:"-"` + MoveTarget int `yaml:"-"` + MovePendingInteraction *behavior.Interaction `yaml:"-"` + VisualTickCurrent int `yaml:"-"` + AutotriggerMod string `yaml:"-"` + QueuedTrigger string `yaml:"-"` AttackTimer int `yaml:"-"` HazardTimer int `yaml:"-"` PendingDangerDir string `yaml:"-"` @@ -219,8 +218,7 @@ func (p *Player) ClearMoveState() { p.MoveTicks = 0 p.MoveDirection = "" p.MoveTarget = 0 - p.MovePendingGlobalFlags = nil - p.MovePendingPlayerFlags = nil + p.MovePendingInteraction = nil } func (p *Player) OptionBool(name string) bool { @@ -402,6 +400,19 @@ func (p *Player) HasItem(itemID string) bool { return false } +// IsWielding reports whether the given item is currently held in one of the +// player's weapon-hand equipment slots (main_hand or off_hand). It is the +// "wielding" predicate used to gate on_kill interactions whose item_id names +// a specific weapon — two-handed weapons occupy main_hand alone, while dual +// wield / weapon + shield uses both hands. Armor, ammo, ring, and tool slots +// do NOT count as "wielding". +func (p *Player) IsWielding(itemID string) bool { + if itemID == "" { + return false + } + return p.Equipment[item.SlotMainHand] == itemID || p.Equipment[item.SlotOffHand] == itemID +} + func (p *Player) CountItem(itemID string) int { count := 0 for _, slot := range p.Inventory { |
