Weapons don't inherently have a player owner, so it doesn't know who's start-of-turn it should listen for to deactivate. The current check is in:
simengine:endTurn, once it progresses to starting the next turn, it notifies the next turn's current player
simplayer:onStartTurn, which goes through all of its own units
simunit:onStartTurn, which checks all of its children, to see if any of them are energyWeapon.
This doesn't happen if the weapon isn't carried by a player unit.
Start the patch in inventory.useItem (where it currently handles updating energyWeapon to active)
Either use :setPlayerOwner to store the wielder's player-owner (deployables do this to track ownership and register for onStartTurn with the right player), and update simunit:onStartTurn to check self for energyWeapon.
Or store the player on at trait and add a listener (on what?) for TRG_START_TURN to do the handling.
Weapons don't inherently have a player owner, so it doesn't know who's start-of-turn it should listen for to deactivate. The current check is in:
simengine:endTurn
, once it progresses to starting the next turn, it notifies the next turn's current playersimplayer:onStartTurn
, which goes through all of its own unitssimunit:onStartTurn
, which checks all of its children, to see if any of them areenergyWeapon
.This doesn't happen if the weapon isn't carried by a player unit.
inventory.useItem
(where it currently handles updating energyWeapon to active):setPlayerOwner
to store the wielder's player-owner (deployables do this to track ownership and register for onStartTurn with the right player), and update simunit:onStartTurn to check self for energyWeapon.TRG_START_TURN
to do the handling.