Page 1 of 1

Weapons safety toggle and ECM

Posted: Wed Jul 02, 2025 8:36 pm
by Bicorn
I think the ECM system should count as a "weapon" for the purpose of the weapon systems off/on toggle. Even if it doesn't count as a crime, I still can't imagine all the NPC ships around a station appreciate getting blasted with the ECM jamming signal when I fat-finger a key; it also makes conceptual sense, as like the guns and missiles it's a system you're only supposed to use in combat.

Re: Weapons safety toggle and ECM

Posted: Thu Jul 03, 2025 6:35 am
by another_commander
Makes sense. I'll make the change shortly and you should be able to test a binary containing it later today.

Re: Weapons safety toggle and ECM

Posted: Thu Jul 03, 2025 7:13 am
by another_commander
Done. You can find the inclusion of ECM in the weapons that get toggled on/off in pre-release 1.91.0.7679-250703-49e991a.

Re: Weapons safety toggle and ECM

Posted: Thu Jul 03, 2025 8:19 am
by Wildeblood
https://wiki.alioth.net/index.php/Oolit ... emsToggled

Describes the related JS event thus:

The weaponsSystemsToggled handler is called whenever the player toggles their weapons systems on or off. The state parameter contains the new state of the weapons systems

this.weaponsSystemsToggled = function(state : boolean)
{
// Your code here
}

The parameter passed is not, however, truly a Boolean value, it contains a number 0 or 1, rather than true or false. player.ship.weaponsOnline , however, does contain a value of true or false. I imagine this was deliberate, as using 0 or 1 allows the possibility of detail being added in future, e.g. 1 = lasers online, 2 = lasers and missiles online, etc. all of which pass as true-ish in JS.

On the off chance it wasn't deliberate, I mention it now.