mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added reactionToDamage and onTreatmentCompleted event
This commit is contained in:
parent
925aa094c7
commit
e5941e55fc
@ -40,6 +40,8 @@ PREP(treatmentTourniquetLocal);
|
||||
PREP(addToLog);
|
||||
PREP(addToTriageCard);
|
||||
PREP(actionPlaceInBodyBag);
|
||||
PREP(onTreatmentCompleted);
|
||||
PREP(reactionToDamage);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
@ -42,7 +42,6 @@ _damageReturn = _damage;
|
||||
_damageReturn = (_this select 2);
|
||||
if (GVAR(level) == 0) then {
|
||||
_damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic);
|
||||
|
||||
};
|
||||
|
||||
if (_damageReturn < 0.01) exitWith {0};
|
||||
|
@ -28,6 +28,10 @@ _typeOfProjectile = _this select 4;
|
||||
_returnDamage = _this select 5;
|
||||
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
|
||||
|
||||
|
||||
// TODO parse for new damage
|
||||
// TODO parse for kill injuries
|
||||
|
||||
[_unit, _selectionName, _amountOfDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds);
|
||||
|
||||
if (GVAR(enableAirway)) then {
|
||||
@ -39,4 +43,9 @@ if (GVAR(enableFractures)) then {
|
||||
if (GVAR(enableInternalBleeding)) then {
|
||||
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries);
|
||||
};
|
||||
|
||||
if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
|
||||
[_unit, _amountOfDamage] call FUNC(reactionToDamage);
|
||||
};
|
||||
|
||||
_returnDamage;
|
||||
|
31
addons/medical/functions/fnc_onTreatmentCompleted.sqf
Normal file
31
addons/medical/functions/fnc_onTreatmentCompleted.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Callback when the treatment is completed
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
* 4: completed <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
*
|
||||
* Public: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target","_selectionName","_className", "_completed"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_completed = _this select 4;
|
||||
|
||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]] call EFUNC(common,doAnimation);
|
||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||
};
|
52
addons/medical/functions/fnc_reactionToDamage.sqf
Normal file
52
addons/medical/functions/fnc_reactionToDamage.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* fn_handleReactionHit.sqf
|
||||
* @Descr: triggers a reaction to being hit for a unit and spawns on screen effects.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_amountOfDamage"];
|
||||
_unit = _this select 0;
|
||||
_amountOfDamage = _this select 1;
|
||||
|
||||
if (_amountOfDamage > 0.2) then {
|
||||
|
||||
[_unit] call FUNC(playInjuredSound);
|
||||
if ((vehicle _unit) isKindOf "StaticWeapon") exitwith {
|
||||
if (_amountOfDamage > 1) then {
|
||||
_unit action ["eject", vehicle _unit];
|
||||
unassignVehicle _unit;
|
||||
};
|
||||
};
|
||||
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) exitwith {
|
||||
_unit action ["ladderOff", (nearestBuilding _unit)];
|
||||
};
|
||||
|
||||
if (vehicle _unit == _unit && [_unit] call EFUNC(common,isAwake)) then {
|
||||
if (random(1) > 0.5) then {
|
||||
_unit setDir ((getDir _unit) + 1 + random(30));
|
||||
} else {
|
||||
_unit setDir ((getDir _unit) - (1 + random(30)));
|
||||
};
|
||||
};
|
||||
if (_amountOfDamage > 0.6) then {
|
||||
if (random(1)>0.6) then {
|
||||
[_unit] call EFUNC(common,setProne);
|
||||
};
|
||||
};
|
||||
if (_unit == ACE_player) then {
|
||||
//76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"];
|
||||
addCamShake [3, 5, _amountOfDamage + random 10];
|
||||
};
|
||||
} else {
|
||||
if (_amountOfDamage > 0) then {
|
||||
if (_unit == ACE_player) then {
|
||||
// 76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"];
|
||||
};
|
||||
};
|
||||
};
|
@ -81,6 +81,11 @@ if (_caller != _target && {vehicle _target == _target} && {_patietAnim != ""}) t
|
||||
[_target, _patietAnim] call EFUNC(common,doAnimation);
|
||||
};
|
||||
if (vehicle _caller == _caller && {_callerAnim != ""}) then {
|
||||
if (primaryWeapon _caller == "") then {
|
||||
_caller addWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
_caller selectWeapon (primaryWeapon _caller);
|
||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _target];
|
||||
[_caller, _callerAnim] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user