Author Topic: [DONE][Suggestion] Support for grenades exploding before battle  (Read 1172 times)

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
[DONE][Suggestion] Support for grenades exploding before battle
« on: January 15, 2024, 02:24:38 am »
Making the fusetimers on itens exploding at [0, 0] like the spawning itens (before the battlestarts on theory).

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
Re: [DONE][Suggestion] Support for grenades exploding before battle
« Reply #1 on: January 21, 2024, 08:36:46 pm »
Making the fusetimers on items exploding at [0, 0] like the spawning items (before the battle starts on theory).

Done.

Commit: https://github.com/MeridianOXC/OpenXcom/commit/af6052f1f186d8120c5d21d5499022293efc0547

[0, 0] is already reserved for "explode after first player turn"
[-2, -2] can be used for "explode before battle"

Sequence of events:
1. first, power sources explode -- they can destroy items used in phase 2 and 3
2. then, non-spawning grenades with fuseTimers [-2, -2] explode -- they can destroy items used in phase 3; they cannot (accidentally) destroy themselves (phase 2)
3. lastly, spawning grenades with fuseTimers [0, 0] explode/trigger

Currently "before battle" means only before mission stage 1.
(If multiple mission stages support is needed, write here, and give a reasonable example.)

Ruleset sample:

Code: [Select]
ufos:
  - type: STR_MEDIUM_SCOUT
    battlescapeTerrainData:
      name: UFO_110
      mapBlocks:
        - name: UFO_110
          items:
            STR_GRENADE:
              - [5, 0, 0]
              - [5, 2, 0]
              - [6, 6, 0]
          fuseTimers:
            STR_GRENADE: [-2, -2]   # -2 = mapblock grenade to explode before battle
          width: 10
          length: 10
      mapDataSets:
        - BLANKS
        - U_EXT02
        - U_WALL02
        - U_BITS

Not tested much.
Help with testing appreciated.

Test build: https://lxnt.wtf/oxem/builds//Extended/Extended-7.11.2-af6052f1f-2024-01-21-win64.7z

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: [DONE][Suggestion] Support for grenades exploding before battle
« Reply #2 on: January 22, 2024, 03:27:53 am »
thks, it was very quick, i will test it as soon as i can

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: [DONE][Suggestion] Support for grenades exploding before battle
« Reply #3 on: January 22, 2024, 12:55:17 pm »
All working as intended
« Last Edit: January 22, 2024, 03:13:40 pm by Meridian »