Author Topic: [FIXED] Prepriming exploit  (Read 229 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5476
  • punk not dead
    • View Profile
    • Nocturnal Productions
[FIXED] Prepriming exploit
« on: March 25, 2025, 04:49:02 pm »
Not sure if it's OXC or OXCE bug, but prepriming allows you to prime or unprime grenades with     costPrime/costUnprime:       time: 0 (which normally makes it impossible to prime or unprime grenades). It also allows to sidestep other ways of making a grenade impossible to prime or unprime, like fuseType: -3.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9477
    • View Profile
Re: Prepriming exploit
« Reply #1 on: March 25, 2025, 04:50:43 pm »
ok, I will check

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9477
    • View Profile
Re: Prepriming exploit
« Reply #2 on: March 25, 2025, 09:36:53 pm »
a/ prepriming doesn't cost any TU, so cost is not checked there... but I can add such a check if desired

b/ however I was not able to preprime a grenade with `fuseType: -3`... how did you do that?
there is an explicit check for that: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Battlescape/Inventory.cpp#L1119


and the most important question, what is the point of a "not primeable" grenade?
I don't think any dev has considered such a combination, so there's probably more issues around with such grenades that would need to be double-checked too...
« Last Edit: March 25, 2025, 10:08:25 pm by Meridian »

Online psavola

  • Commander
  • *****
  • Posts: 944
    • View Profile
Re: Prepriming exploit
« Reply #3 on: March 25, 2025, 10:00:58 pm »
This may be somewhat related.

In XCF I came upon an issue when the mod author had meant flares to be primeable and unprimeable (ie. you cannot unprime a flare that you have already primed). Yet in battle equipping screen with prepriming enabled you could unprime flares (causing default message to be printed) even though you could not do so in battlescape. I don't think anyone considered this a major issue, and a text message was customized.

It's just worth noting that if the mod thinks unprime costs are always enforced, there may be surprises with prepriming which is kinda special case because the battle has not started yet and various restrictions and costs don't apply (for a good reason).


Offline Yankes

  • Commander
  • Global Moderator
  • Commander
  • *****
  • Posts: 3462
  • Posts: 421
    • View Profile
Re: Prepriming exploit
« Reply #4 on: March 25, 2025, 11:55:50 pm »
Before start of battle you should be able to reset grenades to default state after prime as we are not in battle yet.
As I understand Dioxine want some items that can't be even primed in pre-battle state (quest items?).

Current behavior still can have uses (like consumable items that can buff user when equipped) but Dio case is too reasonable.
Now question what version should be default for `0` as we could break mods that wanted opposite.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9477
    • View Profile
Re: [FIXED] Prepriming exploit
« Reply #5 on: March 29, 2025, 10:42:00 am »
Not sure if it's OXC or OXCE bug, but prepriming allows you to prime or unprime grenades with     costPrime/costUnprime:       time: 0 (which normally makes it impossible to prime or unprime grenades).

Implemented:
https://github.com/MeridianOXC/OpenXcom/commit/c721b58520b323424e71ed900249533017ac134c
https://github.com/MeridianOXC/OpenXcom/commit/d17a6910ab1377274f3944322bde8b97dc231064

It also allows to sidestep other ways of making a grenade impossible to prime or unprime, like fuseType: -3.

Cannot reproduce -> cannot fix.
« Last Edit: March 30, 2025, 10:23:50 am by Meridian »