summaryrefslogtreecommitdiffstats
path: root/Client/Module/ISIS/ISIS_Wounded.sqf
blob: f474f68f2594601d667ee91e38cd2103aef67b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Private ["_han","_hasAction","_start","_state","_status","_unit"];
_unit = _this select 0;
_start = time;
_state = "";

if (isPlayer _unit) then {
	[_unit] Spawn ISIS_Effects;
};

_han = [nil, _unit, rPLAYACTION, "agonyStart"] call RE;
sleep 3;
_han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE;

//--- Add action to west or east units.
if (side _unit == west || side _unit == east) then {
	_hasAction = _unit getVariable 'hasAction';
	if (isNil '_hasAction') then {_hasAction = false};
	if !(_hasAction) then {
		WFBE_ISIS_AddAction = [(side _unit),'CLTFNCISIS_ADDACTION',_unit];
		publicVariable 'WFBE_ISIS_AddAction';
		if (isHostedServer || local player) then {[(side _unit),'CLTFNCISIS_ADDACTION',_unit] Spawn HandlePVF};
	};
};

while {true} do {
	sleep 0.7;
	
	_status = _unit getVariable "stunned";
	if (isNil '_status' || !(alive _unit)) exitWith {_unit removeAllEventHandlers "handleDamage"};
	if !(_status) exitWith {
		_han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE;
	};
	
	if ((time - _start > 15 || _state != animationState _unit)) then {
		_start = time;
		if (((animationState _unit) == "AinjPpneMstpSnonWnonDnon") || ((animationState _unit) == "AinjPpneMstpSnonWrflDnon")) then {
			_han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE;
			_state = animationState _unit;
			_han = [nil, _unit, rPLAYACTION, ("GestureSpasm"+ (str floor random 7))] call RE;
		};
		if (((animationState _unit) == "AinjPpneMstpSnonWrflDnon_injuredHealed") || ((animationState _unit) == "AinjPpneMstpSnonWnonDnon_injuredHealed")) then {
			_han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE;
			_state = animationState _unit;
			_han = [nil, _unit, rPLAYACTION, ("GestureSpasm"+ (str floor random 7))] call RE;
		};
	};

	_unit setDamage (getDammage _unit + 0.002);
};

_han = [nil, _unit, rPLAYACTION, "agonyStop"] call RE;