Added more treatment options and variables to init

This commit is contained in:
Glowbal 2015-02-28 11:41:27 +01:00
parent 65eb69fece
commit 49e04ae7bb
10 changed files with 235 additions and 4 deletions

View File

@ -131,7 +131,7 @@ class ACE_Medical_Actions {
treatmentLocations[] = {"All"};
requiredMedic = 1;
treatmentTime = 15;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_aidKit));
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
itemConsumed = 0;
};
class CheckPulse: fieldDressing {
@ -156,6 +156,18 @@ class ACE_Medical_Actions {
treatmentTime = 2.5;
callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet));
};
class CPR: fieldDressing {
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 25;
items[] = {};
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationCaller = ""; // TODO
itemConsumed = 0;
};
};
};

View File

@ -33,6 +33,10 @@ PREP(treatmentAdvanced_bandage);
PREP(treatmentAdvanced_bandageLocal);
PREP(treatmentAdvanced_medication);
PREP(treatmentAdvanced_medicationLocal);
PREP(treatmentAdvanced_CPR);
PREP(treatmentAdvanced_CPRLocal);
PREP(treatmentAdvanced_fullHeal);
PREP(treatmentAdvanced_fullHealLocal);
PREP(teatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentTourniquet);

View File

@ -20,3 +20,50 @@ _unit = _this select 0;
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(morphine), 0, true];
_unit setVariable [QGVAR(bloodVolume), 100, true];
// tourniquets
_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
// wounds and injuries
_unit setvariable [QGVAR(openWounds), [], true];
_unit setVariable [QGVAR(internalWounds), [], true];
// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setvariable [QGVAR(heartRateAdjustments), []];
_unit setvariable [QGVAR(bloodPressure), _bloodPressure];
_unit setVariable [QGVAR(peripheralResistance), 100];
// fractures
_unit setVariable [QGVAR(fractures), []];
// triage card and logs
_unit setvariable [QGVAR(triageLevel), 0, true];
_unit setvariable [QGVAR(triageCard), [], true];
// IVs
_unit setVariable [QGVAR(salineIVVolume), 0];
_unit setVariable [QGVAR(plasmaIVVolume), 0];
_unit setVariable [QGVAR(bloodIVVolume), 0];
// damage storage
_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
// airway
_unit setvariable [QGVAR(airwayStatus), 0, true];
_unit setVariable [QGVAR(airwayOccluded), false, true];
_unit setvariable [QGVAR(airwayCollapsed), true, true];
// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), true,true];
_unit setVariable [QGVAR(isUnconscious), false, true]
_unit setvariable [QGVAR(hasLostBlood), true, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
// medication
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];
{
_unit setvariable [_x select 0, nil];
}foreach _allUsedMedication;

View File

@ -44,6 +44,7 @@ _parseForSubClassWounds = {
false;
};
// TODO classTypes are strings currently. Convert them to unqiue IDs instead.
_woundsConfig = (_injuriesRootConfig >> "wounds");
_allWoundClasses = [];
if (isClass _woundsConfig) then {

View File

@ -0,0 +1,29 @@
/*
* Author: Glowbal
* Callback for the CPR treatment action on success.
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_items = _this select 4;
// TODO replace by event system instead
[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc);
true;

View File

@ -0,0 +1,36 @@
/*
* Author: Glowbal
* local Callback for the CPR treatment action on success.
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_caller","_target", "_n"];
_caller = _this select 0;
_target = _this select 1;
_n = _target getvariable [QEGVAR(common,ENABLE_REVIVE_COUNTER),0];
if (_n > 0) then {
_n = _n - random(20);
if (_n < 0) then {
_n = 0;
};
_target setvariable [QEGVAR(common,ENABLE_REVIVE_COUNTER), _n];
};
if (random(1)>= 0.6) exitwith {
_target setvariable [QGVAR(inCardiacArrest), nil,true];
_target setvariable [QGVAR(heartRate), 40];
_target setvariable [QGVAR(bloodPressure), [50,70]];
};
true;

View File

@ -65,11 +65,18 @@ _mostEffectiveInjury = _openWounds select 0;
if (_effectivenessFound == 0) exitwith {}; // Seems everything is patched up on this body part already..
// TODO refactor this part
// Find the impact this bandage has and reduce the amount this injury is present
_impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) };
_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0];
_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
_target setvariable [QGVAR(openWounds), _openWounds];
if (_mostEffectiveInjury select 3 == 0) then {
_openWounds deleteAt _mostEffectiveSpot;
} else {
_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
};
_target setvariable [QGVAR(openWounds), _openWounds, true];
// Handle the reopening of bandaged wounds
if (_impact > 0) then {

View File

@ -0,0 +1,23 @@
/**
* fn_heal.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit", "_caller", "_selectionName", "_className", "_items"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_items = _this select 4;
// TODO replace by event system
[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc);
true;

View File

@ -0,0 +1,72 @@
/**
* fn_healLocal.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit", "_caller"];
_unit = _this select 0;
_caller = _this select 1;
if (alive _unit) exitwith {
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(morphine), 0, true];
_unit setVariable [QGVAR(bloodVolume), 100, true];
// tourniquets
_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
// wounds and injuries
_unit setvariable [QGVAR(openWounds), [], true];
_unit setVariable [QGVAR(internalWounds), [], true];
// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setvariable [QGVAR(heartRateAdjustments), []];
_unit setvariable [QGVAR(bloodPressure), _bloodPressure];
_unit setVariable [QGVAR(peripheralResistance), 100];
// fractures
_unit setVariable [QGVAR(fractures), []];
// IVs
_unit setVariable [QGVAR(salineIVVolume), 0];
_unit setVariable [QGVAR(plasmaIVVolume), 0];
_unit setVariable [QGVAR(bloodIVVolume), 0];
// damage storage
_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
// airway
_unit setvariable [QGVAR(airwayStatus), 0, true];
_unit setVariable [QGVAR(airwayOccluded), false, true];
_unit setvariable [QGVAR(airwayCollapsed), true, true];
// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), true,true];
_unit setVariable [QGVAR(isUnconscious), false, true]
_unit setvariable [QGVAR(hasLostBlood), true, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
// medication
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];
{
_unit setvariable [_x select 0, nil];
}foreach _allUsedMedication;
// Resetting damage
_unit setDamage 0;
["Medical_onFullyHealed", [_unit, true]] call ace_common_fnc_localEvent;
[format["Completed healLocal %1", _this]] call EFUNC(common,debug);
};
["Medical_onFullyHealed", [_unit, false]] call ace_common_fnc_localEvent;

View File

@ -20,7 +20,7 @@ _target = _this select 0;
_className = _this select 1;
// We have added a new dose of this medication to our system, so let's increase it
_varName = format["ACE_Medical_%1_inSystem", _className];
_varName = format[QGVAR(%1_inSystem), _className];
_currentInSystem = _target getvariable [_varName, 0];
_currentInSystem = _currentInSystem + 1;
_target setvariable [_varName, _currentInSystem];