Hello Meridian, I spoke with Yankes in Matrix Chat and he told me that you intend to implement Multi-Craft Hangars. I want to know if you intended to implement Multi-Craft Hangars in a way, similar to what I implemented here:
https://github.com/WarStalkeR/OpenXcomExMore/compare/810aba6..8e4cb43?diff=unifiedSadly, this compare is quite messy as it encompasses multiple code changes, including Multi-Craft Hangars, Craft Sizes, Custom/Moddable Craft Classifications, Bigger Craft Sprites and even soldiers+vehicles as modifiable craft stats (that already in pull into main and QA'd by Yankes).
I'm mostly active on Matrix and all glaring mistakes that were pointed out by Yankes - are fixed, except few: missing proper Struct for hangar slots instead of Position and missing proper Struct for bigOffset. Because I make it all for submod for XPZ, it uses OXCE 7.9.8 as base version. Latest compiled EXE is also uploaded there (in Submods chatroom).
Meridian, you don't need to do any QA, just tell me if this is same or similar way you intended to implement? And I will work from there.
And this is how it looks for modders right now (more description is on GitHub):
facilities:
- type: NEW_FANCY_HANGAR
crafts: 2 #Original code isn't going anywhere for sake of max backwards compatibility.
craftsHidden: false #Flag to render or not render housed crafts in base view. Mostly for damaged/sealed hangars.
craftOptions: #Horizontal offset - X, Vertical offset - Y, Craft size limit Z (0 is no size limit and default).
- [2, -4, 37] #This slot can fit size 37 craft or smaller.
- [8, 2, -25] #This slot can fit size 24 craft or smaller and is always hidden, regardless of the 'craftsHidden'
The
- [2, -4, 37] will be replaced with
- {x: 2, y: -4, size: 37, hidden: false} per Yankes advice. I originally intended to go with
- [2, -4, 37, false] but Yankes said its better to make it more verbose and obvious, which I agree with.
crafts:
- type: NEW_FANCY_CRAFT
craftSize: 12 #Can't be placed into size 11 hangar slots. If 0, can be placed into any hangar slot (0 is default).
The craftSize variable has no bounds beside being an int (i.e. from -2^31 to 2^31). Modders can define for themselves what craft size ranges belongs to what craft classes.
craftWeapons:
- type: NEW_FANCY_WEAPON
stats:
craftSize: 6 #Increases craft's size by 6, if equipped. Can't be equipped if no suitable hangar slots available.
craftSize is stat as so modders can create various types that take more or less space on craft.
craftClasses:
100: STR_CRAFT_CLASS_03 #All crafts of size 100 or above will be assigned STR_CRAFT_CLASS_03 string.
20: STR_CRAFT_CLASS_02 #All crafts of size 20 to 99 will be assigned STR_CRAFT_CLASS_02 string.
1: STR_CRAFT_CLASS_01 #All crafts of size 1 to 19 will be assigned STR_CRAFT_CLASS_01 string.
0: STR_CRAFT_CLASS_NA #All crafts of size 0 or below will be assigned STR_CRAFT_CLASS_NA string.
craftsCanChangeClass: false #Allows to enforce craft size changes to be within boundaries declared in the craftClasses.
This is global option and can be added just to any rule file.
craftsCanChangeClass will allow modders to ensure that player can't install quad 30mm autocannon that increases
craftSize by 20 (just because it is in light weapons group) on small helicopter.
crafts:
- type: BIG_SPRITE_CRAFT
bigOffsetX: -11 #Because sprite width got increased by 22, i.e. from 32 to 54.
bigOffsetY: -16 #Because sprite height got increased by 32, i.e. from 40 to 72.
Allows to keep crafts with bigger sprites centered in hangars at same point as original 32x40 sprites. Any change to the sprite size should be even: i.e. you can't use 35x45 pixels sprite. Any change to sprite size should get reflected as negative half in
bigOffsetX and
bigOffsetY. Rather lazy implementation, but I will replace it with custom Struct as well.