-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1406 from Kexanone/naked-unit-fix
Add naked unit bug workaround
- Loading branch information
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_preInit)); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
#include "initSettings.sqf" | ||
|
||
// Restore loadouts lost by the naked unit bug | ||
[QGVAR(validateLoadout), { | ||
params ["_unit", "_loadout"]; | ||
|
||
if (GVAR(loadoutValidation) > 0 && {getUnitLoadout _unit isNotEqualTo _loadout}) then { | ||
_unit setUnitLoadout _loadout; | ||
}; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
["CAManBase", "Local", { | ||
params ["_unit", "_local"]; | ||
if !(_local) then { | ||
// Broadcast loadout to new owner if unit was once local on this machine | ||
if (GVAR(loadoutValidation) > 0 && {_unit getVariable [QGVAR(wasLocal), false]}) then { | ||
if (GVAR(loadoutValidation) == 1 && {!(_unit in playableUnits)}) exitWith {}; | ||
private _loadout = getUnitLoadout _unit; | ||
[QGVAR(validateLoadout), [_unit, _loadout], _unit] call CBA_fnc_targetEvent; | ||
}; | ||
}; | ||
_unit setVariable [QGVAR(wasLocal), _local]; | ||
}] call CBA_fnc_addClassEventHandler; | ||
|
||
["CAManBase", "Init", { | ||
params ["_unit"]; | ||
if (local _unit) then { | ||
_unit setVariable [QGVAR(wasLocal), true]; | ||
}; | ||
}] call CBA_fnc_addClassEventHandler; | ||
|
||
ADDON = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ class CfgPatches { | |
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
#include "CfgFunctions.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
QGVAR(loadoutValidation), | ||
"LIST", | ||
[LLSTRING(LoadoutValidation), LLSTRING(LoadoutValidationTooltip)], | ||
LSTRING(Component), | ||
[ | ||
[0, 1, 2], | ||
[ | ||
[LLSTRING(NeverValidate), LLSTRING(NeverValidateTooltip)], | ||
[LLSTRING(ValidatePlayableOnly), LLSTRING(ValidatePlayableOnlyTooltip)], | ||
[LLSTRING(ValidateAll), LLSTRING(ValidateAllTooltip)] | ||
], | ||
0 // Disabled by default | ||
], | ||
1 // Forced on all machines by default | ||
] call CBA_fnc_addSetting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters