Added possibility to add unconscious conditions.

This commit is contained in:
Glowbal 2015-02-08 13:06:44 +01:00
parent 633037c1b4
commit a3c4c60b7f
6 changed files with 72 additions and 11 deletions

View File

@ -21,6 +21,9 @@ PREP(getCardiacOutput);
PREP(setCardiacArrest);
PREP(addToInjuredCollection);
PREP(setUnconscious);
PREP(getUnconsciousCondition);
PREP(addUnconsciousCondition);
GVAR(injuredUnitCollection) = [];
ADDON = true;

View File

@ -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);
};

View 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;
};

View 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;

View File

@ -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 {

View File

@ -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;