Author Topic: Adding items instead of replacing everything?  (Read 2535 times)

Offline NastyKhan

  • Sergeant
  • **
  • Posts: 17
    • View Profile
Adding items instead of replacing everything?
« on: June 05, 2021, 07:44:59 pm »
Hi,

Is there a way to ADD my custom items to "startingBase" items collection without removing everything else from the list and without re-declaring whole list?

Quote
startingBase:
  items:
    STR_SNIPER_RIFLE: 2
    STR_SNIPER_RIFLE_AMMO: 6

I googled this, but it doesn't seem to work:

Quote
#base mod:
 items:
   - type: STR_WEAPON
     compatibleAmmo: !info     #this tag does not change anything, but when used it will show (in the log file) if the list supports this functionality or not
       - STR_AMMO_1
       - STR_AMMO_2
 
 #sub-mod
 items:
   - type: STR_WEAPON
     compatibleAmmo: !add      #now `STR_WEAPON` will have ammo list equal to `[STR_AMMO_1, STR_AMMO_2, STR_AMMO_3]`
       - STR_AMMO_3
 
 #another sub-mod
 items:
   - type: STR_WEAPON
     compatibleAmmo: !remove   #now `STR_WEAPON` will have ammo list equal to `[STR_AMMO_1, STR_AMMO_3]`
       - STR_AMMO_2

Best regards

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Adding items instead of replacing everything?
« Reply #1 on: June 05, 2021, 11:12:48 pm »
...
Is there a way to ADD my custom items to "startingBase" items collection without removing everything else from the list and without re-declaring whole list?
...
Just tested it out on my system (since i wasn't sure). For OXC you need to re-declare the whole list (no need to remove anything, once you define ```items:``` the previously defined list is thrown away).

...
googled this, but it doesn't seem to work:
...
For support of the syntax as shown by your google result you need OXCE (see: https://openxcom.org/forum/index.php/topic,5258.0.html), OXC does not support this.

Hope this helps

Offline NastyKhan

  • Sergeant
  • **
  • Posts: 17
    • View Profile
Re: Adding items instead of replacing everything?
« Reply #2 on: June 05, 2021, 11:51:42 pm »
Hmm... That makes sense. Thank you :)

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3348
    • View Profile
Re: Adding items instead of replacing everything?
« Reply #3 on: June 06, 2021, 01:21:38 am »
One caveat, in this case this will never work as engine load this in very specific way that can't have enable this.