CreateLitter now supports conditions and is selection specific.

Format:
litter[] = {
   {"SelectionName", "Condition", {"litterClassname"} },
   ...
};

The array with litter classnames also support 2d arrays. ie:
{"SelectionName", "Condition", {{"litterClassname"}} }
Of array entries it will select a random classname.
This commit is contained in:
Glowbal 2015-04-04 20:20:29 +02:00
parent 08e1949078
commit 2420db78a1
5 changed files with 50 additions and 34 deletions

View File

@ -20,11 +20,11 @@ class ACE_Medical_Actions {
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic4";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
litter[] = { {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} };
};
class Morphine: Bandage {
displayName = "$STR_ACE_Medical_Inject_Morphine";
@ -33,7 +33,7 @@ class ACE_Medical_Actions {
items[] = {"ACE_morphine"};
callbackSuccess = QUOTE(DFUNC(treatmentBasic_morphine));
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {"ACE_MedicalLitter_morphine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
};
class Epinephrine: Bandage {
displayName = "$STR_ACE_Medical_Inject_Epinephrine";
@ -43,7 +43,7 @@ class ACE_Medical_Actions {
items[] = {"ACE_epinephrine"};
callbackSuccess = QUOTE(DFUNC(treatmentBasic_epipen));
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {"ACE_MedicalLitter_epinephrine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
};
class BloodIV: Bandage {
displayName = "$STR_ACE_Medical_Transfuse_Blood";
@ -80,7 +80,7 @@ class ACE_Medical_Actions {
itemConsumed = 0;
litter[] = {};
};
class PersonalAidKit: Bandage {
/*class PersonalAidKit: Bandage {
displayName = "";
displayNameProgress = "";
items[] = {"ACE_personalAidKit"};
@ -90,8 +90,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
itemConsumed = 0;
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
litter[] = {"ACE_MedicalLitter_gloves", {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}, {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
};
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}, {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} };
};*/
};
class Advanced {
@ -115,23 +115,20 @@ class ACE_Medical_Actions {
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic4";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
litter[] = { {"All", "", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} };
};
class PackingBandage: fieldDressing {
items[] = {"ACE_packingBandage"};
litter[] = {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
};
class ElasticBandage: fieldDressing {
items[] = {"ACE_elasticBandage"};
litter[] = {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
};
class QuikClot: fieldDressing {
items[] = {"ACE_quikclot"};
litter[] = {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
};
class Tourniquet: fieldDressing {
displayName = "$STR_ACE_Medical_Apply_Tourniquet";
@ -149,19 +146,19 @@ class ACE_Medical_Actions {
treatmentTime = 3;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication));
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {"ACE_MedicalLitter_morphine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
};
class Atropine: Morphine {
displayName = "$STR_ACE_Medical_Inject_Atropine";
displayNameProgress = "$STR_ACE_Medical_Injecting_Atropine";
items[] = {"ACE_atropine"};
litter[] = {"ACE_MedicalLitter_atropine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_atropine"}} };
};
class Epinephrine: Morphine {
displayName = "$STR_ACE_Medical_Inject_Epinephrine";
displayNameProgress = "$STR_ACE_Medical_Injecting_Epinephrine";
items[] = {"ACE_epinephrine"};
litter[] = {"ACE_MedicalLitter_epinephrine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
};
class BloodIV: fieldDressing {
displayName = "$STR_ACE_Medical_Transfuse_Blood";
@ -213,7 +210,7 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));
itemConsumed = 0;
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {"ACE_MedicalLitter_gloves"};
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }};
};
class PersonalAidKit: fieldDressing {
displayName = "";
@ -230,7 +227,7 @@ class ACE_Medical_Actions {
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "";
animationCallerSelfProne = "";
litter[] = {"ACE_MedicalLitter_gloves", {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}, {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}};
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} };
};
class CheckPulse: fieldDressing {
displayName = "";

View File

@ -14,9 +14,14 @@
#include "script_component.hpp"
#define MIN_ENTRIES_LITTER_CONFIG 3
private ["_target", "_className", "_config", "_litter", "_createLitter", "_litterObject", "_position", "_createdLitter"];
_target = _this select 0;
_className = _this select 1;
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_usersOfItems = _this select 5;
if !(GVAR(allowLitterCreation)) exitwith {};
@ -51,14 +56,32 @@ if (isnil QGVAR(allCreatedLitter)) then {
_createdLitter = [];
{
if (typeName _x == "ARRAY") then {
{
if (typeName _x == "STRING") exitwith {
_createdLitter pushback ([_target, _x] call _createLitter);
if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {};
private ["_selection", "_litterCondition", "_litterOptions"];
_selection = _x select 0;
if (toLower _selection in [toLower _selectionName, "all"]) then { // in is case sensitve. We can be forgiving here, so lets use toLower.
_litterCondition = _x select 1;
_litterOptions = _x select 2;
if (isnil _litterCondition) then {
_litterCondition = if (_litterCondition != "") then {compile _litterCondition} else {{true}};
} else {
_litterCondition = missionNamespace getvariable _litterCondition;
};
}foreach _x;
};
if (typeName _x == "STRING") then {
_createdLitter pushback ([_target, _x] call _createLitter);
if !([_caller, _target, _selectionName, _className, _usersOfItems] call _litterCondition) exitwith {};
if (typeName _litterOptions == "ARRAY") then {
// Loop through through the litter options and place the litter
{
if (typeName _x == "ARRAY" && {(count _x > 0)}) then {
_createdLitter pushback ([_target, _x select (floor(random(count _x)))] call _createLitter);
};
if (typeName _x == "STRING") then {
_createdLitter pushback ([_target, _x] call _createLitter);
};
}foreach _litterOptions;
};
};
};
}foreach _litter;

View File

@ -37,7 +37,3 @@ if !(_varName in GVAR(IVBags)) then {
GVAR(IVBags) pushback _varName;
publicVariable QGVAR(IVBags);
};
// TODO localization
//[_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call EFUNC(common,getName),_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog);
//[_target,_removeItem] call FUNC(addToTriageList);

View File

@ -49,6 +49,6 @@ if (isNil _callback) then {
_callback = missionNamespace getvariable _callback;
};
_args call _callback;
_args call FUNC(createLitter);
[_target, _className] call FUNC(createLitter);
_args call _callback;

View File

@ -43,6 +43,6 @@ if (isNil _callback) then {
_callback = missionNamespace getvariable _callback;
};
_args call _callback;
_args call FUNC(createLitter);
[_target, _className] call FUNC(createLitter);
_args call _callback;