Merge pull request #1368 from acemod/medicalBloodBags

Medical blood bags size matters
This commit is contained in:
Glowbal 2015-05-23 10:07:58 +02:00
commit 7170db5dc2
5 changed files with 29 additions and 12 deletions

View File

@ -50,11 +50,17 @@ class ACE_Medical_Actions {
displayNameProgress = "$STR_ACE_Medical_Transfusing_Blood"; displayNameProgress = "$STR_ACE_Medical_Transfusing_Blood";
requiredMedic = 1; requiredMedic = 1;
treatmentTime = 20; treatmentTime = 20;
items[] = {{"ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250"}}; items[] = {"ACE_bloodIV"};
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag)); callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag));
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {}; litter[] = {};
}; };
class BloodIV_500: BloodIV {
items[] = {"ACE_bloodIV_500"};
};
class BloodIV_250: BloodIV {
items[] = {"ACE_bloodIV_250"};
};
class BodyBag: Bandage { class BodyBag: Bandage {
displayName = "$STR_ACE_Medical_PlaceInBodyBag"; displayName = "$STR_ACE_Medical_PlaceInBodyBag";
displayNameProgress = "$STR_ACE_Medical_PlacingInBodyBag"; displayNameProgress = "$STR_ACE_Medical_PlacingInBodyBag";

View File

@ -16,8 +16,9 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_caller", "_target"]; private ["_caller", "_target", "_treatmentClassname"];
_caller = _this select 0; _caller = _this select 0;
_target = _this select 1; _target = _this select 1;
_treatmentClassname = _this select 3;
[[_target], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */

View File

@ -4,6 +4,7 @@
* *
* Arguments: * Arguments:
* 0: The patient <OBJECT> * 0: The patient <OBJECT>
* 1: Treatment Classname <STRING>
* *
* Return Value: * Return Value:
* nil * nil
@ -14,8 +15,15 @@
#include "script_component.hpp" #include "script_component.hpp"
#define BLOODBAGHEAL 70 #define BLOODBAGHEAL 70
private ["_target","_blood"]; PARAMS_2(_target,_treatmentClassname);
_target = _this select 0;
_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; private ["_blood", "_bloodAdded"];
_bloodAdded = switch (true) do {
case (_treatmentClassname == "BloodIV_250"): {0.25 * BLOODBAGHEAL};
case (_treatmentClassname == "BloodIV_500"): {0.5 * BLOODBAGHEAL};
default {BLOODBAGHEAL};
};
_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + _bloodAdded) min 100;
_target setVariable [QGVAR(bloodVolume), _blood, true]; _target setVariable [QGVAR(bloodVolume), _blood, true];

View File

@ -27,6 +27,6 @@ _items = _this select 4;
if (count _items == 0) exitwith {}; if (count _items == 0) exitwith {};
_removeItem = _items select 0; _removeItem = _items select 0;
[[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[_target, _removeItem] call FUNC(addToTriageCard); [_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", "STR_ACE_Medical_Activity_gaveIV", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); [_target, "activity", "STR_ACE_Medical_Activity_gaveIV", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);

View File

@ -4,7 +4,7 @@
* *
* Arguments: * Arguments:
* 0: The medic <OBJECT> * 0: The medic <OBJECT>
* 1: Item used classname <STRING> * 1: Treatment classname <STRING>
* *
* *
* Return Value: * Return Value:
@ -15,9 +15,9 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_target", "_ivItem", "_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; private ["_target", "_treatmentClassname", "_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"];
_target = _this select 0; _target = _this select 0;
_ivItem = _this select 1; _treatmentClassname = _this select 1;
_bloodVolume = _target getvariable [QGVAR(bloodVolume), 100]; _bloodVolume = _target getvariable [QGVAR(bloodVolume), 100];
if (_bloodVolume >= 100) exitwith {}; if (_bloodVolume >= 100) exitwith {};
@ -27,10 +27,12 @@ _config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV");
_volumeAdded = getNumber (_config >> "volume"); _volumeAdded = getNumber (_config >> "volume");
_typeOf = getText (_config >> "type"); _typeOf = getText (_config >> "type");
if (isClass (_config >> _ivItem)) then { if (isClass (_config >> _treatmentClassname)) then {
_config = (_config >> _ivItem); _config = (_config >> _treatmentClassname);
if (isNumber (_config >> "volume")) then { _volumeAdded = getNumber (_config >> "volume");}; if (isNumber (_config >> "volume")) then { _volumeAdded = getNumber (_config >> "volume");};
if (isText (_config >> "type")) then { _typeOf = getText (_config >> "type"); }; if (isText (_config >> "type")) then { _typeOf = getText (_config >> "type"); };
} else {
ERROR("IV Treatment Classname not found");
}; };
_varName = format["ACE_Medical_IVVolume_%1",_typeOf]; _varName = format["ACE_Medical_IVVolume_%1",_typeOf];