aliens

Author Topic: [DONE][Suggestion] Weapon safety switch (for reactions)  (Read 2961 times)

Offline sudtrap

  • Sergeant
  • **
  • Posts: 22
    • View Profile
[DONE][Suggestion] Weapon safety switch (for reactions)
« on: July 04, 2023, 09:20:01 pm »
Hi Meridian! Long time fan of XCOM extended. (Mostly play XCOM files)

Was thinking it would be handy to maybe side click a weapon in combat and disable react firing with it. (There's already preferential react firing. Maybe you could side-click it twice, the second time changing the dot to Red?) Could probably also be an option in the menu if people decide they won't like side clicking multiple times.

Most of the time I make agents either unload their weapons, drop them, or hold things in their second hand to disable it; which is totally workable but kind of a silly thing to do. (Think of the poor, poor time units!) : D

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #1 on: July 04, 2023, 11:47:59 pm »
Interesting.

I didn't have such a requirement before, you are the first one.

But your reasoning is sound, I will think about it.
If I can find an unobtrusive way to implement it, it will be done.

Offline sudtrap

  • Sergeant
  • **
  • Posts: 22
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #2 on: July 05, 2023, 12:01:30 am »
Cool! Thanks for the prompt reply. : )

Offline psavola

  • Commander
  • *****
  • Posts: 827
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #3 on: July 05, 2023, 06:01:26 am »
Hi Meridian! Long time fan of XCOM extended. (Mostly play XCOM files)

Was thinking it would be handy to maybe side click a weapon in combat and disable react firing with it. (There's already preferential react firing. Maybe you could side-click it twice, the second time changing the dot to Red?) Could probably also be an option in the menu if people decide they won't like side clicking multiple times.

Most of the time I make agents either unload their weapons, drop them, or hold things in their second hand to disable it; which is totally workable but kind of a silly thing to do. (Think of the poor, poor time units!) : D

I wonder a bit about the use scenario, if you're currently dropping the weapon etc. If you don't want reaction firing, isn't this the same thing as setting the TUs to zero at the end of the turn? Or is there a particular reason why you still want to keep the TUs? The only case I could see is that you want to reaction "fire" using melee weapons or gunbutting.

Offline sudtrap

  • Sergeant
  • **
  • Posts: 22
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #4 on: July 05, 2023, 08:23:46 am »
Certain weapons (such as rocket launchers or grenade launchers) are an absolute nightmare if you react fire with them. And every single agent that has one has to be micromanaged each turn to ensure they do not blow up their own team mates.

Sometimes during longer missions I might have agents sitting around watching for prolonged periods of time, but I don't want them to accidentally react fire and snipe an enemy I'm trying to capture.

Another use case is that (particularly in the XCOM files) my agents may be dual wielding single handed weapons, (such as a taser), but the range of both one handed weapons is different, so rather than waiting to react fire with the taser they shoot with a handgun instead.

Each of these cases just makes more micromanaging of agents necessary; and as I'm sure that many of us attest we've forgotten agents and had them either shoot our agents in the back or murder a potential capture target.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Weapon Safety
« Reply #5 on: July 05, 2023, 10:27:04 am »
A very nice idea, better than dropping the weapon or expending all TUs. Especially when you're holding a second weapon.

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #6 on: July 06, 2023, 04:56:42 am »
The "joys" of unintended reaction fire... from a rocket launcher.  :)

Said dangerous weapons are usually 2-hand restrictive (red 2 number). Personally, I worked around this by assigning a side arm on the other hand (thus providing some sort of self defense) or perhaps a motion scanner as well, to remain useful in close quarters. But the TU loss of putting away and pulling out said extra item sometimes makes the difference.

I use the right-click priority hand for ranged weapons a lot. For example, in Piratez (current mod I'm playing) where I right click on the MG of the 85 mm Tank, so, if it react-fire, it's with the machine gun and not the main cannon, which could blow up the whole squad. Same with the Heavy Lascannon tank, where I select the tiny laser machine gun instead of the main gun, thus preventing wasting ammo on non-value targets. It's worth to note that the default weapon also controls the reserve TUs check for firing, which is nice.

I haven't tested, so I don't know if it were to right click on an empty hand, while holding, say a Rocket Launcher on the other, will prevent reaction fire, or the game will just switch to the other hand if the default hand is empty regardless of priority. I think it's the latter.

I agree with the OP idea, maybe a weapon safety (via options) can be implemented that instead of defaulting the weapon, will negate the weapon, on the selected hand for a reaction fire ranged attack. This can be just another right click, perhaps this time showing a red dot, will act as a weapon that won't automatic react-fire. Thus the sequence of right-clicks could be:

1st right click: yellow dot = default hand for reaction fire
2nd right click: red dot = hand forbidden of reaction fire (aka gun safety)
3rd right click: clear = all normal.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [Suggestion] Weapon Safety
« Reply #7 on: July 06, 2023, 02:03:06 pm »
I think that changing current behavior I would prefer using `Crtl` or `Alt` as modifier to change result of click.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: [DONE][Suggestion] Weapon safety switch (for reactions)
« Reply #8 on: February 09, 2024, 07:36:44 pm »
Done.

https://github.com/MeridianOXC/OpenXcom/commit/fb5360a31fe03aacb950766f2469f04d2851feb7

Ctrl + R-click to activate/deactivate.
Works only for player-controlled units (to prevent abuse).
Works only for reactions (i.e. doesn't work for other things like for example berserking... to prevent abuse).
Not considered for purposes of reserving TUs (for aimed/snap/auto).
Default indicator is a red dot.
Indicator can be modded using a sprite called "noReactionIndicator".
« Last Edit: February 09, 2024, 07:51:39 pm by Meridian »