mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
treatment functions and unconsciousness rework
This commit is contained in:
parent
bad01c3126
commit
5613ec5d5a
@ -45,6 +45,7 @@ PREP(fixFloating);
|
||||
PREP(fixLoweredRifleAnimation);
|
||||
PREP(fixPosition);
|
||||
PREP(getAllDefinedSetVariables);
|
||||
PREP(getAwakeAnim);
|
||||
PREP(getDeathAnim);
|
||||
PREP(getDefaultAnim);
|
||||
PREP(getDefinedVariable);
|
||||
|
@ -9,7 +9,6 @@
|
||||
* 0 = PlayMove
|
||||
* 1 = PlayMoveNow
|
||||
* 2 = SwitchMove (no transitional animation, doesn't overwrite priority 1)
|
||||
* 3: Force overwritting unconscious (default: false) <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -21,14 +20,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_animation", ["_priority", 0], ["_force", false]];
|
||||
TRACE_4("params",_unit,_animation,_priority,_force);
|
||||
|
||||
// don't overwrite more important animations
|
||||
if (_unit getVariable ["ACE_isUnconscious", false] && {(_animation != "Unconscious")} && {!_force}) exitWith {};
|
||||
|
||||
// don't go unconscious if the unit isn't unconscious
|
||||
if (_animation == "Unconscious" && {!((_unit getVariable ["ACE_isUnconscious", false]) || (_unit getVariable ["ACE_isDead", false]))}) exitWith {};
|
||||
params ["_unit", "_animation", ["_priority", 0]];
|
||||
TRACE_4("params",_unit,_animation,_priority);
|
||||
|
||||
// switchMove "" no longer works in dev 1.37
|
||||
if (_animation == "") then {
|
||||
@ -43,7 +36,7 @@ switch (_priority) do {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[QGVAR(playMove), [_unit, _animation], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have local effects when executed on remote machines inside vehicles.
|
||||
[QGVAR(playMove), [_unit, _animation]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
};
|
||||
@ -51,7 +44,7 @@ switch (_priority) do {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[QGVAR(playMoveNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have local effects when executed on remote machines inside vehicles.
|
||||
[QGVAR(playMoveNow), [_unit, _animation]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
};
|
||||
@ -60,7 +53,7 @@ switch (_priority) do {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[QGVAR(playMoveNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have local effects when executed on remote machines inside vehicles.
|
||||
[QGVAR(playMoveNow), [_unit, _animation]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
|
||||
|
49
addons/common/functions/fnc_getAwakeAnim.sqf
Normal file
49
addons/common/functions/fnc_getAwakeAnim.sqf
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Report awake animation of unit inside vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* The animtaion <STRING>
|
||||
*
|
||||
* Example:
|
||||
* player call ace_common_fnc_getAwakeAnim
|
||||
*
|
||||
* Public: no
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private _vehicle = vehicle _unit;
|
||||
|
||||
// --- on foot
|
||||
if (_vehicle isEqualTo _unit) exitWith {""};
|
||||
|
||||
// --- driver
|
||||
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
if (_unit == driver _vehicle) exitWith {
|
||||
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getText (_config >> "driverAction")) // return
|
||||
};
|
||||
|
||||
// --- turret
|
||||
private _turret = _unit call CBA_fnc_turretPath;
|
||||
|
||||
if !(_turret isEqualTo []) exitWith {
|
||||
private _turretConfig = [_vehicle, _turret] call CBA_fnc_getTurret;
|
||||
|
||||
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getText (_turretConfig >> "gunnerAction")) // return
|
||||
};
|
||||
|
||||
// --- cargo
|
||||
private _cargoIndex = _vehicle getCargoIndex _unit;
|
||||
|
||||
if (_cargoIndex != -1) exitWith {
|
||||
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getArray (_config >> "cargoAction") select _cargoIndex) // return
|
||||
};
|
||||
|
||||
// --- default
|
||||
""
|
@ -30,8 +30,7 @@ if (isNil "ACE_maxWeightCarry") then {
|
||||
//@todo Captivity?
|
||||
|
||||
//Add Keybind:
|
||||
["ACE3 Common", QGVAR(drag), (localize LSTRING(DragKeybind)),
|
||||
{
|
||||
["ACE3 Common", QGVAR(drag), (localize LSTRING(DragKeybind)), {
|
||||
if (!alive ACE_player) exitWith {false};
|
||||
if !([ACE_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
@ -51,7 +50,6 @@ if (isNil "ACE_maxWeightCarry") then {
|
||||
|
||||
[ACE_player, _cursor] call FUNC(startDrag);
|
||||
false
|
||||
},
|
||||
{false},
|
||||
[-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
||||
|
||||
}, {
|
||||
false
|
||||
}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
||||
|
@ -29,10 +29,9 @@ if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||
};
|
||||
|
||||
// handle waking up dragged unit
|
||||
//if (_unit == _draggedObject) then {
|
||||
// [_player, _draggedObject] call FUNC(dropObject);
|
||||
//};
|
||||
|
||||
if (_unit == _draggedObject) then {
|
||||
[_player, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
};
|
||||
|
||||
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
||||
@ -45,8 +44,7 @@ if (_player getVariable [QGVAR(isCarrying), false]) then {
|
||||
};
|
||||
|
||||
// handle waking up dragged unit
|
||||
//if (_unit == _carriedObject) then {
|
||||
// [_player, _carriedObject] call FUNC(dropObject_carry);
|
||||
//};
|
||||
|
||||
if (_unit == _carriedObject) then {
|
||||
[_player, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
};
|
||||
|
@ -271,11 +271,4 @@ class ACE_Settings {
|
||||
values[] = {CSTRING(useSelection), CSTRING(useRadial), "Disabled"};
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(delayUnconCaptive) {
|
||||
category = CSTRING(Category_Medical);
|
||||
displayName = CSTRING(MedicalSettings_delayUnconCaptive_DisplayName);
|
||||
description = CSTRING(MedicalSettings_delayUnconCaptive_Description);
|
||||
typeName = "SCALAR";
|
||||
value = 3;
|
||||
};
|
||||
};
|
||||
|
@ -15,7 +15,6 @@ PREP(isInMedicalVehicle);
|
||||
PREP(isInStableCondition);
|
||||
PREP(isMedic);
|
||||
PREP(isMedicalVehicle);
|
||||
PREP(selectionNameToNumber);
|
||||
PREP(setHitPointDamage);
|
||||
PREP(setStructuralDamage);
|
||||
PREP(stateEvent);
|
||||
@ -29,3 +28,5 @@ PREP(handleStateUnconscious);
|
||||
PREP(handleUnitVitals);
|
||||
PREP(handleMedications);
|
||||
// PREP(handleStateRevive);
|
||||
|
||||
PREP(setUnconscious);
|
||||
|
@ -14,6 +14,7 @@ if (isServer) then {
|
||||
|
||||
["ace_unconscious", {
|
||||
params ["_unit", "_status"];
|
||||
|
||||
if (local _unit) then {
|
||||
if (_status) then {
|
||||
_unit setVariable ["tf_voiceVolume", 0, true];
|
||||
|
@ -6,14 +6,14 @@
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
* 1: Damage to Add <NUMBER>
|
||||
* 2: Selection ("head", "body", "hand_l", "hand_r", "leg_l", "leg_r") <STRING>
|
||||
* 2: Body part ("Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg") <STRING>
|
||||
* 3: Projectile Type <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* HandleDamage's return <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [player, 0.8, "leg_r", "bullet"] call ace_medical_fnc_addDamageToUnit
|
||||
* [player, 0.8, "rightleg", "bullet"] call ace_medical_fnc_addDamageToUnit
|
||||
* [cursorTarget, 1, "body", "stab"] call ace_medical_fnc_addDamageToUnit
|
||||
*
|
||||
* Public: Yes
|
||||
@ -22,16 +22,16 @@
|
||||
// #define DEBUG_TESTRESULTS
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_selection", "", [""]], ["_typeOfDamage", "", [""]]];
|
||||
TRACE_4("params",_unit,_damageToAdd,_selection,_typeOfDamage);
|
||||
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]]];
|
||||
TRACE_4("params",_unit,_damageToAdd,_bodyPart,_typeOfDamage);
|
||||
|
||||
_selection = toLower _selection;
|
||||
if ((isNull _unit) || {!local _unit} || {!alive _unit}) exitWith {ERROR_1("addDamageToUnit - badUnit %1", _this); -1};
|
||||
_bodyPart = toLower _bodyPart;
|
||||
if (isNull _unit || {!local _unit} || {!alive _unit}) exitWith {ERROR_1("addDamageToUnit - badUnit %1", _this); -1};
|
||||
if (_damageToAdd < 0) exitWith {ERROR_1("addDamageToUnit - bad damage %1", _this); -1};
|
||||
if (!(_selection in GVAR(SELECTIONS))) exitWith {ERROR_1("addDamageToUnit - bad selection %1", _this); -1};
|
||||
if !(_bodyPart in ALL_BODY_PARTS) exitWith {ERROR_1("addDamageToUnit - bad selection %1", _this); -1};
|
||||
|
||||
//Get the hitpoint and the index
|
||||
private _hitpoint = [_unit, _selection, true] call ace_medical_fnc_translateSelections;
|
||||
private _hitpoint = [_unit, _bodyPart, true] call ace_medical_fnc_translateSelections;
|
||||
(getAllHitPointsDamage _unit) params [["_allHitPoints", []]];
|
||||
private _hitpointIndex = -1;
|
||||
{ //case insensitive find
|
||||
@ -43,7 +43,7 @@ private _currentDamage = _unit getHitIndex _hitpointIndex;
|
||||
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
private _checkAtFrame = diag_frameno + 5;
|
||||
private _partNumber = [_selection] call FUNC(selectionNameToNumber);
|
||||
private _partNumber = ALL_BODY_PARTS find _bodyPart;
|
||||
private _startDmg = (_unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _partNumber;
|
||||
private _debugCode = {
|
||||
params ["", "_unit", "_startDmg", "_damageToAdd", "_partNumber"];
|
||||
@ -57,7 +57,7 @@ private _debugCode = {
|
||||
[{diag_frameno > (_this select 0)}, _debugCode, [_checkAtFrame, _unit, _startDmg, _damageToAdd, _partNumber]] call CBA_fnc_waitUntilAndExecute;
|
||||
#endif
|
||||
|
||||
private _return = [_unit, _selection, (_currentDamage + _damageToAdd), _unit, _typeOfDamage, _hitpointIndex, objNull] call FUNC(handleDamage);
|
||||
private _return = [_unit, _bodyPart, (_currentDamage + _damageToAdd), _unit, _typeOfDamage, _hitpointIndex, objNull] call FUNC(handleDamage);
|
||||
TRACE_1("handleDamage called",_return);
|
||||
|
||||
_return
|
||||
|
@ -26,7 +26,7 @@ if (_local) then {
|
||||
private _arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]);
|
||||
_arguments set [2, CBA_missionTime];
|
||||
|
||||
[DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler;
|
||||
//[DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(unconsciousArguments), nil, true];
|
||||
};
|
||||
|
@ -4,16 +4,15 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
* 1: SelectionName <STRING>
|
||||
* 1: Body Part <STRING>
|
||||
*
|
||||
* ReturnValue:
|
||||
* Has tourniquet applied <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target", "_selectionName"];
|
||||
params ["_target", "_bodyPart"];
|
||||
|
||||
(((_target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0);
|
||||
((_target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select (ALL_BODY_PARTS find toLower _bodyPart)) > 0
|
||||
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the number representation of a selection name.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The selection name of a unit <STRING>
|
||||
*
|
||||
* ReturnValue:
|
||||
* Number representation. -1 if invalid. <NUMBER>
|
||||
*
|
||||
* Public: yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
(["head","body","hand_l","hand_r","leg_l","leg_r"] find (_this select 0));
|
@ -26,104 +26,82 @@ if !(EGVAR(common,settingsInitFinished)) exitWith {
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this];
|
||||
};
|
||||
|
||||
private ["_animState", "_originalPos", "_startingTime", "_isDead"];
|
||||
params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]];
|
||||
params ["_unit", ["_set", true], ["_minUnconsciousTime", DEFAULT_DELAY], ["_force", false]];
|
||||
|
||||
// No change, fuck off. (why is there no xor?)
|
||||
if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {};
|
||||
|
||||
if !(_set) exitWith {
|
||||
_unit setVariable ["ACE_isUnconscious", false, true];
|
||||
|
||||
if (_unit getVariable [QGVAR(inReviveState), false]) then {
|
||||
_unit setVariable [QGVAR(inReviveState), nil, true];
|
||||
};
|
||||
|
||||
[_unit, false] call EFUNC(medical_engine,setUnconsciousAnim);
|
||||
|
||||
["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
|
||||
if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitWith{};
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")}) exitWith {};
|
||||
|
||||
if (!local _unit) exitWith {
|
||||
[QGVAR(setUnconscious), [_unit, _set, _minWaitingTime, _force], _unit] call CBA_fnc_targetEvent;
|
||||
[QGVAR(setUnconscious), [_unit, _set, _minUnconsciousTime, _force], _unit] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
_unit setVariable ["ACE_isUnconscious", true, true];
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
if (visibleMap) then {openMap false};
|
||||
|
||||
while {dialog} do {
|
||||
closeDialog 0;
|
||||
};
|
||||
};
|
||||
|
||||
// if we have unconsciousness for AI disabled, we will kill the unit instead
|
||||
_isDead = false;
|
||||
private _isDead = false;
|
||||
|
||||
if (!([_unit, GVAR(remoteControlledAI)] call EFUNC(common,isPlayer)) && !_force) then {
|
||||
_enableUncon = _unit getVariable [QGVAR(enableUnconsciousnessAI), GVAR(enableUnconsciousnessAI)];
|
||||
|
||||
if (_enableUncon == 0 or {_enableUncon == 1 and (random 1) < 0.5}) then {
|
||||
[_unit, true] call FUNC(setDead);
|
||||
_isDead = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_isDead) exitWith {};
|
||||
|
||||
// If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious,
|
||||
// therefor we force it to select the primairy weapon before going unconscious
|
||||
if ((vehicle _unit) isKindOf "StaticWeapon") then {
|
||||
[_unit] call EFUNC(common,unloadPerson);
|
||||
};
|
||||
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then {
|
||||
_unit action ["ladderOff", (nearestBuilding _unit)];
|
||||
};
|
||||
if (vehicle _unit == _unit) then {
|
||||
if (primaryWeapon _unit == "") then {
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
_unit selectWeapon (primaryWeapon _unit);
|
||||
};
|
||||
|
||||
// We are storing the current animation, so we can use it later on when waking the unit up inside a vehicle
|
||||
if (vehicle _unit != _unit) then {
|
||||
_unit setVariable [QGVAR(vehicleAwakeAnim), [(vehicle _unit), (animationState _unit)]];
|
||||
};
|
||||
|
||||
//Save current stance:
|
||||
_originalPos = unitPos _unit;
|
||||
|
||||
_unit setUnitPos "DOWN";
|
||||
[_unit, true] call EFUNC(common,disableAI);
|
||||
|
||||
// So the AI does not get stuck, we are moving the unit to a temp group on its own.
|
||||
// Unconscious units shouldn't be put in another group #527:
|
||||
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
|
||||
[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
};
|
||||
|
||||
// Delay Unconscious so the AI dont instant stop shooting on the unit #3121
|
||||
if (GVAR(delayUnconCaptive) == 0) then {
|
||||
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
|
||||
} else {
|
||||
[{
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
},[_unit], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
}, _unit, 3] call CBA_fnc_waitAndExecute;
|
||||
|
||||
_anim = [_unit] call EFUNC(common,getDeathAnim);
|
||||
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
|
||||
[{
|
||||
params ["_unit", "_anim"];
|
||||
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
|
||||
[_unit, _anim, 2, true] call EFUNC(common,doAnimation);
|
||||
};
|
||||
}, [_unit, _anim], 0.5, 0] call CBA_fnc_waitAndExecute;
|
||||
|
||||
_startingTime = CBA_missionTime;
|
||||
[_unit, true] call EFUNC(medical_engine,setUnconsciousAnim);
|
||||
|
||||
[_unit, "Unconscious", []] call FUNC(stateEvent);
|
||||
|
||||
[DFUNC(unconsciousPFH), 0.1, [_unit, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// unconscious can't talk
|
||||
[_unit, "isUnconscious"] call EFUNC(common,muteUnit);
|
||||
|
||||
["ace_unconscious", [_unit, true]] call CBA_fnc_globalEvent;
|
||||
|
||||
// auto wake up, testing @todo
|
||||
[{
|
||||
params ["_unit", "_time"];
|
||||
|
||||
!(_unit getVariable ["ACE_isUnconscious", false]) || {CBA_missionTime > _time}
|
||||
}, {
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_unit, false] call FUNC(setUnconscious);
|
||||
};
|
||||
}, [_unit, CBA_missionTime + _minUnconsciousTime]] call CBA_fnc_waitUntilAndExecute;
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
|
||||
// scale received pain to 0-2 level to select type of scream
|
||||
// below 0.33: 0, from 0.34 to 0.66: 1, more than 0.67: 2
|
||||
#define PAIN_TO_MOAN(pain) (floor (3 * pain) min 2)
|
||||
|
@ -4019,28 +4019,5 @@
|
||||
<Russian>Будет ли объект считаться медицинским транспортом.</Russian>
|
||||
<Japanese>どれでも、またはオブジェクトを医療車両として割り当てます。</Japanese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_MedicalSettings_delayUnconCaptive_Description">
|
||||
<English>Delay cease fire of AI while player is unconscious for medical reasons.</English>
|
||||
<German>Verzögert das Ende des KI-Beschusses auf einen Spieler, wenn dieser aus medizinischen Gründen bewustlos wird.</German>
|
||||
<Italian>Ritarda il cessate il fuoco dell'IA quando il giocatore è svenuto per motivi medici.</Italian>
|
||||
<Czech>Prodleva zastavení palby pro AI, pokud je hráč v bezvědomí ze zdravotních důvodů.</Czech>
|
||||
<Portuguese>Atraso durante cessar fogo da AI durante inconsciência médica</Portuguese>
|
||||
<French>Délai de cessez le feu pour l'IA pendant que le joueur est inconscient pour des raisons médicales</French>
|
||||
<Russian>Задержка прекращения огня ботами, когда игрок теряет сознание по медицинским причинам.</Russian>
|
||||
<Japanese>AI はプレイヤーが医療的な理由で気絶している場合にかぎり、撃つのをためらいます。</Japanese>
|
||||
<Polish>Opóźnij stan wstrzymania ognia u AI kiedy gracz jest nieprzytomny z powodów medycznych.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_MedicalSettings_delayUnconCaptive_DisplayName">
|
||||
<English>Delay cease fire of AI for unconsciousness</English>
|
||||
<German>Verzögert Ende des KI-Beschusses bei medizinischer Bewustlosigkeit</German>
|
||||
<Spanish>Demora antes de volverse neutral al caer inconsciente</Spanish>
|
||||
<Polish>Opóźnij wstrzymanie ognia AI dla nieprzytomnych osób</Polish>
|
||||
<Italian>Ritarda il cessate il fuoco dell'IA quando si è svenuti</Italian>
|
||||
<Czech>Prodleva zastavení palby AI na bezvědomé</Czech>
|
||||
<Portuguese>Atraso durante cessar fogo da AI durante inconsciência</Portuguese>
|
||||
<French>Délai de cessez le feu de l'IA pour la perte de conscience</French>
|
||||
<Russian>Задержка прекращения огня ботами при потере сознания</Russian>
|
||||
<Japanese>AI は気絶している人へ、ためらってから射撃します</Japanese>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["ace_settingsInitialized", {
|
||||
/*["ace_settingsInitialized", {
|
||||
TRACE_1("settingsInitialized", GVAR(enabledFor));
|
||||
if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled
|
||||
if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients
|
||||
@ -32,4 +32,4 @@
|
||||
};
|
||||
|
||||
GVAR(statemachine) = [configFile >> "ACE_Medical_AI_StateMachine"] call CBA_statemachine_fnc_createFromConfig;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call CBA_fnc_addEventHandler;*/
|
||||
|
@ -32,8 +32,8 @@ switch (true) do {
|
||||
_index
|
||||
};
|
||||
} forEach _openWounds;
|
||||
private _selection = ["head","body","hand_l","hand_r","leg_l","leg_r"] select _partIndex;
|
||||
[_this, "Bandage", _selection] call EFUNC(medical_treatment,treatmentAdvanced_bandageLocal);
|
||||
private _selection = ALL_BODY_PARTS select _partIndex;
|
||||
[_this, "Bandage", _selection] call EFUNC(medical_treatment,treatmentBandageLocal);
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat format ["%1 is bandaging selection %2", _this, _selection];
|
||||
|
@ -61,8 +61,8 @@ switch (true) do {
|
||||
_index
|
||||
};
|
||||
} forEach _openWounds;
|
||||
private _selection = ["head","body","hand_l","hand_r","leg_l","leg_r"] select _partIndex;
|
||||
[_target, "Bandage", _selection] call EFUNC(medical_treatment,treatmentAdvanced_bandageLocal);
|
||||
private _selection = ALL_BODY_PARTS select _partIndex;
|
||||
[_target, "Bandage", _selection] call EFUNC(medical_treatment,treatmentBandageLocal);
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat format ["%1 is bandaging selection %2 on %3", _this, _selection, _target];
|
||||
|
@ -15,3 +15,5 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define COMPONENT_BEAUTIFIED Medical Blood
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#define DEBUG_ENABLED_MEDICAL_BLOOD
|
||||
// #define DEBUG_ENABLED_MEDICAL_BLOOD
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit That Was Hit <OBJECT>
|
||||
* 1: Name Of Hit Selection <STRING>
|
||||
* 1: Name Of Body Part <STRING>
|
||||
* 2: Amount Of Damage <NUMBER>
|
||||
* 3: Shooter or source of the damage <OBJECT>
|
||||
* 4: Type of the damage done <STRING>
|
||||
@ -14,14 +14,13 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_bodyPartn";
|
||||
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
_bodyPartn = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
params ["_unit", "_bodyPart", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
|
||||
if (_bodyPartn > 1) exitWith {};
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
|
||||
if (_partIndex > 1) exitWith {};
|
||||
|
||||
if (_amountOfDamage > 0.5) then {
|
||||
if (random(1) >= 0.8) then {
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit That Was Hit <OBJECT>
|
||||
* 1: Name Of Hit Selection <STRING>
|
||||
* 1: Name Of Body Part <STRING>
|
||||
* 2: Amount Of Damage <NUMBER>
|
||||
* 3: Shooter or source of the damage <OBJECT>
|
||||
* 4: Type of the damage done <STRING>
|
||||
@ -14,16 +14,15 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_bodyPartn", "_fractures", "_fractureType"];
|
||||
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
_bodyPartn = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
params ["_unit", "_bodyPart", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
|
||||
private _fractureType = 1;
|
||||
|
||||
_fractureType = 1;
|
||||
if (_amountOfDamage > 0.05) then {
|
||||
|
||||
// TODO specify fractures based off typeOfInjury details better.
|
||||
switch (_typeOfDamage) do {
|
||||
case "Bullet": {
|
||||
@ -58,13 +57,14 @@ if (_amountOfDamage > 0.05) then {
|
||||
};
|
||||
};
|
||||
|
||||
private ["_fractures", "_fractureID", "_amountOf"];
|
||||
_fractures = _unit getVariable[QGVAR(fractures), []];
|
||||
_fractureID = 1;
|
||||
_amountOf = count _fractures;
|
||||
private _fractures = _unit getVariable[QGVAR(fractures), []];
|
||||
private _fractureID = 1;
|
||||
private _amountOf = count _fractures;
|
||||
|
||||
if (_amountOf > 0) then {
|
||||
_fractureID = (_fractures select (_amountOf - 1) select 0) + 1;
|
||||
};
|
||||
_fractures pushBack [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */];
|
||||
|
||||
_fractures pushBack [_fractureID, _fractureType, _partIndex, 1 /* percentage treated */];
|
||||
_unit setVariable [QGVAR(fractures), _fractures, true];
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit That Was Hit <OBJECT>
|
||||
* 1: Name Of Hit Selection <STRING>
|
||||
* 1: Name Of Body Part <STRING>
|
||||
* 2: Amount Of Damage <NUMBER>
|
||||
* 3: Shooter or source of the damage <OBJECT>
|
||||
* 4: Type of the damage done <STRING>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_bodyPartn";
|
||||
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
// _bodyPartn = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
params ["_unit", "_bodyPart", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
||||
|
||||
// private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
// TODO implement internal injuries
|
||||
|
@ -19,10 +19,6 @@
|
||||
params ["_unit", "_bodyPart", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
||||
TRACE_5("start",_unit,_bodyPart,_damage,_typeOfProjectile,_typeOfDamage);
|
||||
|
||||
///// DELETE THIS AFTER EXTENSION HAS BEEN UPDATED
|
||||
_bodyPart = EGVAR(medical,SELECTIONS) select (ALL_BODY_PARTS find _bodyPart);
|
||||
/////
|
||||
|
||||
if (_typeOfDamage isEqualTo "") then {
|
||||
_typeOfDamage = "unknown";
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ params ["_unit", "_bodyPart", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
||||
TRACE_5("start",_unit,_bodyPart,_damage,_typeOfProjectile,_typeOfDamage);
|
||||
|
||||
// Convert the selectionName to a number and ensure it is a valid selection.
|
||||
private _bodyPartN = ALL_BODY_PARTS find _bodyPart;
|
||||
private _bodyPartN = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
if (_bodyPartN < 0) exitWith {};
|
||||
|
||||
if (_typeOfDamage isEqualTo "") then {
|
||||
@ -69,7 +69,7 @@ private _allPossibleInjuries = [];
|
||||
if (_highestPossibleSpot < 0) exitWith {};
|
||||
|
||||
// Administration for open wounds and ids
|
||||
private _openWounds = _unit getVariable [QGVAR(openWounds), []];
|
||||
private _openWounds = _unit getVariable [QEGVAR(medical,openWounds), []];
|
||||
private _woundID = _unit getVariable [QGVAR(lastUniqueWoundID), 1];
|
||||
|
||||
private _painToAdd = 0;
|
||||
@ -126,16 +126,17 @@ private _woundsCreated = [];
|
||||
};
|
||||
} forEach _thresholds;
|
||||
|
||||
_unit setVariable [QGVAR(openWounds), _openWounds, true];
|
||||
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
// Only update if new wounds have been created
|
||||
if (count _woundsCreated > 0) then {
|
||||
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
};
|
||||
|
||||
private _painLevel = _unit getVariable [QGVAR(pain), 0];
|
||||
_unit setVariable [QGVAR(pain), _painLevel + _painToAdd];
|
||||
// TODO use medical add pain function instead
|
||||
private _painLevel = _unit getVariable [QEGVAR(medical,pain), 0];
|
||||
_unit setVariable [QEGVAR(medical,pain), _painLevel + _painToAdd];
|
||||
|
||||
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
||||
|
||||
TRACE_6("exit",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated);
|
||||
TRACE_6("exit",_unit, _painLevel, _painToAdd, _unit getVariable QEGVAR(medical,pain), _unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default})
|
||||
#define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default})
|
||||
|
||||
#define ALL_BODY_PARTS ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"]
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
|
||||
// scale received pain to 0-2 level to select type of scream
|
||||
// below 0.25: 0, from 0.25 to 0.5: 1, more than 0.5: 2
|
||||
|
10
addons/medical_engine/CfgExtendedAnimation.hpp
Normal file
10
addons/medical_engine/CfgExtendedAnimation.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
// we want the face down animation every time
|
||||
class CfgExtendedAnimation {
|
||||
class Revive {
|
||||
left = "Unconscious";
|
||||
right = "Unconscious";
|
||||
front = "Unconscious";
|
||||
back = "Unconscious";
|
||||
};
|
||||
};
|
@ -1,5 +1,8 @@
|
||||
|
||||
class CfgMovesBasic;
|
||||
class CfgMovesBasic {
|
||||
class Default;
|
||||
};
|
||||
|
||||
class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
class States {
|
||||
// fixes hand being stuck at rifle which is on the back
|
||||
@ -7,5 +10,10 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
class AinvPknlMstpSlayWnonDnon_medicOther: AmovPknlMstpSrasWrflDnon_AinvPknlMstpSlayWrflDnon {
|
||||
weaponIK = 0;
|
||||
};
|
||||
|
||||
// wake me up inside
|
||||
class Unconscious: Default {
|
||||
InterpolateTo[] = {"DeadState",0.1,"AmovPpneMstpSnonWnonDnon",0.2};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -5,3 +5,4 @@ PREP(damageBodyPart);
|
||||
PREP(setLimping);
|
||||
PREP(setPainSway);
|
||||
PREP(setStructuralDamage);
|
||||
PREP(setUnconsciousAnim);
|
||||
|
@ -41,3 +41,13 @@
|
||||
];
|
||||
}] call CBA_fnc_waitUntilAndExecute;
|
||||
#endif
|
||||
|
||||
// this handles moving units into vehicles via load functions or zeus
|
||||
// needed, because the vanilla INCAPACITATED state does not handle vehicles
|
||||
["CAManBase", "GetInMan", {
|
||||
params ["_unit"];
|
||||
|
||||
if (lifeState _unit == "INCAPACITATED") then {
|
||||
[_unit, true] call FUNC(setUnconsciousAnim);
|
||||
};
|
||||
}] call CBA_fnc_addClassEventHandler;
|
||||
|
@ -18,6 +18,7 @@ class CfgPatches {
|
||||
|
||||
#include "CfgActions.hpp"
|
||||
#include "CfgMoves.hpp"
|
||||
#include "CfgExtendedAnimation.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgInGameUI.hpp"
|
||||
|
55
addons/medical_engine/functions/fnc_setUnconsciousAnim.sqf
Normal file
55
addons/medical_engine/functions/fnc_setUnconsciousAnim.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Force local unit into ragdoll / unconsciousness animation.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Is unconscious (optional, default: true) <BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* player call ace_medical_engine_fnc_setUnconsciousAnim
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_isUnconscious", true, [false]]];
|
||||
|
||||
if (!local _unit) exitWith {
|
||||
ERROR("Unit not local or null");
|
||||
};
|
||||
|
||||
_unit setUnconscious _isUnconscious;
|
||||
|
||||
if (_isUnconscious) then {
|
||||
// eject from static weapon
|
||||
if (vehicle _unit isKindOf "StaticWeapon") then {
|
||||
[_unit] call EFUNC(common,unloadPerson);
|
||||
};
|
||||
|
||||
// set animation inside vehicles
|
||||
if (vehicle _unit != _unit) then {
|
||||
private _unconAnim = _unit call EFUNC(common,getDeathAnim);
|
||||
[_unit, _unconAnim] call EFUNC(common,doAnimation);
|
||||
};
|
||||
} else {
|
||||
// reset animation inside vehicles
|
||||
if (vehicle _unit != _unit) then {
|
||||
private _awakeAnim = _unit call EFUNC(common,getAwakeAnim);
|
||||
[_unit, _awakeAnim, 2] call EFUNC(common,doAnimation);
|
||||
} else {
|
||||
// and on foot
|
||||
[_unit, "AmovPpneMstpSnonWnonDnon"] call EFUNC(common,doAnimation);
|
||||
|
||||
[{
|
||||
params ["_unit"];
|
||||
|
||||
if (animationState _unit == "unconscious" && {lifeState _unit != "INCAPACITATED"}) then {
|
||||
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
}, _unit] call CBA_fnc_execNextFrame;
|
||||
};
|
||||
};
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _configBasic = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic");
|
||||
private _configAdvanced = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced");
|
||||
private _configBasic = (configFile >> QEGVAR(medical_treatment,actions) >> "Basic");
|
||||
private _configAdvanced = (configFile >> QEGVAR(medical_treatment,actions) >> "Advanced");
|
||||
|
||||
private _fnc_compileActionsLevel = {
|
||||
params ["_config"];
|
||||
@ -26,8 +26,8 @@ private _fnc_compileActionsLevel = {
|
||||
if (isClass _x) then {
|
||||
private _displayName = getText (_x >> "displayName");
|
||||
private _category = getText (_x >> "category");
|
||||
private _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,canTreatCached)), configName _x];
|
||||
private _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,treatment)), configName _x];
|
||||
private _condition = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,canTreatCached)), configName _x, ALL_BODY_PARTS];
|
||||
private _statement = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,treatment)), configName _x, ALL_BODY_PARTS];
|
||||
_actions pushBack [_displayName, _category, compile _condition, compile _statement];
|
||||
diag_log format["ACTION: %1", [_displayName, _category, compile _condition, compile _statement]];
|
||||
};
|
||||
|
@ -15,8 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _actionsConfig = [nil, configFile >> "ACE_Medical_Treatment_Actions" >> "Basic", configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced"] select EGVAR(medical,level);
|
||||
private _allAllowedSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
|
||||
private _actionsConfig = [nil, configFile >> QEGVAR(medical_treatment,actions) >> "Basic", configFile >> QEGVAR(medical_treatment,actions) >> "Advanced"] select EGVAR(medical,level);
|
||||
private _actionPaths = ["ACE_Head", "ACE_Torso", "ACE_ArmLeft", "ACE_ArmRight", "ACE_LegLeft", "ACE_LegRight"];
|
||||
private _actionPathTexts = [
|
||||
localize ELSTRING(interaction,Head), localize ELSTRING(interaction,Torso),
|
||||
@ -38,25 +37,24 @@ private _actionPathPositions = ["spine3", "pilot", "LeftForeArm", "RightForeArm"
|
||||
default {""};
|
||||
};
|
||||
|
||||
private _allowedSelections = getArray (_config >> "allowedSelections");
|
||||
_allowedSelections = _allowedSelections apply {toLower _x};
|
||||
private _allowedBodyParts = getArray (_config >> "allowedSelections") apply {toLower _x};
|
||||
|
||||
if (_allowedSelections isEqualTo ["all"]) then {
|
||||
_allowedSelections = _allAllowedSelections;
|
||||
if (_allowedBodyParts isEqualTo ["all"]) then {
|
||||
_allowedBodyParts = ALL_BODY_PARTS apply {toLower _x};
|
||||
};
|
||||
|
||||
{
|
||||
private _selection = _x;
|
||||
private _actionPath = _actionPaths select (_allAllowedSelections find _selection);
|
||||
private _bodyPart = _x;
|
||||
private _actionPath = _actionPaths select (ALL_BODY_PARTS find toLower _bodyPart);
|
||||
|
||||
private _statement = {[_player, _target, _selection, _this select 2] call EFUNC(medical_treatment,treatment)};
|
||||
private _condition = {[_player, _target, _selection, _this select 2] call EFUNC(medical_treatment,canTreatCached)};
|
||||
private _statement = {[_player, _target, _this select 2 select 0, _this select 2 select 1] call EFUNC(medical_treatment,treatment)};
|
||||
private _condition = {[_player, _target, _this select 2 select 0, _this select 2 select 1] call EFUNC(medical_treatment,canTreatCached)};
|
||||
|
||||
private _action = [
|
||||
_actionName, _displayName, _icon, _statement, _condition, {}, configName _config, [0, 0, 0], 2, [false, true, false, false, false]
|
||||
_actionName, _displayName, _icon, _statement, _condition, {}, [_bodyPart, configName _config], [0, 0, 0], 2, [false, true, false, false, false]
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
diag_log formatText ["ACTIONS LOL: %1", [_actionName, _displayName, _icon, _statement, _condition]];
|
||||
["CAManBase", 0, [_actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
|
||||
["CAManBase", 1, ["ACE_SelfActions", "Medical", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
|
||||
} forEach _allowedSelections;
|
||||
} forEach _allowedBodyParts;
|
||||
} forEach configProperties [_actionsConfig, "isClass _x"];
|
||||
|
@ -15,3 +15,5 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
|
@ -15,7 +15,7 @@ class GVAR(Actions) {
|
||||
condition = "";
|
||||
patientStateCondition = 0;
|
||||
itemConsumed = 1;
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_bandage);
|
||||
callbackSuccess = QFUNC(treatmentBandage);
|
||||
callbackFailure = "";
|
||||
callbackProgress = "";
|
||||
|
||||
@ -34,12 +34,12 @@ class GVAR(Actions) {
|
||||
class Morphine: Bandage {
|
||||
displayName = ECSTRING(medical,Inject_Morphine);
|
||||
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
|
||||
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
|
||||
allowSelfTreatment = 1;
|
||||
category = "medication";
|
||||
treatmentTime = 8;
|
||||
items[] = {"ACE_morphine"};
|
||||
callbackSuccess = QFUNC(treatmentBasic_morphine);
|
||||
callbackSuccess = QFUNC(treatmentMorphine);
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
|
||||
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
|
||||
@ -49,21 +49,21 @@ class GVAR(Actions) {
|
||||
displayNameProgress = ECSTRING(medical,Injecting_Epinephrine);
|
||||
requiredMedic = QEGVAR(medical,medicSetting_basicEpi);
|
||||
items[] = {"ACE_epinephrine"};
|
||||
callbackSuccess = QFUNC(treatmentBasic_epipen);
|
||||
callbackSuccess = QFUNC(treatmentEpipen);
|
||||
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
|
||||
treatmentLocations[] = {QGVAR(useLocation_basicEpi)};
|
||||
};
|
||||
class BloodIV: Bandage {
|
||||
displayName = ECSTRING(medical,Transfuse_Blood);
|
||||
displayNameProgress = ECSTRING(medical,Transfusing_Blood);
|
||||
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
|
||||
allowSelfTreatment = 0;
|
||||
category = "advanced";
|
||||
requiredMedic = 1;
|
||||
treatmentTime = 12;
|
||||
items[] = {"ACE_bloodIV"};
|
||||
// callbackSuccess = QFUNC(treatmentBasic_bloodbag);
|
||||
callbackSuccess = QFUNC(treatmentIV);
|
||||
callbackSuccess = QFUNC(treatmentBloodbag);
|
||||
// callbackSuccess = QFUNC(treatmentIV);
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
litter[] = {};
|
||||
};
|
||||
@ -82,7 +82,7 @@ class GVAR(Actions) {
|
||||
treatmentLocations[] = {"All"};
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 15;
|
||||
items[] = {"ACE_bodyBag"};
|
||||
items[] = {"ACE_BodyBag"};
|
||||
condition = "!alive _target";
|
||||
callbackSuccess = QFUNC(actionPlaceInBodyBag);
|
||||
callbackFailure = "";
|
||||
@ -97,7 +97,7 @@ class GVAR(Actions) {
|
||||
displayNameProgress = ECSTRING(medical,Actions_Diagnosing);
|
||||
category = "examine";
|
||||
treatmentLocations[] = {"All"};
|
||||
allowedSelections[] = {"head", "body"};
|
||||
allowedSelections[] = {"Head", "Body"};
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 1;
|
||||
items[] = {};
|
||||
@ -114,13 +114,13 @@ class GVAR(Actions) {
|
||||
displayNameProgress = ECSTRING(medical,Actions_PerformingCPR);
|
||||
category = "advanced";
|
||||
treatmentLocations[] = {"All"};
|
||||
allowedSelections[] = {"body"};
|
||||
allowedSelections[] = {"Body"};
|
||||
allowSelfTreatment = 0;
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 15;
|
||||
items[] = {};
|
||||
condition = QUOTE(!(_target call EFUNC(common,isAwake)) && EGVAR(medical,enableRevive) > 0);
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_CPR);
|
||||
callbackSuccess = QFUNC(treatmentCPR);
|
||||
callbackFailure = "";
|
||||
callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake));
|
||||
animationPatient = "";
|
||||
@ -152,7 +152,7 @@ class GVAR(Actions) {
|
||||
condition = "";
|
||||
patientStateCondition = 0;
|
||||
// Callbacks
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_bandage);
|
||||
callbackSuccess = QFUNC(treatmentBandage);
|
||||
callbackFailure = "";
|
||||
callbackProgress = "";
|
||||
itemConsumed = 1;
|
||||
@ -193,7 +193,7 @@ class GVAR(Actions) {
|
||||
class Tourniquet: fieldDressing {
|
||||
displayName = ECSTRING(medical,Apply_Tourniquet);
|
||||
displayNameProgress = ECSTRING(medical,Applying_Tourniquet);
|
||||
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
|
||||
items[] = {"ACE_tourniquet"};
|
||||
treatmentTime = 4;
|
||||
callbackSuccess = QFUNC(treatmentTourniquet);
|
||||
@ -203,11 +203,11 @@ class GVAR(Actions) {
|
||||
class Morphine: fieldDressing {
|
||||
displayName = ECSTRING(medical,Inject_Morphine);
|
||||
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
|
||||
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
|
||||
category = "medication";
|
||||
items[] = {"ACE_morphine"};
|
||||
treatmentTime = 3;
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_medication);
|
||||
callbackSuccess = QFUNC(treatmentMedication);
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
|
||||
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
|
||||
@ -233,7 +233,7 @@ class GVAR(Actions) {
|
||||
class BloodIV: fieldDressing {
|
||||
displayName = ECSTRING(medical,Actions_Blood4_1000);
|
||||
displayNameProgress = ECSTRING(medical,Transfusing_Blood);
|
||||
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
|
||||
allowSelfTreatment = 0;
|
||||
category = "advanced";
|
||||
items[] = {"ACE_bloodIV"};
|
||||
@ -290,7 +290,7 @@ class GVAR(Actions) {
|
||||
patientStateCondition = QEGVAR(medical,useCondition_SurgicalKit);
|
||||
treatmentTime = QUOTE(count (_target getVariable [ARR_2('EGVAR(medical,bandagedWounds)',[])]) * 5);
|
||||
callbackSuccess = "";
|
||||
callbackProgress = QFUNC(treatmentAdvanced_surgicalKit_onProgress);
|
||||
callbackProgress = QFUNC(treatmentSurgicalKit_onProgress);
|
||||
itemConsumed = QEGVAR(medical,consumeItem_SurgicalKit);
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }};
|
||||
@ -304,8 +304,8 @@ class GVAR(Actions) {
|
||||
allowSelfTreatment = 0;
|
||||
requiredMedic = QEGVAR(medical,medicSetting_PAK);
|
||||
patientStateCondition = QEGVAR(medical,useCondition_PAK);
|
||||
treatmentTime = QUOTE(_target call FUNC(treatmentAdvanced_fullHealTreatmentTime));
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_fullHeal);
|
||||
treatmentTime = QUOTE(_target call FUNC(treatmentFullHealTreatmentTime));
|
||||
callbackSuccess = QFUNC(treatmentFullHeal);
|
||||
itemConsumed = QEGVAR(medical,consumeItem_PAK);
|
||||
animationPatient = "";
|
||||
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
|
||||
@ -362,13 +362,13 @@ class GVAR(Actions) {
|
||||
displayNameProgress = ECSTRING(medical,Actions_PerformingCPR);
|
||||
category = "advanced";
|
||||
treatmentLocations[] = {"All"};
|
||||
allowedSelections[] = {"body"};
|
||||
allowedSelections[] = {"Body"};
|
||||
allowSelfTreatment = 0;
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 15;
|
||||
items[] = {};
|
||||
condition = QUOTE(!(_target call EFUNC(common,isAwake)));
|
||||
callbackSuccess = QFUNC(treatmentAdvanced_CPR);
|
||||
callbackSuccess = QFUNC(treatmentCPR);
|
||||
callbackFailure = "";
|
||||
callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake));
|
||||
animationPatient = "";
|
||||
@ -388,7 +388,7 @@ class GVAR(Actions) {
|
||||
allowSelfTreatment = 0;
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 15;
|
||||
items[] = {"ACE_bodyBag"};
|
||||
items[] = {"ACE_BodyBag"};
|
||||
condition = "!alive _target";
|
||||
callbackSuccess = QFUNC(actionPlaceInBodyBag);
|
||||
callbackFailure = "";
|
||||
|
@ -13,47 +13,52 @@ PREP(addToLog);
|
||||
PREP(addToTriageCard);
|
||||
PREP(addUnloadPatientActions);
|
||||
PREP(canAccessMedicalEquipment);
|
||||
PREP(canTreat);
|
||||
PREP(canTreatCached);
|
||||
PREP(displayPatientInformation);
|
||||
PREP(displayTriageCard);
|
||||
PREP(dropDownTriageCard);
|
||||
PREP(getTriageStatus);
|
||||
PREP(handleBandageOpening);
|
||||
PREP(hasItem);
|
||||
PREP(hasItems);
|
||||
PREP(isBeingCarried);
|
||||
PREP(isBeingDragged);
|
||||
PREP(medicationEffectLoop);
|
||||
PREP(modifyMedicalAction);
|
||||
PREP(onMedicationUsage);
|
||||
|
||||
// treaments
|
||||
PREP(canTreat);
|
||||
PREP(canTreatCached);
|
||||
PREP(treatment);
|
||||
PREP(treatmentAdvanced_CPR);
|
||||
PREP(treatmentAdvanced_CPRLocal);
|
||||
PREP(treatmentAdvanced_bandage);
|
||||
PREP(treatmentAdvanced_bandageLocal);
|
||||
PREP(treatmentAdvanced_fullHeal);
|
||||
PREP(treatmentAdvanced_fullHealLocal);
|
||||
PREP(treatmentAdvanced_fullHealTreatmentTime);
|
||||
PREP(treatmentAdvanced_medication);
|
||||
PREP(treatmentAdvanced_medicationLocal);
|
||||
PREP(treatmentAdvanced_surgicalKit_onProgress);
|
||||
PREP(treatmentBasic_bloodbag);
|
||||
PREP(treatmentBasic_bloodbagLocal);
|
||||
PREP(treatmentBasic_epipen);
|
||||
PREP(treatmentBasic_morphine);
|
||||
PREP(treatmentBasic_morphineLocal);
|
||||
PREP(treatmentIV);
|
||||
PREP(treatmentIVLocal);
|
||||
PREP(treatment_success);
|
||||
PREP(treatment_failure);
|
||||
|
||||
PREP(treatmentBandage);
|
||||
PREP(treatmentBandageLocal);
|
||||
PREP(treatmentTourniquet);
|
||||
PREP(treatmentTourniquetLocal);
|
||||
PREP(treatment_failure);
|
||||
PREP(treatment_success);
|
||||
PREP(treatmentMorphine);
|
||||
PREP(treatmentMorphineLocal);
|
||||
PREP(treatmentEpipen);
|
||||
//PREP(treatmentEpipenLocal);
|
||||
PREP(treatmentMedication);
|
||||
PREP(treatmentMedicationLocal);
|
||||
PREP(treatmentBloodbag);
|
||||
PREP(treatmentBloodbagLocal);
|
||||
PREP(treatmentIV);
|
||||
PREP(treatmentIVLocal);
|
||||
PREP(treatmentCPR);
|
||||
PREP(treatmentCPRLocal);
|
||||
PREP(treatmentFullHeal);
|
||||
PREP(treatmentFullHealLocal);
|
||||
PREP(treatmentFullHealTreatmentTime);
|
||||
PREP(treatmentSurgicalKit_onProgress);
|
||||
|
||||
// items
|
||||
PREP(checkItems);
|
||||
PREP(hasItem);
|
||||
PREP(hasItems);
|
||||
PREP(useItem);
|
||||
PREP(useItems);
|
||||
|
||||
PREP(checkItems);
|
||||
|
||||
// litter
|
||||
PREP(litterCreate);
|
||||
PREP(litterHandleCreate);
|
||||
|
@ -1,11 +1,18 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
[QEGVAR(medical,initialized), {
|
||||
params ["_unit"];
|
||||
_unit call FUNC(checkItems);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
[QEGVAR(medical,initialized), FUNC(checkItems)] call CBA_fnc_addEventHandler;
|
||||
|
||||
if (isServer) then {
|
||||
[QGVAR(createLitterServer), FUNC(litterHandleCreate)] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
// treatment events
|
||||
[QGVAR(treatmentBandageLocal), FUNC(treatmentBandageLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentMorphineLocal), FUNC(treatmentMorphineLocal)] call CBA_fnc_addEventHandler;
|
||||
//[QGVAR(treatmentEpipenLocal), FUNC(treatmentEpipenLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentMedicationLocal), FUNC(treatmentMedicationLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentBloodbagLocal), FUNC(treatmentBloodbagLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentIVLocal), FUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentCPRLocal), FUNC(treatmentCPRLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(treatmentFullHealLocal), FUNC(treatmentFullHealLocal)] call CBA_fnc_addEventHandler;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -15,20 +15,20 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_selectionName"];
|
||||
TRACE_3("params",_caller,_target,_selectionName);
|
||||
params ["_caller", "_target", "_bodyPart"];
|
||||
TRACE_3("params",_caller,_target,_bodyPart);
|
||||
|
||||
// grab the required data
|
||||
private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
private _tourniquets = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
|
||||
|
||||
// Check if there is a tourniquet on this bodypart
|
||||
if ((_tourniquets select _part) == 0) exitWith {
|
||||
if ((_tourniquets select _partIndex) == 0) exitWith {
|
||||
[QEGVAR(common,displayTextStructured), [ELSTRING(medical,noTourniquetOnBodyPart), 1.5, _caller], [_caller]] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
// Removing the tourniquet
|
||||
_tourniquets set [_part, 0];
|
||||
_tourniquets set [_partIndex, 0];
|
||||
_target setVariable [QEGVAR(medical,tourniquets), _tourniquets, true];
|
||||
|
||||
// Adding the tourniquet item to the caller
|
||||
@ -37,10 +37,10 @@ _caller addItem "ACE_tourniquet";
|
||||
//Handle all injected medications now that blood is flowing:
|
||||
private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []];
|
||||
private _updatedArray = false;
|
||||
TRACE_2("meds",_part,_delayedMedications);
|
||||
TRACE_2("meds",_partIndex,_delayedMedications);
|
||||
{
|
||||
_x params ["", "", "_medPartNum"];
|
||||
if (_part == _medPartNum) then {
|
||||
if (_partIndex == _medPartNum) then {
|
||||
TRACE_1("delayed medication call after tourniquet removeal",_x);
|
||||
[QGVAR(treatmentAdvanced_medicationLocal), _x, [_target]] call CBA_fnc_targetEvent;
|
||||
_delayedMedications set [_forEachIndex, -1];
|
||||
|
@ -44,9 +44,9 @@ if (isNumber (_config >> "requiredMedic")) then {
|
||||
if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitWith {false};
|
||||
|
||||
// check selection
|
||||
private _allowedSelections = getArray (_config >> "allowedSelections");
|
||||
private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x};
|
||||
|
||||
if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitWith {false};
|
||||
if !("all" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitWith {false};
|
||||
|
||||
// check item
|
||||
private _items = getArray (_config >> "items");
|
||||
@ -88,9 +88,9 @@ if (isNumber (_config >> "patientStateCondition")) then {
|
||||
if (_patientStateCondition == 1 && {!([_target] call EFUNC(medical,isInStableCondition))}) exitWith {false};
|
||||
|
||||
// check allowed locations
|
||||
private _locations = getArray (_config >> "treatmentLocations");
|
||||
private _locations = getArray (_config >> "treatmentLocations") apply {toLower _x};
|
||||
|
||||
if ("All" in _locations) then {
|
||||
if ("all" in _locations) then {
|
||||
_locations = true;
|
||||
} else {
|
||||
private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))};
|
||||
|
@ -21,8 +21,10 @@ params ["_caller", "_target", "_selectionName", "_className"];
|
||||
if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened), false]) exitWith {
|
||||
[DFUNC(treatment), _this] call CBA_fnc_execNextFrame;
|
||||
};
|
||||
TRACE_1("banana",_this);
|
||||
|
||||
if !([_caller, _target, _selectionName, _className] call FUNC(canTreat)) exitWith {false};
|
||||
TRACE_1("can treat",_this);
|
||||
|
||||
private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className;
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* fn_heal.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentAdvanced_fullHealLocal), [_caller, _target]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
[QGVAR(treatmentAdvanced_fullHealLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
true;
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
* 4: Item <STRING>
|
||||
* 5: specific Spot <NUMBER> (default: -1)
|
||||
@ -15,19 +15,14 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]];
|
||||
params ["_caller", "_target", "_bodyPart", "_className", "_items", "", ["_specificSpot", -1]];
|
||||
|
||||
[_target, "activity", ELSTRING(medical,Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "activity_view", ELSTRING(medical,Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentAdvanced_bandageLocal), [_target, _className, _selectionName, _specificSpot]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
[QGVAR(treatmentAdvanced_bandageLocal), [_target, _className, _selectionName, _specificSpot], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
[QGVAR(treatmentBandageLocal), [_target, _className, _bodyPart, _specificSpot], _target] call CBA_fnc_targetEvent;
|
||||
|
||||
/*{
|
||||
if (_x != "") then {
|
||||
@ -35,4 +30,4 @@ if (local _target) then {
|
||||
};
|
||||
} forEach _items;*/
|
||||
|
||||
true;
|
||||
true
|
@ -5,35 +5,38 @@
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
* 1: Treatment classname <STRING>
|
||||
*
|
||||
* 2: Body part <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]];
|
||||
params ["_target", "_bandage", "_bodyPart", ["_specificClass", -1]];
|
||||
|
||||
// Ensure it is a valid bodypart
|
||||
private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
if (_part < 0) exitWith {false};
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
if (_partIndex < 0) exitWith {false};
|
||||
|
||||
// Get the open wounds for this unit
|
||||
private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
|
||||
if (count _openWounds == 0) exitWith {false}; // nothing to do here!
|
||||
|
||||
// Get the default effectiveness for the used bandage
|
||||
private _config = (configFile >> "ace_medical_treatment" >> "Bandaging");
|
||||
private _config = configFile >> "ace_medical_treatment" >> "Bandaging";
|
||||
private _effectiveness = getNumber (_config >> "effectiveness");
|
||||
|
||||
if (isClass (_config >> _bandage)) then {
|
||||
systemchat "using class: " + _bandage;
|
||||
systemchat ("using class: " + _bandage);
|
||||
_config = (_config >> _bandage);
|
||||
if (isNumber (_config >> "effectiveness")) then { _effectiveness = getNumber (_config >> "effectiveness");};
|
||||
|
||||
if (isNumber (_config >> "effectiveness")) then {
|
||||
_effectiveness = getNumber (_config >> "effectiveness");
|
||||
};
|
||||
} else {
|
||||
systemChat format["No bandage avialable"];
|
||||
systemChat "No bandage avialable";
|
||||
};
|
||||
|
||||
// Figure out which injury for this bodypart is the best choice to bandage
|
||||
@ -42,11 +45,13 @@ private _mostEffectiveSpot = 0;
|
||||
private _effectivenessFound = -1;
|
||||
private _mostEffectiveInjury = _openWounds select 0;
|
||||
private _exit = false;
|
||||
|
||||
{
|
||||
_x params ["", "_classID", "_partX"];
|
||||
_x params ["", "_classID", "_partIndexN"];
|
||||
TRACE_2("OPENWOUND: ", _target, _x);
|
||||
|
||||
// Only parse injuries that are for the selected bodypart.
|
||||
if (_partX == _part) then {
|
||||
if (_partIndexN == _partIndex) then {
|
||||
private _woundEffectiveness = _effectiveness;
|
||||
|
||||
// Select the classname from the wound classname storage
|
||||
@ -55,7 +60,8 @@ private _exit = false;
|
||||
// Check if this wound type has attributes specified for the used bandage
|
||||
if (isClass (_config >> _className)) then {
|
||||
// Collect the effectiveness from the used bandage for this wound type
|
||||
private _woundTreatmentConfig = (_config >> _className);
|
||||
private _woundTreatmentConfig = _config >> _className;
|
||||
|
||||
if (isNumber (_woundTreatmentConfig >> "effectiveness")) then {
|
||||
_woundEffectiveness = getNumber (_woundTreatmentConfig >> "effectiveness");
|
||||
};
|
||||
@ -81,6 +87,7 @@ private _exit = false;
|
||||
_mostEffectiveInjury = _x;
|
||||
};
|
||||
};
|
||||
|
||||
if (_exit) exitWith {};
|
||||
} forEach _openWounds;
|
||||
|
||||
@ -89,7 +96,7 @@ if (_effectivenessFound == -1) exitWith {}; // Seems everything is patched up on
|
||||
|
||||
// TODO refactor this part
|
||||
// Find the impact this bandage has and reduce the amount this injury is present
|
||||
private _impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) };
|
||||
private _impact = if (_mostEffectiveInjury select 3 >= _effectivenessFound) then {_effectivenessFound} else { _mostEffectiveInjury select 3 };
|
||||
_mostEffectiveInjury set [3, ((_mostEffectiveInjury select 3) - _impact) max 0];
|
||||
_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
|
||||
|
||||
@ -97,7 +104,7 @@ _target setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
// Handle the reopening of bandaged wounds
|
||||
if (_impact > 0 && {EGVAR(medical,level) >= 2} && {EGVAR(medical,enableAdvancedWounds)}) then {
|
||||
[_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening);
|
||||
[_target, _impact, _partIndex, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening);
|
||||
};
|
||||
|
||||
// If all wounds to a body part have been bandaged, reset damage to that body part to zero
|
||||
@ -118,13 +125,13 @@ if (EGVAR(medical,healHitPointAfterAdvBandage) || {EGVAR(medical,level) < 2}) th
|
||||
|
||||
// Loop through all current wounds and add up the number of unbandaged wounds on each body part.
|
||||
{
|
||||
_x params ["", "", "_bodyPart", "_numOpenWounds", "_bloodLoss"];
|
||||
_x params ["", "", "_partIndex", "_numOpenWounds", "_bloodLoss"];
|
||||
|
||||
// Use switch/case for early termination if wounded limb is found before all six are checked.
|
||||
// Number of wounds multiplied by blood loss will return zero for a fully
|
||||
// bandaged body part, not incrementing the wound counter; or it will return
|
||||
// some other number which will increment the wound counter.
|
||||
switch (_bodyPart) do {
|
||||
switch (_partIndex) do {
|
||||
// Head
|
||||
case 0: {
|
||||
_headWounds = _headWounds + (_numOpenWounds * _bloodLoss);
|
||||
@ -157,7 +164,7 @@ if (EGVAR(medical,healHitPointAfterAdvBandage) || {EGVAR(medical,level) < 2}) th
|
||||
};
|
||||
} forEach _currentWounds;
|
||||
|
||||
// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
|
||||
// ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"]
|
||||
private _bodyStatus = _target getVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]];
|
||||
|
||||
// Any body part that has no wounds is healed to full health
|
||||
@ -185,4 +192,4 @@ if (EGVAR(medical,healHitPointAfterAdvBandage) || {EGVAR(medical,level) < 2}) th
|
||||
[_target] call EFUNC(medical_damage,setDamage);
|
||||
};
|
||||
|
||||
true;
|
||||
true
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Callback when the bloodbag treatment is complete
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: Selection Name <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_treatmentClassname"];
|
||||
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentBasic_bloodbagLocal), [_target, _treatmentClassname]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
[QGVAR(treatmentBasic_bloodbagLocal), [_target, _treatmentClassname], _target] call CBA_fnc_targetEvent;
|
||||
};
|
21
addons/medical_treatment/functions/fnc_treatmentBloodbag.sqf
Normal file
21
addons/medical_treatment/functions/fnc_treatmentBloodbag.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Callback when the bloodbag treatment is complete
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_treatmentClassname"];
|
||||
|
||||
[QGVAR(treatmentBloodbagLocal), [_target, _treatmentClassname], _target] call CBA_fnc_targetEvent;
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
@ -21,10 +21,7 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
if (alive _target && {(_target getVariable [QEGVAR(medical,inCardiacArrest), false] || _target getVariable [QEGVAR(medical,inReviveState), false])}) then {
|
||||
[_target, "activity_view", ELSTRING(medical,Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentAdvanced_CPRLocal), [_caller, _target]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
[QGVAR(treatmentAdvanced_CPRLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
|
||||
[QGVAR(treatmentCPRLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
};
|
||||
true;
|
||||
|
||||
true
|
@ -18,6 +18,7 @@ params ["_caller","_target"];
|
||||
|
||||
if (_target getVariable [QEGVAR(medical,inReviveState), false]) then {
|
||||
private _reviveStartTime = _target getVariable [QEGVAR(medical,reviveStartTime),0];
|
||||
|
||||
if (_reviveStartTime > 0) then {
|
||||
_target setVariable [QEGVAR(medical,reviveStartTime), (_reviveStartTime + random(20)) min CBA_missionTime];
|
||||
};
|
||||
@ -32,4 +33,4 @@ if (EGVAR(medical,level) > 1 && {(random 1) >= 0.6}) then {
|
||||
[_target, "activity", ELSTRING(medical,Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "activity_view", ELSTRING(medical,Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||
|
||||
true;
|
||||
true
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: Selection Name <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
@ -15,6 +15,6 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target","_className"];
|
||||
params ["_caller", "_target"];
|
||||
|
||||
[_target, false] call EFUNC(medical,setUnconscious);
|
23
addons/medical_treatment/functions/fnc_treatmentFullHeal.sqf
Normal file
23
addons/medical_treatment/functions/fnc_treatmentFullHeal.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Full heal treatment
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
* 4: Item <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target"];
|
||||
|
||||
[QGVAR(treatmentFullHealLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
|
||||
|
||||
true
|
@ -1,19 +1,21 @@
|
||||
/**
|
||||
* fn_healLocal.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Handles full heal of a patient.
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target"];
|
||||
|
||||
if (alive _target) exitWith {
|
||||
|
||||
_target setVariable [QEGVAR(medical,pain), 0, true];
|
||||
_target setVariable [QEGVAR(medical,morphine), 0, true];
|
||||
_target setVariable [QEGVAR(medical,bloodVolume), 100, true];
|
||||
@ -58,6 +60,7 @@ if (alive _target) exitWith {
|
||||
|
||||
// medication
|
||||
private _allUsedMedication = _target getVariable [QEGVAR(medical,allUsedMedication), []];
|
||||
|
||||
{
|
||||
_target setVariable [_x select 0, nil];
|
||||
} forEach _allUsedMedication;
|
@ -9,16 +9,18 @@
|
||||
* treatment time <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [_target] call ace_medical_fnc_treatmentAdvanced_fullHealTreatmentTime
|
||||
* [_target] call ace_medical_treatment_fnc_treatmentFullHealTreatmentTime
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private _totalDamage = 0;
|
||||
|
||||
{
|
||||
_totalDamage = _totalDamage + _x;
|
||||
} forEach (_this getVariable [QEGVAR(medical,bodyPartStatus), []]);
|
||||
} forEach (_unit getVariable [QEGVAR(medical,bodyPartStatus), []]);
|
||||
|
||||
(10 max (_totalDamage * 10) min 120)
|
||||
10 max (_totalDamage * 10) min 120
|
@ -21,11 +21,8 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
if (_items isEqualTo []) exitWith {false};
|
||||
|
||||
_items params ["_removeItem"];
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentIVLocal), [_target, _className]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
|
||||
[QGVAR(treatmentIVLocal), [_target, _className], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", ELSTRING(medical,Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
@ -18,6 +18,7 @@
|
||||
params ["_target", "_treatmentClassname"];
|
||||
|
||||
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), 100];
|
||||
|
||||
if (_bloodVolume >= 100) exitWith {};
|
||||
|
||||
// Find the proper attributes for the used IV
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
* 4: Items Used <ARRAY>
|
||||
*
|
||||
@ -14,15 +14,14 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
TRACE_5("params",_caller,_target,_selectionName,_className,_items);
|
||||
params ["_caller", "_target", "_bodyPart", "_className", "_items"];
|
||||
TRACE_5("params",_caller,_target,_bodyPart,_className,_items);
|
||||
|
||||
private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
|
||||
[QGVAR(treatmentAdvanced_medicationLocal), [_target, _className, _part], [_target]] call CBA_fnc_targetEvent;
|
||||
[QGVAR(treatmentMedicationLocal), [_target, _className, _partIndex], [_target]] call CBA_fnc_targetEvent;
|
||||
|
||||
{
|
||||
if (_x != "") then {
|
||||
@ -32,5 +31,4 @@ private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
};
|
||||
} forEach _items;
|
||||
|
||||
|
||||
true;
|
||||
true
|
@ -12,18 +12,20 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target", "_className", "_partNumber"];
|
||||
TRACE_3("params",_target,_className,_partNumber);
|
||||
|
||||
private _tourniquets = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
|
||||
if ((_tourniquets select _partNumber) > 0) exitWith {
|
||||
|
||||
if (_tourniquets select _partNumber > 0) exitWith {
|
||||
TRACE_1("unit has tourniquets blocking blood flow on injection site",_tourniquets);
|
||||
private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []];
|
||||
|
||||
_delayedMedications pushBack _this;
|
||||
_target setVariable [QGVAR(occludedMedications), _delayedMedications, true];
|
||||
|
||||
true
|
||||
};
|
||||
|
||||
@ -44,6 +46,7 @@ private _viscosityChange = getNumber (_medicationConfig >> "viscosityChange");
|
||||
private _hrCallback = getText (_medicationConfig >> "hrCallback");
|
||||
|
||||
private _inCompatableMedication = [];
|
||||
|
||||
if (isClass (_medicationConfig >> _className)) then {
|
||||
_medicationConfig = (_medicationConfig >> _className);
|
||||
if (isNumber (_medicationConfig >> "painReduce")) then { _painReduce = getNumber (_medicationConfig >> "painReduce");};
|
||||
@ -56,15 +59,20 @@ if (isClass (_medicationConfig >> _className)) then {
|
||||
if (isNumber (_medicationConfig >> "viscosityChange")) then { _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); };
|
||||
if (isText (_medicationConfig >> "hrCallback")) then { _hrCallback = getText (_medicationConfig >> "hrCallback"); };
|
||||
};
|
||||
|
||||
if (isNil _hrCallback) then {
|
||||
_hrCallback = compile _hrCallback;
|
||||
} else {
|
||||
_hrCallback = missionNamespace getVariable _hrCallback;
|
||||
};
|
||||
if (!(_hrCallback isEqualType {})) then {_hrCallback = {TRACE_1("callback was NOT code",_hrCallback)};};
|
||||
|
||||
if !(_hrCallback isEqualType {}) then {
|
||||
_hrCallback = {TRACE_1("callback was NOT code",_hrCallback)};
|
||||
};
|
||||
|
||||
// Adjust the heart rate based upon config entry
|
||||
private _heartRate = _target getVariable [QEGVAR(medical,heartRate), 70];
|
||||
|
||||
if (alive _target) then {
|
||||
if (_heartRate > 0) then {
|
||||
if (_heartRate <= 45) then {
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: Selection Name <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
@ -13,14 +13,10 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define MORPHINEHEAL 0.4
|
||||
|
||||
params ["_caller", "_target"];
|
||||
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentBasic_morphineLocal), [_target]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
[QGVAR(treatmentBasic_morphineLocal), [_target], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
[QGVAR(treatmentMorphineLocal), [_target], _target] call CBA_fnc_targetEvent;
|
@ -3,16 +3,15 @@
|
||||
* Local callback when the morphine treatment is complete
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 0: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define MORPHINEHEAL 0.4
|
||||
|
||||
params ["_target"];
|
@ -25,7 +25,7 @@ private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), [
|
||||
if (count _bandagedWounds == 0) exitWith { false };
|
||||
|
||||
//Has enough time elapsed that we can close another wound?
|
||||
if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then {
|
||||
if (_totalTime - _elapsedTime <= (count _bandagedWounds - 1) * 5) then {
|
||||
_bandagedWounds deleteAt 0;
|
||||
_target setVariable [QEGVAR(medical,bandagedWounds), _bandagedWounds, true];
|
||||
};
|
@ -5,41 +5,35 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment class name <STRING>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
params ["_caller", "_target", "_bodyPart", "_className", "_items"];
|
||||
|
||||
if (count _items == 0) exitWith {false};
|
||||
|
||||
private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
if (_part == 0 || _part == 1) exitWith {
|
||||
// [QEGVAR(common,displayTextStructured), ["You cannot apply a CAT on this body part!"], [_caller]] call CBA_fnc_targetEvent;
|
||||
false;
|
||||
};
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
|
||||
if (_partIndex == 0 || _partIndex == 1) exitWith {false};
|
||||
|
||||
private _tourniquets = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
|
||||
if ((_tourniquets select _part) > 0) exitWith {
|
||||
|
||||
if (_tourniquets select _partIndex > 0) exitWith {
|
||||
_output = "There is already a tourniquet on this body part!"; // TODO localization
|
||||
[QEGVAR(common,displayTextStructured), [_output, 1.5, _caller], [_caller]] call CBA_fnc_targetEvent;
|
||||
false;
|
||||
false
|
||||
};
|
||||
|
||||
private _removeItem = _items select 0;
|
||||
if (local _target) then {
|
||||
[QGVAR(treatmentTourniquetLocal), [_target, _removeItem, _selectionName]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
|
||||
[QGVAR(treatmentTourniquetLocal), [_target, _removeItem, _selectionName], _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", ELSTRING(medical,Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
* 1: Item used classname <STRING>
|
||||
* 2: Body part <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -13,14 +14,16 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target", "_tourniquetItem", "_selectionName"];
|
||||
params ["_target", "_tourniquetItem", "_bodyPart"];
|
||||
|
||||
//If we're not already tracking vitals, start:
|
||||
[_target] call EFUNC(medical,addVitalLoop);
|
||||
|
||||
private _part = [_selectionName] call EFUNC(medical,selectionNameToNumber);
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
|
||||
// Place a tourniquet on the bodypart
|
||||
private _tourniquets = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
|
||||
_tourniquets set [_part, CBA_missionTime];
|
||||
|
||||
_tourniquets set [_partIndex, CBA_missionTime];
|
||||
|
||||
_target setVariable [QEGVAR(medical,tourniquets), _tourniquets, true];
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 2: Body part <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
* 4: Items available <ARRAY<STRING>>
|
||||
*
|
||||
@ -17,7 +17,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_args"];
|
||||
_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"];
|
||||
_args params ["_caller", "_target", "_bodyPart", "_className", "_items", "_usersOfItems"];
|
||||
|
||||
// switch to end anim immediately
|
||||
private _endInAnim = _caller getVariable QGVAR(endInAnim);
|
||||
@ -50,10 +50,10 @@ if !(_callback isEqualType {}) then {
|
||||
|
||||
//Get current blood loose on limb (for "bloody" litter)
|
||||
private _bloodLossOnSelection = 0;
|
||||
private _partNumber = ([_selectionName] call EFUNC(medical,selectionNameToNumber)) max 0;
|
||||
private _partNumber = (ALL_BODY_PARTS find toLower _bodyPart) max 0;
|
||||
|
||||
// Add all bleeding from wounds on selection
|
||||
private _openWounds = _target getvariable [QGVAR(openWounds), []];
|
||||
private _openWounds = _target getvariable [QEGVAR(medical,openWounds), []];
|
||||
{
|
||||
_x params ["", "", "_selectionX", "_amountOf", "_percentageOpen"];
|
||||
if (_selectionX == _partNumber) then {
|
||||
@ -71,4 +71,4 @@ if (!(_target getVariable [QGVAR(addedToUnitLoop),false])) then {
|
||||
[_target] call FUNC(addVitalLoop);
|
||||
};
|
||||
|
||||
["ace_treatmentSucceded", [_caller, _target, _selectionName, _className]] call CBA_fnc_localEvent;
|
||||
["ace_treatmentSucceded", [_caller, _target, _bodyPart, _className]] call CBA_fnc_localEvent;
|
||||
|
@ -2,9 +2,8 @@
|
||||
#define COMPONENT_BEAUTIFIED Medical Treatment
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
#define DEBUG_MODE_FULL
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define CBA_DEBUG_SYNCHRONOUS
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_MEDICAL_TREATMENT
|
||||
@ -17,4 +16,6 @@
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
|
||||
#define CUR_LEVEL (["Basic", "Advanced"] select (EGVAR(medical,level) >= 2))
|
||||
|
Loading…
Reference in New Issue
Block a user