Minor Cleanup

This commit is contained in:
PabstMirror 2015-02-06 22:24:27 -06:00
parent c117e9bf16
commit ed3f28ec6d
5 changed files with 49 additions and 38 deletions

View File

@ -70,7 +70,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
InterpolateTo[] = {"Unconscious",0.01}; InterpolateTo[] = {"Unconscious",0.01};
}; };
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
speed = 0.4; //for gameplay reasons, slow this down speed = 0.333; //for gameplay reasons, slow this down
actions = "CivilStandActions"; actions = "CivilStandActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};

View File

@ -18,9 +18,9 @@
PARAMS_2(_unit,_target); PARAMS_2(_unit,_target);
//Alive, handcuffed, not being escored, and not unconsious //Alive, handcuffed, not being escored, and not unconscious
(_target getVariable [QGVAR(isHandcuffed), false]) && (_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} && {isNull (attachedTo _target)} &&
{alive _target} && {alive _target} &&
{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} {!(_target getVariable ["ACE_isUnconscious", false])}

View File

@ -19,5 +19,6 @@
PARAMS_2(_unit,_target); PARAMS_2(_unit,_target);
_target getVariable [QGVAR(isHandcuffed), false] _target getVariable [QGVAR(isHandcuffed), false]
|| {_target getVariable [QGVAR(isSurrendering), false]}
|| {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isSearchable", false]}
|| {_target getVariable ["ACE_isUnconscious", false]} || {_target getVariable ["ACE_isUnconscious", false]}

View File

@ -1,6 +1,6 @@
/* /*
* Author: Nic547, commy2 * Author: Nic547, commy2
* Handcuffs a unit * Handcuffs a unit.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
@ -18,39 +18,38 @@
PARAMS_2(_unit,_state); PARAMS_2(_unit,_state);
// We only want this function to work on local machines
if (!local _unit) exitWith { if (!local _unit) exitwith {
ERROR("setHandcuffed unit not local"); [_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc);
TRACE_2("running setHandcuffed on remote unit",_unit,_state);
}; };
if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then {
ERROR("new state equals current"); LOG("setHandcuffed: current state same as new");
}; };
if (_state) then { if (_state) then {
_unit setVariable [QGVAR(isHandcuffed), true, true]; _unit setVariable [QGVAR(isHandcuffed), true, true];
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
// fix anim on mission start (should work on dedicated servers)
_fixAnimationFnc = {
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
};
};
[_fixAnimationFnc, [_unit], 0.05, 0] call EFUNC(common,waitAndExecute);
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
showHUD false; showHUD false;
}; };
// fix anim on mission start (should work on dedicated servers)
[{
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
};
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
} else { } else {
_unit setVariable [QGVAR(isHandcuffed), false, true]; _unit setVariable [QGVAR(isHandcuffed), false, true];
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
if ((vehicle _unit) == _unit) then { if ((vehicle _unit) == _unit) then {
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
}; };

View File

@ -18,46 +18,57 @@
PARAMS_2(_unit,_state); PARAMS_2(_unit,_state);
if (_state) then { // We only want this function to work on local machines
if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith { if (!local _unit) exitwith {
ERROR("Already Surrendering"); [_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc);
}; TRACE_2("running surrender on remote unit",_unit,_state);
};
if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then {
LOG("Surrender: current state same as new");
};
if (_state) then {
_unit setVariable [QGVAR(isSurrendering), true, true]; _unit setVariable [QGVAR(isSurrendering), true, true];
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
showHUD false; showHUD false;
}; };
private "_surrenderFnc"; // fix anim on mission start (should work on dedicated servers)
_surrenderFnc = { [{
EXPLODE_1_PVT((_this select 0),_unit); PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
};
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
//PFEH - (TODO: move to event system?)
[{
EXPLODE_1_PVT((_this select 0),_unit);
if (_unit getVariable [QGVAR(isSurrendering), false]) then { if (_unit getVariable [QGVAR(isSurrendering), false]) then {
//If unit dies, gets knocked out, or is handcuffed then end surrender
if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
[_unit, false] call FUNC(surrender); [_unit, false] call FUNC(surrender);
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call CBA_fnc_removePerFrameHandler;
}; };
} else { } else {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
}; };
}; }, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler;
[_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler;
} else { } else {
_unit setVariable [QGVAR(isSurrendering), false, true]; _unit setVariable [QGVAR(isSurrendering), false, true];
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
if !(_unit getVariable ["ACE_isUnconscious", false]) then { if ((vehicle _unit) == _unit) then {
//Break out of hands up animation loop //Break out of hands up animation loop (doAnimation handles Unconscious prioity)
//don't want to step on animations from medical (TODO: testing medical integration)
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
}; };
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
//only enable if not handcuffed //only re-enable HUD if not handcuffed
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
showHUD true; showHUD true;
}; };