Skip to content

Conversation

@TheCandianVendingMachine
Copy link
Contributor

@TheCandianVendingMachine TheCandianVendingMachine commented Nov 16, 2025

When merged this pull request will:
If a variable is set on a unit's vest, backpack, uniform; the variables will not be present on the new one. We instead transfer all existing variables onto the new item.

I can see this PR being rejected, because we don't set these variables globally. Technically, you could set a variable on a remote unit's container. As far as I know there is no way to check if this has occurred, and this information will be lost on wardrobe change. I guess if there is an event for an item change before and after the setLoadout is called, then the person who made this insane decision can transfer the variables themself

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@TheCandianVendingMachine TheCandianVendingMachine added this to the 3.20.2 milestone Nov 16, 2025
@TheCandianVendingMachine TheCandianVendingMachine added the kind/enhancement Release Notes: **IMPROVED:** label Nov 16, 2025
@Andx667
Copy link
Contributor

Andx667 commented Nov 16, 2025

maybe we do need a before event. will add to the other PR

@PabstMirror
Copy link
Contributor

but we have no way to know if the setVar should be global sync or not
e.g. gunbag needs global sync so when dropped others can get the same weapon out

I think we may need to handle this with events inside gunbag

@PabstMirror
Copy link
Contributor

TFAR uses setVars on backpacks for radio settings
so we do really need something like this

this is what I came up with for controlling setVar broadcast setting

GVAR(containerVarsToTransfer) = createHashMapFromArray [
    [toLower "radio_settings", true] // From TFAR
...
private _sync = GVAR(containerVarsToTransfer) get toLower _varName;
if (isNil "_sync") then { continue; };
_item setVariable [_varName, _varValue, _sync];

so we only transfer if explicitly set?
We could also do getOrDefault false to always move but only broadcast if set?
I'm not sure which is safer

{ _this call (GVAR(exceptions) get (_this#0) select 1) }
] call CBA_fnc_addEventHandler;

GVAR(containerVarsToTransfer) = createHashMapFromArray [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add doc comment explaining what this does?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also note in wardrobe wiki that variable needs to be added here I guess

@PabstMirror PabstMirror enabled auto-merge (squash) December 1, 2025 20:42
@PabstMirror PabstMirror merged commit dd29394 into master Dec 1, 2025
2 of 3 checks passed
@PabstMirror PabstMirror deleted the wardrobe-var-transfer branch December 1, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Release Notes: **IMPROVED:**

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants