aliens

Author Topic: [DONE][Suggestion] Modifiable craft stats (maxItems and maxStorageSpace)  (Read 1324 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
- Soldiers and vehicles as modifiable craft stats (by WarStalkeR):

Code: [Select]
craftWeapons:
  - override: STR_STINGRAY
    stats:
      soldiers: 2
  - override: STR_AVALANCHE
    stats:
      soldiers: -4
  - override: STR_CANNON_UC
    stats:
      vehicles: -4
Change can be positive or negative. This mean some weapons (when negative) eatup unit storage in craft.
By default when you set `soldiers` in craft, it become and you can't go higher. You need add `maxUnitsLimit` to override this limit and
have more potential space for solders if you add "cargo pods".

As we say in Russia, “once there’s such a drinking session, cut the last cucumber.” I suggest adding “maxItems” and “maxStorageSpace” there too, for a complete set. :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Suggestion] Modifiable craft stats (maxItems and maxStorageSpace)
« Reply #1 on: December 31, 2023, 10:51:41 am »
1/ How do you want to prevent a situation where craft with infinite storage becomes limited after equipping a weapon.

For example:
- Skyranger without a weapon has `maxItems: 0` meaning infinite storage
- Skyranger with a weapon that has `maxItems: 5` will have storage of 0 + 5 = 5, i.e. no longer infinite, but very finite

Should I exclude craft with default infinite storage somehow?


2/ Similar question for craft with finite storage becoming craft with infinite storage.

Example:
- Skyranger without a weapon has `maxItems: 100` meaning finite storage of 100 items
- Skyranger with a weapon that has `maxItems: -100` will have storage of 100 + (-100) = 0, i.e. infinite storage

Should I handle this case somehow?

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [Suggestion] Modifiable craft stats (maxItems and maxStorageSpace)
« Reply #2 on: December 31, 2023, 11:24:38 am »
1) Yes, of course. Ships with "maxItems: 0" should ignore this weapon bonus.

2) There must be a check. If the ship has the "maxStorageSpace:" parameter, then a similar weapon bonus works. If not, the bonus is ignored.

I have plans to use both bonuses in one weapon, or rather in a module that will be used by both landing and cargo ships. Landing ships have only “maxItems:”, cargo ships only “maxStorageSpace:”, and there will be one weapon/module for both classes of ships.

Oh yes, there should be no negative values. Just to avoid mistakes. I won't need negative values, but others may need them. It's up to you.
« Last Edit: December 31, 2023, 11:37:33 am by Ethereal »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [DONE][Suggestion] Modifiable craft stats (maxItems and maxStorageSpace)
« Reply #3 on: January 01, 2024, 08:08:55 pm »
Done.

Also, defaults have changed.

New default for craft maxItems = 999999
New default for craft maxStorageSpace = 99999.0
Defaults for craft weapons are 0 and 0.0


Sample ruleset:

Code: [Select]
crafts:
  - type: STR_SKYRANGER
    weapons: 2
    maxItems: 10
    maxStorageSpace: 5.0


craftWeapons:
  - type: STR_STINGRAY
    stats:
      maxItems: -2
      maxStorageSpace: -3.0

https://github.com/MeridianOXC/OpenXcom/commit/776d618ef7f70048edc471c5358764772df05932
https://github.com/MeridianOXC/OpenXcom/commit/92b66ec926e4cd11f10f0d0f2005de6db192e1de
https://github.com/MeridianOXC/OpenXcom/commit/d529b469354dbad8831606bd11195570812cdf34

PS: if the craft already starts with a wrong number of items, the weapons are not removed automatically... since it is less critical than let's say wrong soldier slots and doesn't lead to crashes
« Last Edit: January 01, 2024, 08:11:40 pm by Meridian »

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [DONE][Suggestion] Modifiable craft stats (maxItems and maxStorageSpace)
« Reply #4 on: January 02, 2024, 01:36:07 pm »
Interesting solution. Thank you.