mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added possibility to add unconscious conditions.
This commit is contained in:
parent
633037c1b4
commit
a3c4c60b7f
@ -21,6 +21,9 @@ PREP(getCardiacOutput);
|
||||
PREP(setCardiacArrest);
|
||||
PREP(addToInjuredCollection);
|
||||
PREP(setUnconscious);
|
||||
PREP(getUnconsciousCondition);
|
||||
PREP(addUnconsciousCondition);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
|
||||
ADDON = true;
|
||||
|
@ -1,11 +1,14 @@
|
||||
/**
|
||||
* fnc_addToInjuredCollection.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Enabled the vitals loop for a unit.
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
@ -33,7 +36,7 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
||||
_pain = _unit getvariable [QGVAR(pain), 0];
|
||||
if (_pain > 45) then {
|
||||
if (random(1) > 0.6) then {
|
||||
// [_unit] call FUNC(setUnconsciousState);
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
//[_unit] call FUNC(playInjuredSound);
|
||||
};
|
||||
|
25
addons/medical/functions/fnc_addUnconsciousCondition.sqf
Normal file
25
addons/medical/functions/fnc_addUnconsciousCondition.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Adds new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Code, should return a boolean <CODE>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isnil QGVAR(unconsciousConditions)) then {
|
||||
GVAR(unconsciousConditions) = [];
|
||||
};
|
||||
if (typeName _this == typeName []) then {
|
||||
{
|
||||
if (typeName _x == typeName {}) then {
|
||||
GVAR(unconsciousConditions) pushback _x;
|
||||
};
|
||||
}foreach _this;
|
||||
};
|
30
addons/medical/functions/fnc_getUnconsciousCondition.sqf
Normal file
30
addons/medical/functions/fnc_getUnconsciousCondition.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get whatever or not a unit should be or stay unconscious.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* Should the unit stay unconscious? <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return"];
|
||||
_unit = _this select 0;
|
||||
|
||||
if (isnil QGVAR(unconsciousConditions)) then {
|
||||
GVAR(unconsciousConditions) = [];
|
||||
};
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith {
|
||||
_return = true;
|
||||
};
|
||||
}foreach GVAR(unconsciousConditions);
|
||||
|
||||
_return;
|
@ -62,7 +62,7 @@ if (_bloodVolume < 30) exitwith {
|
||||
if ([_unit] call EFUNC(common,isAwake)) then {
|
||||
if (_bloodVolume < 60) then {
|
||||
if (random(1) > 0.9) then {
|
||||
//[_unit] call FUNC(setUnconsciousState);
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -101,7 +101,7 @@ if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) exitwit
|
||||
|
||||
if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
|
||||
if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then {
|
||||
//[_unit] call FUNC(setUnconsciousState); // safety check to ensure unconsciousness for units if they are not dead already.
|
||||
[_unit] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already.
|
||||
};
|
||||
|
||||
if (_bloodPressureH > 260) then {
|
||||
|
@ -23,7 +23,7 @@ _unit setvariable [QGVAR(heartRate), 0];
|
||||
|
||||
["Medical_onEnteredCardiacArrest", [_unit]] call ace_common_fnc_localEvent;
|
||||
|
||||
//[_unit] call FUNC(setUnconsciousState);
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
_counter = 120 + round(random(600));
|
||||
_timer = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user