-
Notifications
You must be signed in to change notification settings - Fork 158
Common - Add more loadout randomization options #1783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Only add extra mags in InitPost, prevents duplicated mags if mission maker edits loadout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure what causes the animation to be wrong (e.g. in the rifle holding anim when the unit only has a pistol). I don't remember ever seeing it before working on this pr though, so I added a workaround for it.
It seems to need to run on the next frame, but CBA's frame functions don't work in Eden so I had to use a sleep with a small delay.
| case (primaryWeapon _this == ""): { "amovpercmstpsraswrfldnon" }; | ||
| case (handgunWeapon _this == ""): { "amovpercmstpsraswpstdnon" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| case (primaryWeapon _this == ""): { "amovpercmstpsraswrfldnon" }; | |
| case (handgunWeapon _this == ""): { "amovpercmstpsraswpstdnon" }; | |
| case (primaryWeapon _this isEqualTo ""): { "amovpercmstpsraswrfldnon" }; | |
| case (handgunWeapon _this isEqualTo ""): { "amovpercmstpsraswpstdnon" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's doing the same thing, there's literally no difference there. You can't even argue type safety because it's a return from an engine command.
|
|
||
| private _randomizationDisabled = getArray (missionConfigFile >> "disableRandomization") findIf { | ||
| _unit isKindOf _x || {(vehicleVarName _unit) isEqualTo _x} | ||
| } != -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } != -1; | |
| } isNotEqualTo -1; |
| private _item = selectRandomWeighted _binocularList; | ||
| private _magazine = (_item call CBA_fnc_compatibleMagazines) param [0, ""]; // For laser designators | ||
| _unit addWeapon _item; | ||
| if (_magazine != "") then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (_magazine != "") then { | |
| if (_magazine isNotEqualTo "") then { |
| params ["_unit", ["_identity", ""]]; | ||
| TRACE_2("fnc_setIdentity3DEN",_unity,_identity); | ||
|
|
||
| if (_identity == "") then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (_identity == "") then { | |
| if (_identity isEqualTo "") then { |
| _identity = getText (configOf _unit >> "CBA_identity"); | ||
| }; | ||
|
|
||
| if (_identity == "") exitWith {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (_identity == "") exitWith {}; | |
| if (_identity isEqualTo "") exitWith {}; |
| _unit set3DENAttribute ["pitch", _pitch]; | ||
| _unit set3DENAttribute ["speaker", _speaker]; | ||
|
|
||
| if (_glasses != "") then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (_glasses != "") then { | |
| if (_glasses isNotEqualTo "") then { |
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
| }] call CBA_fnc_addEventHandler; | ||
|
|
||
| // Check missionTime so Eden placed units don't have their loadouts randomized twice | ||
| ["CAManBase", "InitPost", { if (CBA_missionTime > 0.1) then { call CBA_fnc_randomizeLoadout } }] call CBA_fnc_addClassEventHandler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there's a more proper way to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xeh_postInit won't run on 3den (for now at least)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is so units spawned in Eden don't have their kits randomized again, but units spawned later (e.g. script / zeus) do
Without the missionTime check Eden placed units would have their loadouts randomized on mission start
| _uniformList, _vestList, _backpackList, | ||
| _headgearList, _facewearList, _binocularList, | ||
| _nvgList | ||
| ] findIf { _x isEqualTo [] } >= -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findIf will always be >= -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, typo, just > should be fine I think
At work currently
When merged this pull request will: