Code Cleanup Medical Module (Part 1).

This commit is contained in:
jokoho48 2015-08-22 16:25:10 +02:00
parent bfc3a4048e
commit d09ca9ec8b
78 changed files with 428 additions and 543 deletions

View File

@ -7,14 +7,11 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target"];
_caller = _this select 0;
_target = _this select 1;
[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[_this, QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */

View File

@ -7,24 +7,21 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow", "_logOutPut", "_output"];
_caller = _this select 0;
_target = _this select 1;
private ["_bloodPressure", "_logOutPut", "_output"];
params ["_caller", "_target"];
_bloodPressure = [_target] call FUNC(getBloodPressure);
if (!alive _target) then {
_bloodPressure = [0,0];
};
_bloodPressureHigh = _bloodPressure select 1;
_bloodPressureLow = _bloodPressure select 0;
_bloodPressure params ["_bloodPressureLow", "_bloodPressureLow"];
_output = "";
_logOutPut = "";
if ([_caller] call FUNC(isMedic)) then {

View File

@ -7,14 +7,11 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target"];
_caller = _this select 0;
_target = _this select 1;
[[_caller, _target], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[_this, QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */

View File

@ -7,16 +7,15 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_unit", "_heartRateOutput", "_heartRate", "_logOutPut"];
_caller = _this select 0;
_unit = _this select 1;
private ["_heartRateOutput", "_heartRate", "_logOutPut"];
params ["_caller", "_unit"];
_heartRate = _unit getvariable [QGVAR(heartRate), 80];

View File

@ -7,22 +7,20 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target", "_output"];
_caller = _this select 0;
_target = _this select 1;
private ["_output"];
params ["_caller", "_target"];
_output = "";
if ([_target] call EFUNC(common,isAwake)) then {
_output = LSTRING(Check_Response_Responsive);
_output = if ([_target] call EFUNC(common,isAwake)) then {
LSTRING(Check_Response_Responsive)
} else {
_output = LSTRING(Check_Response_Unresponsive);
LSTRING(Check_Response_Unresponsive)
};
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent);

View File

@ -7,16 +7,15 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target", "_genericMessages"];
_caller = _this select 0;
_target = _this select 1;
private "_genericMessages";
params ["_caller", "_target"];
_genericMessages = [LSTRING(diagnoseMessage)];

View File

@ -7,26 +7,25 @@
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target","_vehicle"];
_caller = _this select 0;
_target = _this select 1;
private "_vehicle";
params ["_caller", "_target"];
if ([_target] call EFUNC(common,isAwake)) exitwith {
// TODO localization
["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
};
if ([_target] call FUNC(isBeingCarried)) then {
[_caller, _target] call EFUNC(dragging,dropObject_carry);
_this call EFUNC(dragging,dropObject_carry);
};
if ([_target] call FUNC(isBeingDragged)) then {
[_caller, _target] call EFUNC(dragging,dropObject);
_this call EFUNC(dragging,dropObject);
};
_vehicle = [_caller, _target] call EFUNC(common,loadPerson);
_vehicle = _this call EFUNC(common,loadPerson);

View File

@ -14,9 +14,8 @@
#include "script_component.hpp"
PARAMS_2(_caller,_target);
private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"];
params ["_caller", "_target"];
if (alive _target) then {
[_target, true] call FUNC(setDead);

View File

@ -8,17 +8,15 @@
* 2: SelectionName <STRING>
*
* Return Value:
* NONE
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_caller", "_target", "_part", "_selectionName", "_tourniquets", "_output"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
private ["_part", "_tourniquets", "_output"];
params ["_caller", "_target", "_selectionName"];
// grab the required data
_part = [_selectionName] call FUNC(selectionNameToNumber);

View File

@ -5,23 +5,20 @@
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Drag after unload <BOOL> <OPTIONAL>
* 2: Drag after unload <BOOL> (default: false)
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target", "_drag"];
_caller = _this select 0;
_target = _this select 1;
_drag = if (count _this > 2) then {_this select 2} else {false};
params ["_caller", "_target", ["_drag", false]];
// cannot unload a unit not in a vehicle.
if (vehicle _target == _target) exitwith {};
if (([_target] call EFUNC(common,isAwake))) exitwith {};
["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent)
["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent)

View File

@ -9,18 +9,15 @@
* 3: callback <CODE>
*
* Return Value:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_value", "_time", "_adjustment", "_callBack"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_value = [_this, 1, 0, [0]] call BIS_fnc_Param;
_time = [_this, 2, 1, [0]] call BIS_fnc_Param;
_callBack = [_this, 3, {}, [{}]] call BIS_fnc_Param;
params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_time", 1, [0]], ["_callBack", {}, [{}]]];
_adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []];
_adjustment pushback [_value, _time, _callBack];

View File

@ -6,16 +6,14 @@
* 0: The Unit <OBJECT>
*
* ReturnValue:
* <NIL>
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_force"];
_unit = _this select 0;
_force = if (count _this > 1) then {_this select 1} else {false};
params ["_unit", ["_force", false]];
if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
@ -27,13 +25,13 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
[{
private ["_unit", "_interval"];
_unit = (_this select 0) select 0;
_interval = ACE_time - ((_this select 0) select 1);
params ["_args", "_idPFH"];
_args params ["_unit", "_interval"];
_interval = ACE_time - _interval;
(_this select 0) set [1, ACE_time];
if (!alive _unit || !local _unit) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
if (!local _unit) then {
if (GVAR(level) >= 2) then {
_unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 80], true];

View File

@ -9,27 +9,26 @@
* 3: The arguments for localization <ARRAY>
*
* Return Value:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog", "_logs"];
_unit = _this select 0;
_type = _this select 1;
_message = _this select 2;
_arguments = _this select 3;
private ["_moment", "_logVarName", "_log","_newLog", "_logs"];
params ["_unit", "_type", "_allMapMarkers", "_arguments"];
if (!local _unit) exitwith {
[_this, QUOTE(DFUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
};
_lastNumber = date select 4;
_moment = format["%1:%2",date select 3, _lastNumber];
if (_lastNumber < 10) then {
_moment = format["%1:0%2",date select 3, _lastNumber];
date params ["_minute", "_hour"];
_moment = if (_minute < 10) then {
format["%1:0%2", _hour, _minute]
} else {
format["%1:%2", _hour, _minute]
};
_logVarName = format[QGVAR(logFile_%1), _type];
@ -41,10 +40,10 @@ if (count _log >= 8) then {
if (_foreachIndex > 0) then {
_newLog pushback _x;
};
}foreach _log;
} foreach _log;
_log = _newLog;
};
_log pushback [_message,_moment,_type, _arguments];
_log pushback [_message, _moment, _type, _arguments];
_unit setvariable [_logVarName, _log, true];
["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent);

View File

@ -7,16 +7,15 @@
* 1: The new item classname <STRING>
*
* Return Value:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_newItem", "_log", "_inList", "_amount"];
_unit = _this select 0;
_newItem = _this select 1;
d
private ["_log", "_inList", "_amount"];
params ["_unit", "_newItem"];
if (!local _unit) exitwith {
[_this, QUOTE(DFUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
@ -36,7 +35,7 @@ _amount = 1;
_amount = (_info select 1);
_inList = true;
};
}foreach _log;
} foreach _log;
if (!_inList) then {
_log pushback [_newItem, 1, ACE_time];

View File

@ -3,14 +3,13 @@
* 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>
* 0-N: Code, should return a boolean <CODE>
*
* ReturnValue:
* <NIL>
* None
*
* Public: Yes
*/
#include "script_component.hpp"
if (isnil QGVAR(unconsciousConditions)) then {
@ -21,5 +20,5 @@ if (typeName _this == typeName []) then {
if (typeName _x == typeName {}) then {
GVAR(unconsciousConditions) pushback _x;
};
}foreach _this;
} foreach _this;
};

View File

@ -13,8 +13,7 @@
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
params ["_vehicle", "_player", "_parameters"];
private ["_actions", "_unit"];
_actions = [];
@ -28,7 +27,7 @@ _actions = [];
str(_unit),
[_unit, true] call EFUNC(common,getName),
"",
{[_player, (_this select 2) select 0] call FUNC(actionUnloadUnit);},
{[_player, _parameters select 0] call FUNC(actionUnloadUnit);},
{true},
{},
[_unit]

View File

@ -18,7 +18,7 @@
private ["_pain"];
PARAMS_2(_unit,_addedPain);
params ["_unit", "_addedPain"];
//Only run on local units:
if (!local _unit) exitWith {ERROR("unit is not local");};

View File

@ -14,9 +14,8 @@
#include "script_component.hpp"
private ["_target", "_caller", "_accessLevel", "_return"];
_caller = _this select 0;
_target = _this select 1;
private ["_accessLevel", "_return"];
params ["_caller", "_targ"];
_accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1];
@ -28,4 +27,4 @@ if (_accessLevel >= 0) then {
if (_accessLevel == 2) exitwith { _return = (group _target == group _caller); };
};
_return;
_return;

View File

@ -16,17 +16,16 @@
#include "script_component.hpp"
private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
private ["_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"];
params ["_caller", "_target", "_selectionName", "_className"];
if !(_target isKindOf "CAManBase") exitWith {false};
if !(_target isKindOf "CAManBase") exitWith { false };
_config = (ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
if (GVAR(level)>=2) then {
_config = (ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
_config = if (GVAR(level)>=2) then {
(ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className)
} else {
(ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className)
};
if !(isClass _config) exitwith {false};
@ -35,17 +34,17 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
} else {
// Check for required class
if (isText (_config >> "requiredMedic")) exitwith {
missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0];
missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]
};
0;
};
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith { false };
_items = getArray (_config >> "items");
if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false};
if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false };
_allowedSelections = getArray (_config >> "allowedSelections");
if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false};
if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false };
_return = true;
if (getText (_config >> "condition") != "") then {
@ -61,7 +60,7 @@ if (getText (_config >> "condition") != "") then {
_return = [_caller, _target, _selectionName, _className] call _condition;
};
};
if (!_return) exitwith {false};
if (!_return) exitwith { false };
_patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
missionNamespace getvariable [getText(_config >> "patientStateCondition"), 0]
@ -71,7 +70,7 @@ _patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false};
_locations = getArray (_config >> "treatmentLocations");
if ("All" in _locations) exitwith {true};
if ("All" in _locations) exitwith { true };
private [ "_medFacility", "_medVeh"];
_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
@ -93,6 +92,6 @@ _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isI
};
};
};
}foreach _locations;
} foreach _locations;
_return;

View File

@ -17,6 +17,7 @@
#include "script_component.hpp"
#define MAX_DURATION_CACHE 2
params ["", "_target", "_selection", "_classname"];
// parameters, function, namespace, uid
[_this, DFUNC(canTreat), _this select 1, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall);
[_this, DFUNC(canTreat), _target, format [QGVAR(canTreat_%1_%2), _selection, _classname], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall);

View File

@ -7,16 +7,15 @@
* 1: The caller <OBJECT>
*
* Return Value:
* OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody
* Returns the copy of the unit. If no copy could be made, returns the oldBody <OBJECT>
*
* Public: No
*/
#include "script_component.hpp"
private ["_oldBody","_newUnit","_class","_group","_position","_side", "_caller", "_name"];
_oldBody = _this select 0;
_caller = _this select 1;
private ["_newUnit", "_class", "_group", "_position", "_side", "_name"];
params ["_oldBody", "_caller"];
if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies

View File

@ -3,11 +3,16 @@
* Spawns litter for the treatment action on the ground around the target
*
* Arguments:
* 0: The target <OBJECT>
* 1: The treatment classname <STRING>
* 0: The Caller <OBJECT>
* 1: The target <OBJECT>
* 2: The treatment Selection Name <STRING>
* 3: The treatment classname <STRING>
* 4: ?
* 5: Users of Items <?>
* 6: Previous Damage <NUMBER>
*
* Return Value:
*
* None
*
* Public: No
*/
@ -16,13 +21,8 @@
#define MIN_ENTRIES_LITTER_CONFIG 3
private ["_target", "_className", "_config", "_litter", "_createLitter", "_position", "_createdLitter", "_caller", "_selectionName", "_usersOfItems", "_previousDamage"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_usersOfItems = _this select 5;
_previousDamage = _this select 6;
private ["_config", "_litter", "_createLitter", "_position", "_createdLitter"];
params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_previousDamage"];
if !(GVAR(allowLitterCreation)) exitwith {};
if (vehicle _caller != _caller || vehicle _target != _target) exitwith {};
@ -38,19 +38,18 @@ if !(isArray (_config >> "litter")) exitwith {};
_litter = getArray (_config >> "litter");
_createLitter = {
private["_position", "_litterClass", "_direction"];
private["_position", "_direction"];
params ["_unit", "_litter"];
// @TODO: handle carriers over water
// For now, don't spawn litter if we are over water to avoid floating litter
if(surfaceIsWater (getPos (_this select 0))) exitWith { false };
_position = getPosATL (_this select 0);
_position = [_position select 0, _position select 1, 0];
_litterClass = _this select 1;
if (random(1) >= 0.5) then {
_position = [(_position select 0) + random 1, (_position select 1) + random 1, _position select 2];
if(surfaceIsWater (getPos _unit)) exitWith { false };
_position = getPosATL _unit;
_position params ["_posX", "_posY"];
_position = if (random(1) >= 0.5) then {
[_posX + random 1, _posY + random 1, 0]
} else {
_position = [(_position select 0) - random 1, (_position select 1) - random 1, _position select 2];
[_posX - random 1, _posY - random 1, 0];
};
_direction = (random 360);
@ -65,11 +64,10 @@ _createdLitter = [];
{
if (typeName _x == "ARRAY") then {
if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {};
private ["_selection", "_litterCondition", "_litterOptions"];
_selection = _x select 0;
params ["_selection", "_litterCondition", "_litterOptions"];
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}};
@ -88,8 +86,8 @@ _createdLitter = [];
if (typeName _x == "STRING") then {
[_target, _x] call _createLitter;
};
}foreach _litterOptions;
} foreach _litterOptions;
};
};
};
}foreach _litter;
} foreach _litter;

View File

@ -1,19 +1,21 @@
/**
* fn_determineIfFatal.sqf
* @Descr: N/A
* @Author: Glowbal
/*
* Author: Glowbal
* Determine If Fatal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
* Arguments:
* 0: Unit <OBJECT>
* 1: Part <NUMBER>
* 2: with Damage <NUMBER> (default: 0)
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit","_part","_damageThreshold", "_withDamage", "_damageBodyPart"];
_unit = _this select 0;
_part = _this select 1;
_withDamage = if (count _this > 2) then { _this select 2} else {0};
private ["_damageThreshold", "_damageBodyPart"];
params ["_unit", "_part", ["_withDamage", 0]];
if (!alive _unit) exitwith {true};
if (_part < 0 || _part > 5) exitwith {false};

View File

@ -4,10 +4,11 @@
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Show <BOOL> <OPTIONAL>
* 1: Show <BOOL> (default: true)
* 2: Selection <NUMBER> (default: 0)
*
* ReturnValue:
* nil
* None
*
* Public: No
*/
@ -18,9 +19,7 @@
// Exit for basic medical
if (GVAR(level) < 2) exitWith {};
private ["_target", "_show", "_selectionN", "_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"];
_target = _this select 0;
_show = if (count _this > 1) then {_this select 1} else {true};
_selectionN = if (count _this > 2) then {_this select 2} else {0};
params ["_target", ["_target", true], ["_selectionN", 0]];
GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0};
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
@ -34,22 +33,22 @@ if (_show) then {
[{
private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"];
_target = (_this select 0) select 0;
_selectionN = (_this select 0) select 1;
params ["_args", "_idPFH"];
_args params ["_target", "_selectionN"];
if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
if (ACE_player distance _target > MAX_DISTANCE) exitwith {
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent);
};
disableSerialization;
_display = uiNamespace getvariable QGVAR(DisplayInformation);
if (isnil "_display") exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
_allInjuryTexts = [];
@ -81,7 +80,7 @@ if (_show) then {
if !(isnil "_value") then {
_totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]);
};
}foreach GVAR(IVBags);
} foreach GVAR(IVBags);
if (_totalIvVolume >= 1) then {
_genericMessages pushback [format[localize LSTRING(receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
};
@ -92,33 +91,33 @@ if (_show) then {
_openWounds = _target getvariable [QGVAR(openWounds), []];
private "_amountOf";
{
_amountOf = _x select 3;
_x params ["", "_x1", "_selectionX", "_amountOf", "_x4"];
// Find how much this bodypart is bleeding
if (_amountOf > 0) then {
_damaged set[_x select 2, true];
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))];
_damaged set[_selectionX, true];
_selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))];
if (_selectionN == (_x select 2)) then {
if (_selectionN == _selectionX) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
if (_amountOf >= 1) then {
// TODO localization
_allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]];
_allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6, _amountOf], [1,1,1,1]];
} else {
// TODO localization
_allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]];
_allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6], [1,1,1,1]];
};
};
};
}foreach _openWounds;
} foreach _openWounds;
_bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []];
{
_amountOf = _x select 3;
_x params ["", "", "_selectionX", "_amountOf", "_x4"];
// Find how much this bodypart is bleeding
if !(_damaged select (_x select 2)) then {
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))];
if !(_damaged select _selectionX) then {
_selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))];
};
if (_selectionN == (_x select 2)) then {
if (_selectionN == _selectionX) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
if (_amountOf > 0) then {
if (_amountOf >= 1) then {
@ -130,7 +129,7 @@ if (_show) then {
};
};
};
}foreach _bandagedwounds;
} foreach _bandagedwounds;
} else {
_damaged = [true, true, true, true, true, true];
{
@ -160,7 +159,7 @@ if (_show) then {
_availableSelections = [50,51,52,53,54,55];
{
private ["_red", "_green", "_blue"];
private ["_red", "_green", "_blue", "_total"];
_total = _x;
_red = 1;
@ -177,20 +176,22 @@ if (_show) then {
};
};
(_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0];
}foreach _selectionBloodLoss;
} foreach _selectionBloodLoss;
_lbCtrl = (_display displayCtrl 200);
lbClear _lbCtrl;
{
_lbCtrl lbAdd (_x select 0);
_lbCtrl lbSetColor [_foreachIndex, _x select 1];
}foreach _genericMessages;
_x params ["_add", "_color"];
_lbCtrl lbAdd _add;
_lbCtrl lbSetColor [_foreachIndex, _color];
} foreach _genericMessages;
_amountOfGeneric = count _genericMessages;
{
_lbCtrl lbAdd (_x select 0);
_lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _x select 1];
}foreach _allInjuryTexts;
_x params ["_add", "_color"];
_lbCtrl lbAdd _add;
_lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _color];
} foreach _allInjuryTexts;
if (count _allInjuryTexts == 0) then {
_lbCtrl lbAdd (localize LSTRING(NoInjuriesBodypart));
};
@ -202,9 +203,7 @@ if (_show) then {
_logs = _target getvariable [QGVAR(logFile_Activity), []];
{
// [_message,_moment,_type, _arguments]
_message = _x select 0;
_moment = _x select 1;
_arguments = _x select 3;
_x params ["_message", "_moment", "_arguments"];
if (isLocalized _message) then {
_message = localize _message;
};
@ -213,10 +212,10 @@ if (_show) then {
if (typeName _x == "STRING" && {isLocalized _x}) then {
_arguments set [_foreachIndex, localize _x];
};
}foreach _arguments;
} foreach _arguments;
_message = format([_message] + _arguments);
_logCtrl lbAdd format["%1 %2", _moment, _message];
}foreach _logs;
} foreach _logs;
_triageStatus = [_target] call FUNC(getTriageStatus);
(_display displayCtrl 303) ctrlSetText (_triageStatus select 0);

View File

@ -4,18 +4,18 @@
*
* Arguments:
* 0: The unit <OBJECT>
* 1: Show <BOOL> (default: true)
*
* Return Value:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_target", "_show", "_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"];
_target = _this select 0;
_show = if (count _this > 1) then {_this select 1} else {true};
private ["_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"];
params ["_target", ["_show", true]];
GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull};
@ -25,15 +25,16 @@ if (_show) then {
[{
private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"];
_target = (_this select 0) select 0;
params ["_args", "_idPFH"];
_args params ["_target"];
if (GVAR(TriageCardTarget) != _target) exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
disableSerialization;
_display = uiNamespace getvariable QGVAR(triageCard);
if (isnil "_display") exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
_triageCardTexts = [];
@ -44,8 +45,7 @@ if (_show) then {
_log = _target getvariable [QGVAR(triageCard), []];
{
_item = _x select 0;
_amount = _x select 1;
_x params ["_item", "_amount"];
_message = _item;
if (isClass(configFile >> "CfgWeapons" >> _item)) then {
_message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName");
@ -55,18 +55,21 @@ if (_show) then {
};
};
_triageCardTexts pushback format["%1x - %2", _amount, _message];
}foreach _log;
} foreach _log;
if (count _triageCardTexts == 0) then {
_lbCtrl lbAdd (localize LSTRING(TriageCard_NoEntry));
};
{
_lbCtrl lbAdd _x;
}foreach _triageCardTexts;
} foreach _triageCardTexts;
_triageStatus = [_target] call FUNC(getTriageStatus);
(_display displayCtrl 2000) ctrlSetText (_triageStatus select 0);
(_display displayCtrl 2000) ctrlSetBackgroundColor (_triageStatus select 2);
_triageStatus params ["_text", "_color"];
(_display displayCtrl 2000) ctrlSetText _text;
(_display displayCtrl 2000) ctrlSetBackgroundColor _color;
}, 0, [_target]] call CBA_fnc_addPerFrameHandler;

View File

@ -3,18 +3,18 @@
* Display triage card for a unit
*
* Arguments:
* 0: The unit <OBJECT>
* 0: Show <BOOL>
*
* Return Value:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_show", "_ctrl", "_display", "_idc", "_pos"];
_show = _this select 0;
private ["_ctrl", "_display", "_idc", "_pos"];
params ["_show"];
disableSerialization;
_display = uiNamespace getvariable QGVAR(triageCard);

View File

@ -15,10 +15,9 @@
#define BLOODLOSSRATE_BASIC 0.2
private ["_unit", "_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"];
private ["_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"];
// TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical).
_unit = _this select 0;
params ["_unit"];
_totalBloodLoss = 0;
// Advanced medical bloodloss handling
@ -34,12 +33,12 @@ if (GVAR(level) >= 2) then {
// (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT));
};
}foreach _openWounds;
} foreach _openWounds;
_internalWounds = _unit getvariable [QGVAR(internalWounds), []];
{
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
}foreach _internalWounds;
} foreach _internalWounds;
// cap the blood loss to be no greater as the current cardiac output
//(_totalBloodLoss min _cardiacOutput);

View File

@ -6,29 +6,28 @@
* 0: The Unit <OBJECT>
*
* ReturnValue:
* Blood Pressuret <ARRAY <NUMBER>,<NUMBER>>
* 0: BloodPressure Low <NUMBER>
* 1: BloodPressure High <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
/*
Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120.
*/
// Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120.
#define MODIFIER_BP_HIGH 0.229
/*
Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80.
*/
// Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80.
#define MODIFIER_BP_LOW 0.1524
private ["_unit", "_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"];
_unit = _this select 0;
private ["_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"];
params ["_unit"];
_cardiacOutput = [_unit] call FUNC(getCardiacOutput);
_resistance = _unit getvariable [QGVAR(peripheralResistance), 100];
_bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance;
_bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance;
[_bloodPressureLow, _bloodPressureHigh];
[_bloodPressureLow, _bloodPressureHigh]

View File

@ -28,10 +28,8 @@
*/
#define BLOOD_CHANGE_PER_SECOND 0.0595
private ["_unit","_bloodVolume","_bloodVolumeChange", "_ivVolume"];
_unit = _this select 0;
private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"];
params ["_unit"];
_bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100];
_bloodVolumeChange = -([_unit] call FUNC(getBloodLoss));
@ -43,13 +41,13 @@ if (_bloodVolume < 100.0) then {
_ivVolume = (_unit getvariable [_x, 0]) + IV_CHANGE_PER_SECOND;
_unit setvariable [_x,_ivVolume];
};
}foreach GVAR(IVBags);
} foreach GVAR(IVBags);
} else {
{
if ((_unit getvariable [_x, 0]) > 0) then {
_unit setvariable [_x, 0]; // lets get rid of exessive IV volume
};
}foreach GVAR(IVBags);
} foreach GVAR(IVBags);
};
_bloodVolumeChange;

View File

@ -22,7 +22,6 @@
// to limit the amount of complex calculations necessary, we take a set modifier to calculate Stroke Volume.
#define MODIFIER_CARDIAC_OUTPUT 19.04761
private "_unit";
_unit = _this select 0;
params ["_unit"];
((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1);

View File

@ -15,8 +15,9 @@
#define HEART_RATE_MODIFIER 0.02
private ["_unit", "_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"];
_unit = _this select 0;
private ["_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"];
params ["_unit"];
_hrIncrease = 0;
if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
_heartRate = _unit getvariable [QGVAR(heartRate), 80];
@ -24,10 +25,8 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
_adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []];
{
_values = (_x select 0);
_x params ["_values", "_time", "_callBack"];
if (abs _values > 0) then {
_time = (_x select 1);
_callBack = _x select 2;
if (_time <= 0) then {
_time = 1;
};
@ -47,7 +46,7 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
[_unit] call _callBack;
};
}foreach _adjustment;
} foreach _adjustment;
_adjustment = _adjustment - [ObjNull];
_unit setvariable [QGVAR(heartRateAdjustments), _adjustment];

View File

@ -6,7 +6,9 @@
* 0: The unit <OBJECT>
*
* Return Value:
* Triage status from the unit. Name, statusID, color <ARRAY <STRING><NUMBER><ARRAY>>
* 0: Name <STRING>
* 1: Status ID <NUMBER>
* 2: Color <ARRAY <NUMBER>>
*
* Public: Yes
*/
@ -14,7 +16,7 @@
#include "script_component.hpp"
private ["_unit","_return","_status"];
_unit = _this select 0;
params ["_unit"];
_status = _unit getvariable [QGVAR(triageLevel), -1];
_return = switch (_status) do {
case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]};
@ -23,4 +25,4 @@ _return = switch (_status) do {
case 4: {[localize LSTRING(Triage_Status_Deceased), 4, [0, 0, 0, 0.9]]};
default {[localize LSTRING(Triage_Status_None), 0, [0, 0, 0, 0.9]]};
};
_return;
_return

View File

@ -13,23 +13,19 @@
#include "script_component.hpp"
PARAMS_1(_typeOfProjectile);
params ["_typeOfProjectile"];
private ["_typeOfDamage"];
_typeOfDamage = switch (true) do {
case (_typeOfProjectile isKindOf "BulletBase"): {"bullet"};
case (_typeOfProjectile isKindOf "GrenadeCore"): {"grenade"};
case (_typeOfProjectile isKindOf "TimeBombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "MineCore"): {"explosive"};
case (_typeOfProjectile isKindOf "FuelExplosion"): {"explosive"};
case (_typeOfProjectile isKindOf "ShellBase"): {"shell"};
case (_typeOfProjectile isKindOf "RocketBase"): {"explosive"};
case (_typeOfProjectile isKindOf "MissileBase"): {"explosive"};
case (_typeOfProjectile isKindOf "LaserBombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "BombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "Grenade"): {"grenade"};
default {toLower _typeOfProjectile};
call {
if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"};
if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"};
if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "FuelExplosion") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "ShellBase") exitWith {"shell"};
if (_typeOfProjectile isKindOf "RocketBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"};
toLower _typeOfProjectile
};
_typeOfDamage

View File

@ -14,7 +14,7 @@
#include "script_component.hpp"
private ["_unit","_return"];
_unit = _this select 0;
params ["_unit"];
if (isnil QGVAR(unconsciousConditions)) then {
GVAR(unconsciousConditions) = [];
@ -25,6 +25,6 @@ _return = false;
if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith {
_return = true;
};
}foreach GVAR(unconsciousConditions);
} foreach GVAR(unconsciousConditions);
_return;
_return

View File

@ -18,15 +18,10 @@
#include "script_component.hpp"
private ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage", "_classID", "_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"];
_target = _this select 0;
_impact = _this select 1;
_part = _this select 2;
_injuryIndex = _this select 3;
_injury = _this select 4;
_bandage = _this select 5;
private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"];
params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"];
_classID = _injury select 1;
_injury parmas ["_classID", "_injuryType"];
_className = GVAR(woundClassNames) select _classID;
// default, just in case..
@ -58,10 +53,10 @@ if (isClass (_config >> _className)) then {
_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []];
_exist = false;
_injuryType = _injury select 1;
_bandagedInjury = [];
{
if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith {
_x params ["", "_injuryTypeX", "_injuryX"];
if (_injuryTypeX == _injuryType && _injuryTypeX == (_injury select 2)) exitwith {
_exist = true;
_existingInjury = _x;
_existingInjury set [3, (_existingInjury select 3) + _impact];
@ -69,7 +64,7 @@ _bandagedInjury = [];
_bandagedInjury = _existingInjury;
};
}foreach _bandagedWounds;
} foreach _bandagedWounds;
if !(_exist) then {
// [ID, classID, bodypart, percentage treated, bloodloss rate]
@ -83,12 +78,8 @@ _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];
if (random(1) <= _reopeningChance) then {
_delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay);
[{
private ["_target", "_impact", "_part", "_injuryIndex", "_bandage", "_injury", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"];
_target = _this select 0;
_impact = _this select 1;
_part = _this select 2;
_injuryIndex = _this select 3;
_injury = _this select 4;
private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"];
params ["_target", "_impact", "_part", "_injuryIndex", "_injury"];
//if (alive _target) then {
_openWounds = _target getvariable [QGVAR(openWounds), []];
@ -102,13 +93,14 @@ if (random(1) <= _reopeningChance) then {
_exist = false;
_injuryId = _injury select 1;
{
if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith {
_x params ["_injuryIdX", "_injuryX"];
if (_injuryIdX == _injuryId && _injuryX == (_injury select 2)) exitwith {
_exist = true;
_existingInjury = _x;
_existingInjury set [3, ((_existingInjury select 3) - _impact) max 0];
_bandagedWounds set [_foreachIndex, _existingInjury];
};
}foreach _bandagedWounds;
} foreach _bandagedWounds;
if (_exist) then {
_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];

View File

@ -1,9 +1,22 @@
//#define DEBUG_MODE_FULL
/*
* Author: Glowbal
* handle Litter Create
*
* Arguments:
* 0: Litter Class <STRING>
* 1: Position <ARRAY>
* 2: Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
if(!hasInterface) exitWith { false };
PARAMS_3(_litterClass,_position,_direction);
params ["_litterClass", "_position", "_unit"];
private["_litterObject", "_maxLitterCount"];
//IGNORE_PRIVATE_WARNING(_values);
@ -16,9 +29,9 @@ _litterObject = _litterClass createVehicleLocal _position;
_litterObject setDir _direction;
_litterObject setPosATL _position;
// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112
[{ (_this select 0) setPosATL (_this select 1); }, [_litterObject, _position]] call EFUNC(common,execNextFrame);
_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call EFUNC(common,execNextFrame);
_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then {
// gank the first litter object, and spawn ours.
private["_oldLitter"];
@ -34,10 +47,11 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then {
GVAR(litterPFHRunning) = true;
[{
{
if (ACE_time - (_x select 0) >= GVAR(litterCleanUpDelay)) then {
_x params ["_time", "_objects"];
if (ACE_time - _time >= GVAR(litterCleanUpDelay)) then {
{
deleteVehicle _x;
} forEach (_x select 1);
} forEach _objects;
GVAR(allCreatedLitter) set[_foreachIndex, objNull];
};
} forEach GVAR(allCreatedLitter);
@ -46,8 +60,6 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then {
if ( (count GVAR(allCreatedLitter)) == 0) exitwith {
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
GVAR(litterPFHRunning) = false;
};
};
}, 30, []] call CBA_fnc_addPerFrameHandler;
};
true

View File

@ -17,12 +17,8 @@
#include "script_component.hpp"
private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
_shooter = _this select 3;
_projectile = _this select 4;
private ["_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"];
params ["_unit", "_selection", "_damage", "_shooter", "_projectile"];
if !(local _unit) exitWith {nil};
@ -53,7 +49,6 @@ if (GVAR(level) < 2) then {
};
_newDamage = _this call FUNC(handleDamage_caching);
// handleDamage_caching may have modified the projectile string
_projectile = _this select 4;
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage);
_typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage);
@ -123,4 +118,4 @@ if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_dam
0.89;
};
_damageReturn;
_damageReturn

View File

@ -12,20 +12,15 @@
* 6: Type of Damage <STRING>
*
* Return Value:
* Nothing
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage", "_part", "_damageBodyParts", "_newDamage", "_hitPoints"];
_unit = _this select 0;
_selectionName = _this select 1;
_amountOfDamage = _this select 2;
_sourceOfDamage = _this select 3;
_typeOfProjectile = _this select 4;
_newDamage = _this select 5;
private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_newDamage"];
// Most likely taking exessive fire damage. Lets exit.
if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {};

View File

@ -6,14 +6,14 @@
* 0: Unit for which the hitpoint damage will be sorted out <OBJECT>
*
* Return Value:
* nil
* None
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
if (!local _unit) exitwith {};
@ -22,7 +22,7 @@ private ["_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDam
// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
_bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
EXPLODE_6_PVT(_bodyStatus,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL);
_bodyStatus params ["_headDamage", "_torsoDamage", "_handsDamageR", "_handsDamageL", "_legsDamageR", "_legsDamageL"]
_unit setHitPointDamage ["hitHead", _headDamage min 0.95];
_unit setHitPointDamage ["hitBody", _torsoDamage min 0.95];

View File

@ -10,19 +10,15 @@
* 4: Type of the damage done <STRING>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"];
_unit = _this select 0;
_selectionName = _this select 1;
_amountOfDamage = _this select 2;
_sourceOfDamage = _this select 3;
_typeOfDamage = _this select 4;
private "_bodyPartn";
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
if (_bodyPartn > 1) exitwith {};

View File

@ -24,13 +24,8 @@
#define ARMDAMAGETRESHOLD2 1.7
#define UNCONSCIOUSNESSTRESHOLD 0.7
private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damage", "_armdamage", "_hitPoint", "_index", "_legdamage", "_newDamage", "_otherDamage", "_pain", "_restore"];
_unit = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_shooter = _this select 3;
_projectile = _this select 4;
private ["_damage", "_armdamage", "_hitPoint", "_index", "_legdamage", "_newDamage", "_otherDamage", "_pain", "_restore"];
params ["_unit", "_selectionName", "_damage", "_shooter", "_projectile"];
// Apply damage treshold / coefficient
_threshold = [
@ -52,8 +47,10 @@ if (diag_frameno > (_unit getVariable [QGVAR(basic_frameNo), -3]) + 2) then {
if (isnil {_unit getvariable QGVAR(structDamagePFH)}) then {
// Assign orphan structural damage to torso
[{
private ["_unit", "_damagesum"];
_unit = (_this select 0) select 0;
private "_damagesum";
params ["_args", "_idPFH"];
_args params ["_unit"];
if (ACE_diagTime - (_unit getvariable [QGVAR(structDamagePFH),-2]) >= 2) then {
_unit setVariable [QGVAR(structDamagePFH), nil];
_damagesum = (_unit getHitPointDamage "HitHead") +
@ -65,7 +62,7 @@ if (diag_frameno > (_unit getVariable [QGVAR(basic_frameNo), -3]) + 2) then {
if (_damagesum < 0.06 and damage _unit > 0.06 and alive _unit) then {
_unit setHitPointDamage ["HitBody", damage _unit];
};
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
}, 0, [_unit]] call CBA_fnc_addPerFrameHandler;
};

View File

@ -18,12 +18,8 @@
#include "script_component.hpp"
private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"];
_unit = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;
private ["_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"];
params ["_unit", "_selectionName", "_damage", "_source", "_projectile"];
_hitSelections = GVAR(SELECTIONS);
_hitPoints = GVAR(HITPOINTS);
@ -78,21 +74,21 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t
// handle the cached damages 3 frames later
[{
private ["_args", "_params"];
_args = _this select 0;
params ["_args", "_idPFH"];
params ["_unit", "_frameno"];
if (diag_frameno > _frameno + 2) then {
_unit setDamage 0;
if (diag_frameno > (_args select 1) + 2) then {
(_args select 0) setDamage 0;
_cache_params = (_args select 0) getVariable [QGVAR(cachedHandleDamageParams), []];
_cache_damages = (_args select 0) getVariable QGVAR(cachedDamages);
_cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []];
_cache_damages = _unit getVariable QGVAR(cachedDamages);
{
_params = _x + [_cache_damages select _foreachIndex];
_params call FUNC(handleDamage_advanced);
}foreach _cache_params;
} foreach _cache_params;
[(_args select 0)] call FUNC(handleDamage_advancedSetDamage);
[_unit] call FUNC(handleDamage_advancedSetDamage);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
}, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler;
@ -152,4 +148,4 @@ if (_selectionName != "") then {
_unit setVariable [QGVAR(cachedHandleDamageParams), _cache_params];
};
_newDamage;
_newDamage

View File

@ -17,12 +17,8 @@
#include "script_component.hpp"
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_fractures", "_fractureType"];
_unit = _this select 0;
_selectionName = _this select 1;
_amountOfDamage = _this select 2;
_sourceOfDamage = _this select 3;
_typeOfDamage = _this select 4;
private ["_bodyPartn", "_fractures", "_fractureType"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
_fractureType = 1;

View File

@ -10,19 +10,15 @@
* 4: Type of the damage done <STRING>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"];
_unit = _this select 0;
_selectionName = _this select 1;
_amountOfDamage = _this select 2;
_sourceOfDamage = _this select 3;
_typeOfDamage = _this select 4;
private "_bodyPartn";
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
// TODO implement internal injuries

View File

@ -10,19 +10,15 @@
* 4: Type of the damage done <STRING>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
_unit = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_typeOfProjectile = _this select 3;
_typeOfDamage = _this select 4;
private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
// Administration for open wounds and ids
_openWounds = _unit getvariable[QGVAR(openWounds), []];
@ -36,14 +32,13 @@ _woundsCreated = [];
call compile _extensionOutput;
_foundIndex = -1;
{
_toAddClassID = _x select 1;
_bodyPartNToAdd = _x select 2;
_x params ["_toAddClassID", "_bodyPartNToAdd"];
{
// Check if we have an id of the given class on the given bodypart already
if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith {
_foundIndex = _foreachIndex;
};
}foreach _openWounds;
} foreach _openWounds;
if (_foundIndex < 0) then {
// Since it is a new injury, we will have to add it to the open wounds array to store it
@ -53,7 +48,7 @@ _foundIndex = -1;
_injury = _openWounds select _foundIndex;
_injury set [3, (_injury select 3) + 1];
};
}foreach _woundsCreated;
} foreach _woundsCreated;
_unit setvariable [QGVAR(openWounds), _openWounds, true];

View File

@ -17,12 +17,8 @@
#include "script_component.hpp"
private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
_unit = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_typeOfProjectile = _this select 3;
_typeOfDamage = _this select 4;
private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
// Convert the selectionName to a number and ensure it is a valid selection.
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
@ -70,7 +66,7 @@ _allPossibleInjuries = [];
_allPossibleInjuries pushback _x;
};
};
}foreach _allInjuriesForDamageType;
} foreach _allInjuriesForDamageType;
// No possible wounds available for this damage type or damage amount.
if (_highestPossibleSpot < 0) exitwith {};
@ -98,7 +94,7 @@ _woundsCreated = [];
if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith {
_foundIndex = _foreachIndex;
};
}foreach _openWounds;
} foreach _openWounds;
};
_injury = [];
@ -123,7 +119,7 @@ _woundsCreated = [];
_painToAdd = _painToAdd + (_toAddInjury select 3);
};
};
}foreach (_injuryTypeInfo select 0); // foreach damage thresholds
} foreach (_injuryTypeInfo select 0); // foreach damage thresholds
_unit setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC];

View File

@ -13,8 +13,8 @@
#include "script_component.hpp"
private["_unit", "_openWounds"];
_unit = _this select 0;
private "_openWounds";
params ["_unit"];
if (!local _unit) exitwith {};
_unit setvariable [QGVAR(pain), 0];

View File

@ -15,9 +15,7 @@
#include "script_component.hpp"
private["_unit", "_local"];
_unit = _this select 0;
_local = _this select 1;
params ["_unit", "_local"];
if (_local) then {
if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then {
[_unit, true] call FUNC(addToInjuredCollection);

View File

@ -13,9 +13,8 @@
#include "script_component.hpp"
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood", "_bloodPressureH", "_bloodPressureL", "_interval"];
_unit = _this select 0;
_interval = _this select 1;
private ["_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood"];
params ["_unit", "_interval"];
if (_interval == 0) exitWith {};
@ -140,8 +139,7 @@ if (GVAR(level) >= 2) then {
// Check vitals for medical status
// TODO check for in revive state instead of variable
_bloodPressureL = _bloodPressure select 0;
_bloodPressureH = _bloodPressure select 1;
_bloodPressure params ["_bloodPressureL", "_bloodPressureH"];
if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then {
@ -180,6 +178,6 @@ if (GVAR(level) >= 2) then {
if !(isnil "_value") then {
_unit setvariable [_x,(_unit getvariable [_x, 0]), true];
};
}foreach GVAR(IVBags);
} foreach GVAR(IVBags);
};
};

View File

@ -16,19 +16,17 @@
#include "script_component.hpp"
private ["_medic", "_patient", "_item", "_return", "_crew"];
_medic = _this select 0;
_patient = _this select 1;
_item = _this select 2;
params ["_medic", "_patient", "_item"];
if (isnil QGVAR(setting_allowSharedEquipment)) then {
GVAR(setting_allowSharedEquipment) = true;
};
if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith {
true;
true
};
if ([_medic, _item] call EFUNC(common,hasItem)) exitwith {
true;
true
};
_return = false;
@ -38,7 +36,7 @@ if ((vehicle _medic != _medic) && {[vehicle _medic] call FUNC(isMedicalVehicle)}
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
_return = true;
};
}foreach _crew;
} foreach _crew;
};
_return;
_return

View File

@ -16,9 +16,7 @@
#include "script_component.hpp"
private ["_medic", "_patient", "_items", "_return"];
_medic = _this select 0;
_patient = _this select 1;
_items = _this select 2;
params ["_medic", "_patient", "_items"];
_return = true;
{
@ -31,4 +29,4 @@ _return = true;
};
}foreach _items;
_return;
_return

View File

@ -1,21 +1,27 @@
/**
* fn_hasMedicalEnabled.sqf
* @Descr: Check if unit has CMS enabled.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL
* @PublicAPI: true
*/
/*
* Author: Glowbal
* Check if unit has CMS enabled
*
* Arguments:
* 0: unit <OBJECT>
*
* Return Value:
* enabled <BOOL>
*
* Example:
* [Unit] call ace_medical_fnc_hasMedicalEnabled
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_medicalEnabled"];
_unit = _this select 0;
private "_medicalEnabled";
params ["_unit"];
_medicalEnabled = _unit getvariable QGVAR(enableMedical);
if (isnil "_medicalEnabled") exitwith {
(((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1);
(((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1)
};
_medicalEnabled;
_medicalEnabled

View File

@ -14,8 +14,6 @@
#include "script_component.hpp"
private ["_target", "_selectionName"];
_target = _this select 0;
_selectionName = _this select 1;
params ["_target", "_selectionName"];
(((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0);

View File

@ -13,9 +13,8 @@
#include "script_component.hpp"
private ["_unit", "_allUsedMedication", "_logs"];
_unit = _this select 0;
private ["_allUsedMedication", "_logs"];
params ["_unit"];
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(morphine), 0, true];

View File

@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
PARAMS_1(_target);
params ["_target"];
private "_owner";

View File

@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
PARAMS_1(_target);
params ["_target"];
private "_owner";

View File

@ -13,8 +13,8 @@
#include "script_component.hpp"
private ["_unit","_eyePos","_objects","_isInBuilding","_medicalFacility"];
_unit = _this select 0;
private ["_eyePos", "_objects", "_isInBuilding", "_medicalFacility"];
params ["_unit"];
_eyePos = eyePos _unit;
_isInBuilding = false;
@ -42,13 +42,13 @@ _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
_isInBuilding = true;
};
}foreach _objects;
} foreach _objects;
if (!_isInBuilding) then {
_objects = position _unit nearObjects 7.5;
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
_isInBuilding = true;
};
}foreach _objects;
} foreach _objects;
};
_isInBuilding;

View File

@ -13,9 +13,8 @@
#include "script_component.hpp"
private ["_unit", "_vehicle"];
_unit = _this select 0;
private ["_vehicle"];
params ["_unit"];
_vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {false};

View File

@ -13,8 +13,8 @@
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
private ["_openWounds", "_openWounds"];
params ["_unit"];
if (GVAR(level) <= 1) exitwith {
([_unit] call FUNC(getBloodloss)) == 0;
@ -25,6 +25,6 @@ _openWounds = _unit getvariable [QGVAR(openWounds), []];
{
// total bleeding ratio * percentage of injury left
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
}foreach _openWounds;
} foreach _openWounds;
(_totalBloodLoss == 0);

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Class <NUMBER> <OPTIONAL>
* 1: Class <NUMBER> (default: 1)
*
* ReturnValue:
* Is in of medic class <BOOL>
@ -15,8 +15,7 @@
#include "script_component.hpp"
private ["_unit", "_class", "_medicN"];
_unit = _this select 0;
_medicN = if (count _this > 1) then {_this select 1} else {1};
params ["_unit", ["_medicN", 1]];
_class = _unit getVariable [QGVAR(medicClass),
getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")];

View File

@ -12,7 +12,6 @@
*/
#include "script_component.hpp"
private ["_vehicle"];
_vehicle = _this select 0;
params ["_vehicle"];
(_vehicle getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0

View File

@ -6,15 +6,14 @@
* 0: The unit <OBJECT>
*
* ReturnValue:
* nil
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
params ["_unit"];
while {({_x == "FirstAidKit"} count items _unit) > 0} do {
_unit removeItem "FirstAidKit";

View File

@ -10,14 +10,15 @@
* 3: The action to modify <OBJECT>
*
* ReturnValue:
* nil
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_target,_player,_selectionN,_actionData);
params ["_target", "_player", "_selectionN", "_actionData"];
if (GVAR(level) < 2) exitwith {
private ["_pointDamage"];
_pointDamage = _target getHitPointDamage (["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"] select _selectionN);
@ -33,8 +34,8 @@ if (GVAR(level) < 2) exitwith {
private ["_openWounds", "_amountOf"];
_openWounds = _target getvariable [QGVAR(openWounds), []];
{
_amountOf = _x select 3;
if (_amountOf > 0 && {(_selectionN == (_x select 2))} && {(_x select 4) > 0}) exitwith {
_x params ["", "", "_selectionX", "_amountOf", "_x4"];
if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitwith {
_actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))];
};
} foreach _openWounds;

View File

@ -8,17 +8,14 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic", "_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};

View File

@ -8,15 +8,15 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
params [["_logic", objNull, [objNull]]];
if (!isNull _logic) then {
_list = _logic getvariable ["EnableList",""];
@ -32,7 +32,7 @@ if (!isNull _logic) then {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
} foreach _splittedList;
_list = "[" + _nilCheckPassedList + "]";
_parsedList = [] call compile _list;
@ -47,7 +47,7 @@ if (!isNull _logic) then {
};
};
};
}foreach _objects;
} foreach _objects;
};
{
if (!isnil "_x") then {
@ -57,7 +57,5 @@ if (!isNull _logic) then {
};
};
};
}foreach _parsedList;
} foreach _parsedList;
};
true

View File

@ -8,15 +8,15 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic","_setting","_objects"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
private ["_setting", "_objects"];
params [["_logic", objNull, [objNull]]];
if (!isNull _logic) then {
_setting = _logic getvariable ["class",0];
_objects = synchronizedObjects _logic;
@ -24,7 +24,7 @@ if (!isNull _logic) then {
if (local _x) then {
_x setvariable[QGVAR(isMedicalFacility), true, true];
};
}foreach _objects;
} foreach _objects;
};
true;

View File

@ -8,7 +8,7 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
@ -16,8 +16,8 @@
#include "script_component.hpp"
private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
params [["_logic", objNull, [objNull]]];
if (!isNull _logic) then {
_list = _logic getvariable ["EnableList",""];
@ -33,7 +33,7 @@ if (!isNull _logic) then {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
} foreach _splittedList;
_list = "[" + _nilCheckPassedList + "]";
_parsedList = [] call compile _list;
@ -48,7 +48,7 @@ if (!isNull _logic) then {
};
};
};
}foreach _objects;
} foreach _objects;
};
{
if (!isnil "_x") then {
@ -58,7 +58,5 @@ if (!isNull _logic) then {
};
};
};
}foreach _parsedList;
} foreach _parsedList;
};
true;

View File

@ -8,17 +8,14 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic", "_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};

View File

@ -8,17 +8,14 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic", "_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};

View File

@ -11,28 +11,21 @@
* 5: Incompatable medication <ARRAY<STRING>>
*
* Return Value:
* NONE
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment", "_medicationConfig", "_onOverDose", "_painReduce"];
_target = _this select 0;
_className = _this select 1;
_variable = _this select 2;
_maxDosage = _this select 3;
_timeInSystem = _this select 4;
_incompatabileMeds = _this select 5;
_viscosityChange = _this select 6;
_painReduce = _this select 7;
private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"];
params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"];
_foundEntry = false;
_allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []];
{
if (_x select 0 == _variable) exitwith {
_allMedsFromClassname = _x select 1;
_x params ["_variableX", "_allMedsFromClassname"];
if (_variableX== _variable) exitwith {
if !(_className in _allMedsFromClassname) then {
_allMedsFromClassname pushback _className;
_x set [1, _allMedsFromClassname];
@ -56,15 +49,14 @@ if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVA
_hasOverDosed = 0;
{
_med = _x select 0;
_limit = _x select 1;
_x params ["_med", "_limit"];
{
_classNamesUsed = _x select 1;
_x params ["", "_classNamesUsed"];
if ({_x == _med} count _classNamesUsed > _limit) then {
_hasOverDosed = _hasOverDosed + 1;
};
}foreach _allUsedMedication;
}foreach _incompatabileMeds;
} foreach _allUsedMedication;
} foreach _incompatabileMeds;
if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then {
_medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication");
@ -85,16 +77,8 @@ _decreaseAmount = 1 / _timeInSystem;
_viscosityAdjustment = _viscosityChange / _timeInSystem;
[{
private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment", "_painReduce"];
_args = _this select 0;
_target = _args select 0;
_timeInSystem = _args select 1;
_variable = _args select 2;
_amountDecreased = _args select 3;
_decreaseAmount = _args select 4;
_viscosityAdjustment = _args select 5;
_painReduce = _args select 6;
params ["_args", "_idPFH"];
_args params ["_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment", "_painReduce"];
_usedMeds = _target getvariable [_variable, 0];
_usedMeds = _usedMeds - _decreaseAmount;
_target setvariable [_variable, _usedMeds];
@ -106,7 +90,7 @@ _viscosityAdjustment = _viscosityChange / _timeInSystem;
_target setvariable [QGVAR(painSuppress), ((_target getvariable [QGVAR(painSuppress), 0]) - _painReduce) max 0];
if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
_args set [3, _amountDecreased];
}, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] ] call CBA_fnc_addPerFrameHandler;

View File

@ -7,7 +7,7 @@
* 1: injury <ARRAY>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
@ -15,8 +15,7 @@
#include "script_component.hpp"
private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"];
_unit = _this select 0;
_injury = _this select 1;
params ["_unit", "_injury"];
if (!local _unit) then {
_openWounds = _unit getvariable[QGVAR(openWounds), []];
@ -28,7 +27,7 @@ if (!local _unit) then {
_exists = true;
_openWounds set [_foreachIndex, _injury];
};
}foreach _openWounds;
} foreach _openWounds;
if (!_exists) then {
_openWounds pushback _injury;

View File

@ -7,19 +7,18 @@
* 1: Origin object <OBJECT>
*
* ReturnValue:
* <NIL>
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_openWounds", "_originOfrequest"];
_unit = _this select 0;
_originOfrequest = _this select 1;
params ["_unit", "_originOfrequest"];
if (local _unit && !(local _originOfrequest)) then {
_openWounds = _unit getvariable [QGVAR(openWounds), []];
{
["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent);
}foreach _openWounds;
} foreach _openWounds;
};

View File

@ -3,9 +3,9 @@
* Parse the ACE_Medical_Advanced config for all injury types.
*
* Arguments:
*
* None
* ReturnValue:
* <NIL>
* None
*
* Public: No
*/
@ -110,7 +110,7 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
if (_type in (_x select 5)) then {
_woundTypes pushback _x;
};
}foreach _allWoundClasses;
} foreach _allWoundClasses;
_typeThresholds = _thresholds;
_selectionSpecificType = _selectionSpecific;
if (isClass(_damageTypesConfig >> _x)) then {
@ -130,46 +130,41 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
_minDamageThresholds = _minDamageThresholds + ":";
_amountThresholds = _amountThresholds + ":";
};
}foreach _typeThresholds;
} foreach _typeThresholds;
"ace_medical" callExtension format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _foreachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType];
}foreach _allFoundDamageTypes;
} foreach _allFoundDamageTypes;
// Extension loading
{
private ["_classID", "_className", "_allowedSelections", "_bloodLoss", "_pain", "_minDamage", "_maxDamage", "_causes", "_classDisplayName", "_extensionInput", "_selections", "_causesArray"];
private ["_className", "_allowedSelections", "_causes"];
// add shit to addInjuryType
_classID = _x select 0;
params ["_classID", "_selections", "_bloodLoss", "_pain", "_damage", "_causesArray", "_classDisplayName"];
_damage params ["_minDamage", "_maxDamage"];
_className = GVAR(woundClassNames) select _forEachIndex;
_allowedSelections = "";
_selections = _x select 1;
{
_allowedSelections = _allowedSelections + _x;
if (_forEachIndex < (count _selections) - 1) then {
_allowedSelections = _allowedSelections + ":";
};
}foreach _selections;
} foreach _selections;
_bloodLoss = _x select 2;
_pain = _x select 3;
_minDamage = (_x select 4) select 0;
_maxDamage = (_x select 4) select 1;
_causes = "";
_causesArray = (_x select 5);
{
_causes = _causes + _x;
if (_forEachIndex < (count _causesArray) - 1) then {
_causes = _causes + ":";
};
}foreach _causesArray;
_classDisplayName = _x select 6;
} foreach _causesArray;
"ace_medical" callExtension format["addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9", _classID, _className, _allowedSelections, _bloodLoss, _pain, _minDamage, _maxDamage, _causes, _classDisplayName];
}foreach _allWoundClasses;
} foreach _allWoundClasses;
"ace_medical" callExtension "ConfigComplete";

View File

@ -6,9 +6,10 @@
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Amount of Pain <NUMBER>
*
* ReturnValue:
* <NIL>
* None
*
* Public: No
*/
@ -16,8 +17,7 @@
#include "script_component.hpp"
private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"];
_unit = _this select 0;
_pain = _this select 1;
params ["_unit", "_pain"];
if (!local _unit || !GVAR(enableScreams)) exitwith{};
// Lock if the unit is already playing a sound.

View File

@ -35,11 +35,11 @@ _timeInCardiacArrest = 120 + round(random(600));
_heartRate = _unit getvariable [QGVAR(heartRate), 80];
if (_heartRate > 0 || !alive _unit) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
_unit setvariable [QGVAR(inCardiacArrest), nil,true];
};
if (ACE_time - _startTime >= _timeInCardiacArrest) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
_unit setvariable [QGVAR(inCardiacArrest), nil,true];
[_unit] call FUNC(setDead);
};

View File

@ -50,7 +50,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal ==
_startTime = _unit getvariable [QGVAR(reviveStartTime), 0];
if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
_unit setvariable [QGVAR(inReviveState), nil, true];
_unit setvariable [QGVAR(reviveStartTime), nil];
[_unit, true] call FUNC(setDead);
@ -64,7 +64,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal ==
};
_unit setvariable [QGVAR(reviveStartTime), nil];
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
if (GVAR(level) >= 2) then {
if (_unit getvariable [QGVAR(heartRate), 60] > 0) then {

View File

@ -36,13 +36,13 @@ _target setvariable [QGVAR(tourniquets), _tourniquets, true];
_part = _args select 2;
_time = _args select 3;
if (!alive _target) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
if !((_tourniquets select _part) == _applyingTo) exitwith {
// Tourniquet has been removed
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
if (ACE_time - _time > 120) then {
_target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005];

View File

@ -45,7 +45,7 @@ if (!alive _unit) exitwith {
[_unit, "isUnconscious"] call EFUNC(common,unmuteUnit);
["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
@ -99,7 +99,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith {
["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent);
// EXIT PFH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
if (!_hasMovedOut) then {
// Reset the unit back to the previous captive state.
@ -132,7 +132,7 @@ if (_parachuteCheck) then {
if (!local _unit) exitwith {
_args set [3, _minWaitingTime - (ACE_time - _startingTime)];
_unit setvariable [QGVAR(unconsciousArguments), _args, true];
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};
// Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs