Author Topic: Adding items to the UFO breaks Elerium recovery?  (Read 2822 times)

Offline Cooper

  • Colonel
  • ****
  • Posts: 151
  • Chryssalids are awesome
    • View Profile
Adding items to the UFO breaks Elerium recovery?
« on: November 22, 2022, 10:07:35 pm »
Ive added some items to a UFO floor like this:

  - type: STR_MEDIUM_SCOUT
[...]
    battlescapeTerrainData:
      name: UFO_110
      mapDataSets:
        - BLANKS
        - U_EXT02
        - U_WALL02
        - U_BITS
        - U_PODS
        - U_DISEC3
        - UFOL83
      mapBlocks:
        - name: UFO_EX1
          width: 10
          length: 10
          items:
            STR_ALIEN_SMOKE_GRENADE:
              - [7, 3, 0]
              - [7, 3, 0]


However this causes Elerium not to be recovered anymore! Is this a bug? Any way to fix this without removing the item?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #1 on: November 22, 2022, 10:16:05 pm »
yes, seems like a bug

I'll have a look...

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #2 on: November 22, 2022, 10:23:25 pm »
Not a bug, I looked at this a while ago.

If the mapblock has items defined, the code that causes the alien fuel item to be placed on power sources doesn't run so that it doesn't duplicate them in the TFTD ships where the fuel is placed elsewhere.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #3 on: November 22, 2022, 10:29:50 pm »
yup, found it, a feature, both in OXC and OXCE as oharty says

with a comment and all

Code: [Select]
// if one of the mapBlocks has an items array defined, don't deploy fuel algorithmically
_generateFuel = mapblock->getItems()->empty();

since July 2014

Offline Cooper

  • Colonel
  • ****
  • Posts: 151
  • Chryssalids are awesome
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #4 on: November 23, 2022, 12:16:23 am »
Alright, thanks for the info.

Any cool ideas on how to work around this?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #5 on: November 23, 2022, 12:41:52 am »
Add the Elerium manually in your "items" block.

Offline Cooper

  • Colonel
  • ****
  • Posts: 151
  • Chryssalids are awesome
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #6 on: November 23, 2022, 01:41:50 am »
Right!

I'm so glad one Elerium in battlescape = 50 Elerium in geoscape right now.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #7 on: November 23, 2022, 03:05:59 pm »
This is indeed how it works. It is a mild headache sometimes (especially when you use the same mapblocks for aliens and also for something else; it requires making a new terrain and redefine all the blocks), but I trust there was a good reason for this.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #8 on: December 01, 2022, 03:09:48 pm »
I'm so glad one Elerium in battlescape = 50 Elerium in geoscape right now.

I think you could use recoveryTransformations: to control the amount of Elerium recovered from each specific item you place in the mapblock.

Example:
Code: [Select]
items:
  - type: STR_ELERIUM_115_X25
    size: 0.1
    costSell: 5000
    weight: 3
    bigSprite: 56
    floorSprite: 37
    invWidth: 1
    invHeight: 1
    recoveryPoints: 5
    recoveryTransformations:
      STR_ELERIUM_115: [25]

Offline Cooper

  • Colonel
  • ****
  • Posts: 151
  • Chryssalids are awesome
    • View Profile
Re: Adding items to the UFO breaks Elerium recovery?
« Reply #9 on: December 02, 2022, 12:02:53 am »
Thats useful, thanks!