Author Topic: [DONE][SUGGESTION] Alternate loadout system  (Read 22297 times)

Offline Yankes

  • Commander
  • *****
  • Posts: 3293
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #15 on: April 14, 2022, 12:44:56 pm »
From the player's perspective, it would be just tedious...
If I (as a player) want to use this system (and why wouldn't I?), then this Shift would always need to be pressed.
Then add another user option that invert default behavior aka without shift move/remove solder inventory, with shift only move soldier to/out craft.

Options for both have interesting consequence that you can fill whole craft of 10x of given inventory layout using only 20 clicks.

This give me Idea, why not make "inventory layout" a item in craft loadout? Some kind of meta-item that have linked list of items with some amounts.
Like:
Code: [Select]
StandardLayout:
  Grenade: 2
  Gun: 1
  Clip: 3
Utils:
  StunRod: 1
  PsiAmp: 1
  MedKit: 2
And on craft inventory we have:
Code: [Select]
StandardLayout + - 0
Utils          + - 0
Gun            + - 3
Grenade        + - 1
Clip           + - 1
And when you add `StandardLayout` it will increase matching real items count.
Like:

Code: [Select]
StandardLayout + - 1
Utils          + - 0
Gun            + - 4
Grenade        + - 3
Clip           + - 4
When you leave this screen game can forget how many you have this "meta-item" selected.
If you want redone it you can simply clear whole inventory and add again this "meta-item", lot of clicking but if your want you can have
one "meta-item" that cover whole craft inventory.



[ps]

Another possible stateless solution:

When you empty whole craft inventory button "unload" change into "auto load", when you click it game will iterate for each solder and try add items that he have in default inventory layout.
« Last Edit: April 14, 2022, 01:25:20 pm by Yankes »

Online R1dO

  • Colonel
  • ****
  • Posts: 441
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #16 on: April 14, 2022, 05:07:34 pm »
From the player's perspective, it would be just tedious...
If I (as a player) want to use this system (and why wouldn't I?), then this Shift would always need to be pressed.

This is actually a good argument for making it an user option toggle.
If the user wants it, it is always on. If not it is always off.

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11665
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Alternate loadout system
« Reply #17 on: April 14, 2022, 08:52:23 pm »
Then add another user option that invert default behavior aka without shift move/remove solder inventory, with shift only move soldier to/out craft.

Yeah, that would be OK.

Options for both have interesting consequence that you can fill whole craft of 10x of given inventory layout using only 20 clicks.

What makes you think that you can just leisurely load 20x of any item? :P

This give me Idea, why not make "inventory layout" a item in craft loadout? Some kind of meta-item that have linked list of items with some amounts. (...)

Sorry, I have no idea what you're talking about.

Are items loaded/unloaded with the relevant soldier or not?

Another possible stateless solution:

When you empty whole craft inventory button "unload" change into "auto load", when you click it game will iterate for each solder and try add items that he have in default inventory layout.

I guess it's a solution... But not one I like. The point is to not care about equipment loadouts other than by soldier.

Offline Delian

  • Colonel
  • ****
  • Posts: 414
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #18 on: April 16, 2022, 01:13:53 am »
I think've come up with a perfect (and simple) solution.

Currently, when you're editing soldier inventories, you can use the hotkeys 1-9 to load a soldier with a saved global equipment layout, or press L to load a personal template, right? But if you don't have the required items on the craft, you get an error "Not enough items to copy template!".

What if we simply changed it so that instead of the error "Not enough items to copy template!", you would get an info message "Template items added to craft!"? In other words, when loading a template, the missing items would be automatically added to the craft as necessary (or give you an error if not enough items in the base).

Personally, I change soldier equipment very often. I optimize to bring specific items for the specific enemies I'll be facing, rather than using personal templates. That is, I don't ever use L to load a personal template, only 1-9 to load a saved global template, because cookie-cutting is easily punished in piratez. So to me saved equipment layout and personal equipment layout are basically useless and solutions that would load the craft using either of these two aren't very useful. But the above solution allows for easy exchange of any template/layout which is why I think it would be the best. It would also be compatible with other solutions, like Dio's.

Oh and, for Scorch's 3rd point, currently if you press X, all the items are removed from the soldier. We could make it so that if you press Shift+X, the items would be removed from the soldier AND removed from the craft.

Offline Yankes

  • Commander
  • *****
  • Posts: 3293
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #19 on: April 16, 2022, 02:40:18 am »
Sorry, I have no idea what you're talking about.

Are items loaded/unloaded with the relevant soldier or not?
No, this more orthogonal feature that could partially reduce work you need do each time you reload craft inventory.
Image that is not per soldier but per soldier "class" like "items required by melee solder" or "items required by sniper".




Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [SUGGESTION] Alternate loadout system
« Reply #20 on: April 17, 2022, 12:37:24 am »
This give me Idea, why not make "inventory layout" a item in craft loadout? Some kind of meta-item that have linked list of items with some amounts.
Like:
Code: [Select]
StandardLayout:
  Grenade: 2
  Gun: 1
  Clip: 3
Utils:
  StunRod: 1
  PsiAmp: 1
  MedKit: 2
And on craft inventory we have:
Code: [Select]
StandardLayout + - 0
Utils          + - 0
Gun            + - 3
Grenade        + - 1
Clip           + - 1
And when you add `StandardLayout` it will increase matching real items count.
Like:

Code: [Select]
StandardLayout + - 1
Utils          + - 0
Gun            + - 4
Grenade        + - 3
Clip           + - 4
When you leave this screen game can forget how many you have this "meta-item" selected.
If you want redone it you can simply clear whole inventory and add again this "meta-item", lot of clicking but if your want you can have
one "meta-item" that cover whole craft inventory.

Sorry I didn't understand any of it. And if I can't even understand explanation, I can much less imagine using it. What I understand it's just another layer of micro, which is contrary to the original idea (which is removal of micro, because in this proposed concept, game remembers how you outfitted the soldiers last time and moves their stuff automatically - so it does exactly the same thing as you would do - or more realistically, you'd use an alternative of "load every frigging thing I have on the craft, and move everything from craft to craft when moving soldiers"; it's crappy method, especially due to huge losses in equipment when you lose craft, but it's the least painful way). I want to reduce the overall usage of UI, not add more of it.

Oh and, for Scorch's 3rd point, currently if you press X, all the items are removed from the soldier. We could make it so that if you press Shift+X, the items would be removed from the soldier AND removed from the craft.

I hate this keyboard playing with secret key combos and this proposition would allow to omit it almost completely. I.e. the proposition Solar is making is to EMPOWER existing UI to carry better, instead of adding more and more mystery layers on top of it.
« Last Edit: April 17, 2022, 12:42:36 am by Dioxine »

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11665
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Alternate loadout system
« Reply #21 on: April 18, 2022, 12:34:25 am »
No, this more orthogonal feature that could partially reduce work you need do each time you reload craft inventory.
Image that is not per soldier but per soldier "class" like "items required by melee solder" or "items required by sniper".

To be blunt, I am not personally interested in this feature. Not saying it's bad, but it's different from what I requested, and doesn't even seem closely related.

But I'm still very much interested in the original idea :)

Offline Scamps

  • Captain
  • ***
  • Posts: 84
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #22 on: August 21, 2022, 02:52:02 pm »
One could always press CTRL+ALT+X (?) to unload unequipped items from the craft afterwards.
Is this a feature or a suggestion?

press L to load a personal template
How did I live without this feature before?! It definitely lacks promotion!!!

Anyway, will try my hand at it. If CTRL+ALT+X thing is already implemented, the rest is a piece of cake. If not... well, amount of exploring and new code is going to be somewhat large.

Offline Scamps

  • Captain
  • ***
  • Posts: 84
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #23 on: August 21, 2022, 07:29:07 pm »
So here is my attempt at it. Lets call it a proof of concept. In craft equip window:
- press "1" to clear unused items (kind of Ctrl+Alt+X)
- press "2" to add missing items.

Problems:
- HWP ammo is not supported. Needs a bit more time/understanding of code.
- Did not test items with multiple ammo (underslug grenades). They likely don't work. Needs a bit more time/understanding of code.
- Did not test item limit, but copied the code.
- I don't like hotkeys, but did not explore this issue. Probably Ctrl+Alt+X anf F5 are preferrable?
- Code might be messy and unlinted. Sorry. Not much, though  :-X
- 2lazy2upload executable.

Offline Scamps

  • Captain
  • ***
  • Posts: 84
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #24 on: August 28, 2022, 07:38:29 pm »
Spent a bit more time on this.
- Turns out "master" branch is OXC, not OXCE, oops!
- HWP ammo works without code modification
- Multiple ammo was fixed after rebase to oxce-plus branch
- NEW: pressing "I" in base soldier list takes you to that soldier, not first one. Still would like more testing.

Build for Windows https://drive.google.com/file/d/11fY6AeNJqd1fEYGKL-u_CvodE7Uix3-D/view?usp=sharing
Diffs attached to post.

So, "Equipping" part of request should work, requires one keypress in craft inventory though. Workflow is:
1. Equip soldiers from base
2. Assign to craft
3. Go to craft inventory and press "2"
"Unequip" part works to a degree, it does not support leaving extra equipment in craft inventory (that fire extinguisher that is lying just in case)
Go to craft inventory and press "1" to remove unequipped items.

I am not comfortable with adding options and item transfers on soldier assignment myself. So I made this uninvasive. Please test and share your opinions!

A question about desired behavior: if craft does not have enough ammo, and one of the soldiers using it gets removed, what is expected behavior?
« Last Edit: August 28, 2022, 07:54:42 pm by Scamps »

Offline Scamps

  • Captain
  • ***
  • Posts: 84
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #25 on: September 22, 2022, 09:25:14 am »
One more quesion came up playing with the patch.
Currently, "I" in base soldier list works only for soldiers not assigned to craft. I intended to add functionality to rest of soldiers. Now in case you want to change equipment of an assigned soldier under new system, craft will likely not have desired equipment. So, what equipment should be displayed in that case? 1) craft, 2) base, 3) base+craft?
Other option is to do a 3-step process (on different screens): 1) deassign soldier, 2) change equipment, 3) assign soldier. Makes me think about implementing "I" on craft soldier screen...

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #26 on: October 21, 2022, 06:23:13 pm »
Done.

Test build was here:
EDIT: use official build OXCE v7.8 or higher

Please test and provide feedback.

Features implemented:
- everything enabled/disabled by a user option (in Advanced tab) called "Alternate craft equipment management"
- the Soldiers screen now has an "Inventory" button (inside the actions combobox)... until now there was only a hotkey 'I' to open the inventory
- when moving (assigning/deassigning/reassigning) soldiers from and to a craft, they take their inventory (or as much as possible of it) with them
- the Craft Equipment screen shows more detailed info about how many items are in soldiers' inventory (i.e. reserved) and how many are extra and/or missing
- the Craft Equipment screen shows also items that are not in the base, not on the craft, but only reserved by the soldiers' inventory templates
- the Craft Equipment screen automatically adds more items from the base onto the craft (when the screen is opened), if there were some items missing and are now available (e.g. purchase/transfers have arrived recently)
- when removing items from the Craft Equipment screen, you can only remove the extra items... items reserved for soldiers can only be removed by removing the soldiers
  * EDIT: this doesn't apply when loading a global craft equipment layout (F9)
- the soldiers' inventory templates are only saved/updated in the following situations:
  1. in the base, via Soldiers > Inventory (or I hotkey)
  2. in the base, via Craft Equipment > Inventory
They are NOT saved/updated anymore in these situations:
  3. after the Briefing (before the first mission stage)
  4. in-between mission stages (for multi-stage missions)


Display of the items in craft equipment screen:
1. HWPs - no change
2. exact amount of items necessary - no change
3. more items than necessary - displayed as X/+Y (where X is the number of necessary/reserved items and Y is the number of extra items; X plus Y is the number of items on the craft)
4. less items than necessary - displayed as X/-Y (where X is the number of items on the craft and Y is the number of items missing)


Items are explicitly moved together with soldiers in the following cases:
a/ when assigning/deassigning/reassigning soldiers on the Craft Soldiers screen
b/ when assigning/deassigning/reassigning soldiers on the Craft Armor screen - using CTRL+click
c/ when a soldier is removed from a craft automatically due to soldier being wounded during a mission
d/ when a soldier is removed from a craft automatically due to soldier transformation starting

Items are also moved together with soldiers in the following cases (not explicitly, but as a side effect of other standard xcom behavior):
e/ when completely unloading a craft due to selling a craft in the Sell screen
f/ when completely unloading a craft due to "consuming" a craft during the Manufacturing (e.g. craft upgrade)
g/ when a non-empty hangar is destroyed => (only the first) craft in the hangar is destroyed, but the crew and the items are saved

Items are not moved (intentionally) in the following cases:
h/ when evacuating the crew / ejecting the pilots - the soldiers are allowed to survive (depending on the modder's taste), but the items on the craft will be destroyed
i/ when an empty hangar is destroyed => (all) crafts being transferred into this empty hangar are destroyed including the items; TODO: the crew is saved, but probably in a buggy state... to be tested

Items are also not moved (because it is not required/desired/supported) in the following cases:
j/ when starting a new game (the soldiers don't have any inventory template yet, so there's nothing to move!)
k/ when loading a saved game and soldier-to-craft links are built (this is just a technicality)
l/ when importing saves from the original UFO/TFTD (this is just a technicality)
m/ in the "New Battle" mode
n/ in the "Craft Preview" and "Base Preview" modes


Disclaimer: when automatically moving items:
- there is no check for items not allowed on crafts (e.g. corpses, geoscape items, items without a bigsprite, fixed items, alien artifacts, explicitly disabled items, items that don't exist in the mod anymore, etc.) -- most of these should hopefully never be saved in a soldier's template, but if they somehow manage to get there, they will be used as is
- there is no check for craft item number limit
- there is no check for craft item weight limit
Don't ask for this, it will not be done. I'm not willing to spend the next 5+ years fixing it!
(The checks will still work for any extra items you'd want to add manually.)


Last thing: this is a PLAYER option, it cannot be fixed by a modder. It can be recommended though.
« Last Edit: October 29, 2022, 07:25:31 pm by Meridian »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [SUGGESTION] Alternate loadout system
« Reply #27 on: October 21, 2022, 07:54:21 pm »
It's a dream come true! Thank you!

Offline Vakrug

  • Colonel
  • ****
  • Posts: 318
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #28 on: October 22, 2022, 11:05:29 am »
I can't say that I fully understand the significance of this innovation, but it looks like it will help greatly with craft replenishment in such scenario: used some grenades on a mission, not enough grenades in stock, buy missing, after 3 days grenades arrives and are automatically put into craft. Earlier a player should remember to put them back manually.

Online psavola

  • Commander
  • *****
  • Posts: 793
    • View Profile
Re: [SUGGESTION] Alternate loadout system
« Reply #29 on: October 22, 2022, 11:16:01 am »
The apparent difficulty comes from cases where you alternate between land-based and underwater missions, where you would also need to use very different equipment. (Of course, there are also missions where you specifically want non-standard equipment.) Yet in the loadout phase you don't know which kind of mission you're going to go next. You'll usually want to use different templates. But I'm not sure if this makes the current situation any worse and it could make it better.