Weapons safety toggle and ECM

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
Bicorn
Dangerous
Dangerous
Posts: 71
Joined: Wed Jun 18, 2025 8:47 am

Weapons safety toggle and ECM

Post 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.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6854
Joined: Wed Feb 28, 2007 7:54 am

Re: Weapons safety toggle and ECM

Post by another_commander »

Makes sense. I'll make the change shortly and you should be able to test a binary containing it later today.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6854
Joined: Wed Feb 28, 2007 7:54 am

Re: Weapons safety toggle and ECM

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2786
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: Weapons safety toggle and ECM

Post 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.
"Must keep this response efficient to preserve remaining context."
Post Reply