Skip to content
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

replace usage of setCaptive with camouflageCoef trait #5864

Merged
merged 4 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,45 @@
[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler;
["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches"]] call FUNC(statusEffect_addType);
["blockSprint", false, []] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered)]] call FUNC(statusEffect_addType);
["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType);
["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType);
["blockThrow", false, ["ACE_Attach", "ACE_concertina_wire", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_rearm", "ACE_refuel", "ACE_Sandbag", "ACE_Trenches", "ACE_tripod"]] call FUNC(statusEffect_addType);
["setHidden", true, ["ace_unconscious"]] call FUNC(statusEffect_addType);

[QGVAR(forceWalk), {
params ["_object", "_set"];
TRACE_2("forceWalk EH",_object,_set);
_object forceWalk (_set > 0);
}] call CBA_fnc_addEventHandler;

[QGVAR(blockSprint), { //Name reversed from `allowSprint` because we want NOR logic
params ["_object", "_set"];
TRACE_2("blockSprint EH",_object,_set);
_object allowSprint (_set == 0);
}] call CBA_fnc_addEventHandler;

[QGVAR(setCaptive), {
params ["_object", "_set"];
TRACE_2("setCaptive EH",_object,_set);
_object setCaptive (_set > 0);
}] call CBA_fnc_addEventHandler;

[QGVAR(setHidden), {
params ["_object", "_set"];
TRACE_2("setHidden EH",_object,_set);
private _visibility = _object getUnitTrait "camouflageCoef";
if (_set > 0) then {
if (_visibility != 0) then {
_object setVariable [QGVAR(oldVisibility), _visibility];
_object setUnitTrait ["camouflageCoef", 0];
};
} else {
_visibility = _object getVariable [QGVAR(oldVisibility), _visibility];
_object setUnitTrait ["camouflageCoef", _visibility];
};
}] call CBA_fnc_addEventHandler;

[QGVAR(blockDamage), { //Name reversed from `allowDamage` because we want NOR logic
params ["_object", "_set"];
if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then {
Expand All @@ -51,6 +70,7 @@
_object allowDamage (_set == 0);
};
}] call CBA_fnc_addEventHandler;

[QGVAR(blockEngine), {
params ["_vehicle", "_set"];
_vehicle setVariable [QGVAR(blockEngine), _set > 0, true];
Expand Down
4 changes: 2 additions & 2 deletions addons/medical/functions/fnc_setUnconscious.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
};
// Delay Unconscious so the AI dont instant stop shooting on the unit #3121
if (GVAR(delayUnconCaptive) == 0) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
} else {
// when the Delay is so high that the unit can wake up and get uncon again we need to check if it is the correct wait that got executed
private _counter = _unit getVariable [QGVAR(unconsciousCounter), 0];
Expand All @@ -106,7 +106,7 @@ if (GVAR(delayUnconCaptive) == 0) then {
[{
params ["_unit", "_counter"];
if (_unit getVariable ["ACE_isUnconscious", false] && (_unit getVariable [QGVAR(unconsciousCounter), 0]) == _counter) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
};
},[_unit, _counter], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute;
};
Expand Down
4 changes: 2 additions & 2 deletions addons/medical/functions/fnc_unconsciousPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (!alive _unit) exitWith {
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
};
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, false] call EFUNC(common,disableAI);
//_unit setUnitPos _originalPos;

Expand Down Expand Up @@ -104,7 +104,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
};
if (!_hasMovedOut) then {
// Reset the unit back to the previous captive state.
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", false] call EFUNC(common,statusEffect_set);

// Swhich the unit back to its original group
//Unconscious units shouldn't be put in another group #527:
Expand Down