mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code Cleanup Medical Module (Part 4).
This commit is contained in:
parent
2d4ef16429
commit
19dd55147a
@ -7,16 +7,14 @@
|
||||
* 1: object belonging to the caller <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private [ "_target", "_caller"];
|
||||
_target = _this select 0;
|
||||
_caller = _this select 1;
|
||||
params [ "_target", "_caller"];
|
||||
|
||||
if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information
|
||||
if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {};
|
||||
|
@ -7,15 +7,15 @@
|
||||
* 0: The unit that will be put in cardiac arrest state <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
* None
|
||||
*
|
||||
* Public: yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_timeInCardiacArrest"];
|
||||
_unit = _this select 0;
|
||||
private "_timeInCardiacArrest";
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {};
|
||||
_unit setvariable [QGVAR(inCardiacArrest), true,true];
|
||||
@ -28,20 +28,17 @@ _timeInCardiacArrest = 120 + round(random(600));
|
||||
|
||||
[{
|
||||
private ["_args","_unit","_startTime","_timeInCardiacArrest","_heartRate"];
|
||||
_args = _this select 0;
|
||||
_unit = _args select 0;
|
||||
_startTime = _args select 1;
|
||||
_timeInCardiacArrest = _args select 2;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_startTime", "_timeInCardiacArrest"];
|
||||
|
||||
_heartRate = _unit getvariable [QGVAR(heartRate), 80];
|
||||
if (_heartRate > 0 || !alive _unit) exitwith {
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setvariable [QGVAR(inCardiacArrest), nil,true];
|
||||
};
|
||||
if (ACE_time - _startTime >= _timeInCardiacArrest) exitwith {
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setvariable [QGVAR(inCardiacArrest), nil,true];
|
||||
[_unit] call FUNC(setDead);
|
||||
};
|
||||
}, 1, [_unit, ACE_time, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* 0: The unit that will be killed <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
* None
|
||||
*
|
||||
* Public: yes
|
||||
*/
|
||||
@ -14,11 +14,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_force", "_reviveVal", "_lifesLeft"];
|
||||
_unit = _this select 0;
|
||||
_force = false;
|
||||
if (count _this >= 2) then {
|
||||
_force = _this select 1;
|
||||
};
|
||||
params ["_unit", ["_force", false]];
|
||||
|
||||
if (!alive _unit) exitwith{true};
|
||||
if (!local _unit) exitwith {
|
||||
@ -44,13 +40,13 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal ==
|
||||
[_unit, true] call FUNC(setUnconscious);
|
||||
|
||||
[{
|
||||
private ["_args","_unit","_startTime"];
|
||||
_args = _this select 0;
|
||||
_unit = _args select 0;
|
||||
private "_startTime";
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit"];
|
||||
_startTime = _unit getvariable [QGVAR(reviveStartTime), 0];
|
||||
|
||||
if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith {
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setvariable [QGVAR(inReviveState), nil, true];
|
||||
_unit setvariable [QGVAR(reviveStartTime), nil];
|
||||
[_unit, true] call FUNC(setDead);
|
||||
@ -64,7 +60,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal ==
|
||||
};
|
||||
|
||||
_unit setvariable [QGVAR(reviveStartTime), nil];
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (GVAR(level) >= 2) then {
|
||||
if (_unit getvariable [QGVAR(heartRate), 60] > 0) then {
|
||||
|
@ -7,10 +7,10 @@
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: HitPoint <STRING>
|
||||
* 2: Damage <NUMBER>
|
||||
* 3: Disable overall damage adjustment (optional) <BOOL>
|
||||
* 3: Disable overall damage adjustment <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
@ -22,10 +22,7 @@
|
||||
#define ARMDAMAGETRESHOLD2 1.7
|
||||
|
||||
private ["_unit", "_selection", "_damage", "_selections", "_damages", "_damageOld", "_damageSumOld", "_damageNew", "_damageSumNew", "_damageFinal", "_armdamage", "_legdamage"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_selection = _this select 1;
|
||||
_damage = _this select 2;
|
||||
params ["_unit", "_selection", "_damage", ["_disalbed", false]];
|
||||
|
||||
// Unit isn't local, give function to machine where it is.
|
||||
if !(local _unit) exitWith {
|
||||
@ -33,7 +30,7 @@ if !(local _unit) exitWith {
|
||||
};
|
||||
|
||||
// Check if overall damage adjustment is disabled
|
||||
if (count _this > 3 && {_this select 3}) exitWith {
|
||||
if (_disalbed) exitWith {
|
||||
_unit setHitPointDamage [_selection, _damage];
|
||||
};
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit that will be put in an unconscious state <OBJECT>
|
||||
* 1: Set unconsciouns <BOOL> <OPTIONAL>
|
||||
* 2: Minimum unconscious ACE_time <NUMBER> <OPTIONAL>
|
||||
* 3: Force AI Unconscious (skip random death chance) <BOOL> <OPTIONAL>
|
||||
* 1: Set unconsciouns <BOOL> (default: true)
|
||||
* 2: Minimum unconscious ACE_time <NUMBER> (default: (round(random(10)+5)))
|
||||
* 3: Force AI Unconscious (skip random death chance) <BOOL> (default: false)
|
||||
*
|
||||
* ReturnValue:
|
||||
* nil
|
||||
@ -19,13 +19,10 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define DEFAULT_DELAY (round(random(10)+5))
|
||||
#define DEFAULT_DELAY (round(random(10)+5))
|
||||
|
||||
private ["_unit", "_set", "_animState", "_originalPos", "_startingTime","_minWaitingTime", "_force", "_isDead"];
|
||||
_unit = _this select 0;
|
||||
_set = if (count _this > 1) then {_this select 1} else {true};
|
||||
_minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY};
|
||||
_force = if (count _this > 3) then {_this select 3} else {false};
|
||||
private ["_animState", "_originalPos", "_startingTime", "_isDead"];
|
||||
params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]];
|
||||
|
||||
// No change, fuck off. (why is there no xor?)
|
||||
if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {};
|
||||
@ -97,8 +94,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
|
||||
_anim = [_unit] call EFUNC(common,getDeathAnim);
|
||||
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
|
||||
[{
|
||||
_unit = _this select 0;
|
||||
_anim = _this select 1;
|
||||
params ["_unit", "_anim"];
|
||||
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
|
||||
[_unit, _anim, 2, true] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
@ -16,11 +16,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
private ["_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"];
|
||||
params ["_caller", "_target", "_selectionName", "_className"];
|
||||
|
||||
// If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine
|
||||
if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith {
|
||||
@ -107,7 +104,7 @@ if ("All" in _locations) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _locations;
|
||||
} foreach _locations;
|
||||
};
|
||||
|
||||
if !(_return) exitwith {false};
|
||||
@ -180,7 +177,7 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
|
||||
TRACE_1("Weapon Deployed, breaking out first",(stance _caller));
|
||||
[_caller, "", 0] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
|
||||
if ((stance _caller) == "STAND") then {
|
||||
switch (_wpn) do {//If standing, end in a crouched animation based on their current weapon
|
||||
case ("rfl"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];};
|
||||
|
@ -16,12 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
|
||||
if (alive _target && {(_target getvariable [QGVAR(inCardiacArrest), false] || _target getvariable [QGVAR(inReviveState), false])}) then {
|
||||
[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
@ -14,9 +14,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller","_target", "_reviveStartTime"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
private "_reviveStartTime";
|
||||
param ["_caller","_target"];
|
||||
|
||||
if (_target getvariable [QGVAR(inReviveState), false]) then {
|
||||
_reviveStartTime = _target getvariable [QGVAR(reviveStartTime),0];
|
||||
|
@ -7,7 +7,8 @@
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* 4: Item <STRING>
|
||||
* 5: specific Spot <NUMBER> (default: -1)
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
@ -16,15 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_items", "_specificSpot"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
|
||||
_specificSpot = if (count _this > 6) then {_this select 6} else {-1};
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items", ["_specificSpot", -1]];
|
||||
|
||||
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
||||
_this call FUNC(treatmentBasic_bandage);
|
||||
|
@ -15,19 +15,16 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_bandage", "_part", "_selectionName", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_specificClass", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"];
|
||||
_target = _this select 0;
|
||||
_bandage = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_specificClass = if (count _this > 3) then {_this select 3} else { -1 };
|
||||
private ["_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"];
|
||||
params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]];
|
||||
|
||||
// Ensure it is a valid bodypart
|
||||
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
||||
if (_part < 0) exitwith {};
|
||||
if (_part < 0) exitwith {false};
|
||||
|
||||
// Get the open wounds for this unit
|
||||
_openWounds = _target getvariable [QGVAR(openWounds), []];
|
||||
if (count _openWounds == 0) exitwith {}; // nothing to do here!
|
||||
if (count _openWounds == 0) exitwith {false}; // nothing to do here!
|
||||
|
||||
// Get the default effectiveness for the used bandage
|
||||
_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging");
|
||||
@ -43,10 +40,10 @@ _effectivenessFound = -1;
|
||||
_mostEffectiveInjury = _openWounds select 0;
|
||||
_exit = false;
|
||||
{
|
||||
params ["", "_classID", "_partX"];
|
||||
// Only parse injuries that are for the selected bodypart.
|
||||
if (_x select 2 == _part) then {
|
||||
if (_partX == _part) then {
|
||||
_woundEffectivenss = _effectiveness;
|
||||
_classID = (_x select 1);
|
||||
|
||||
// Select the classname from the wound classname storage
|
||||
_className = GVAR(woundClassNames) select _classID;
|
||||
@ -74,7 +71,7 @@ _exit = false;
|
||||
};
|
||||
};
|
||||
if (_exit) exitwith {};
|
||||
}foreach _openWounds;
|
||||
} foreach _openWounds;
|
||||
|
||||
if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on this body part already..
|
||||
|
||||
|
@ -10,12 +10,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_caller", "_selectionName", "_className", "_items"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
params ["_target", "_caller", "_selectionName", "_className", "_items"];
|
||||
|
||||
// TODO replace by event system
|
||||
[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
@ -10,9 +10,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_caller", "_allUsedMedication"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
private "_allUsedMedication";
|
||||
params ["_caller", "_target"];
|
||||
|
||||
if (alive _target) exitwith {
|
||||
|
||||
@ -64,7 +63,7 @@ if (alive _target) exitwith {
|
||||
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];
|
||||
{
|
||||
_target setvariable [_x select 0, nil];
|
||||
}foreach _allUsedMedication;
|
||||
} foreach _allUsedMedication;
|
||||
|
||||
// Resetting damage
|
||||
_target setDamage 0;
|
||||
|
@ -15,12 +15,12 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_totalDamage"];
|
||||
_target = _this;
|
||||
private "_totalDamage";
|
||||
|
||||
_totalDamage = 0;
|
||||
|
||||
{
|
||||
_totalDamage = _totalDamage + _x;
|
||||
} forEach (_target getVariable [QGVAR(bodyPartStatus), []]);
|
||||
} forEach (_this getVariable [QGVAR(bodyPartStatus), []]);
|
||||
|
||||
(10 max (_totalDamage * 10) min 120)
|
||||
|
@ -17,12 +17,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
||||
@ -32,7 +27,7 @@ _items = _this select 4;
|
||||
[_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
||||
[_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
||||
};
|
||||
}foreach _items;
|
||||
} foreach _items;
|
||||
|
||||
|
||||
true;
|
||||
|
@ -15,9 +15,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"];
|
||||
_target = _this select 0;
|
||||
_className = _this select 1;
|
||||
private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"];
|
||||
params ["_target", "_className"];
|
||||
|
||||
// We have added a new dose of this medication to our system, so let's increase it
|
||||
_varName = format[QGVAR(%1_inSystem), _className];
|
||||
|
@ -1,23 +1,30 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Handles treatment via surgical kit per frame.
|
||||
* Handles treatment via surgical kit per frame
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0: Caller <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Elapsed Time <NUMBER>
|
||||
* 2: Total Time <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_args", "_target", "_caller", "_elapsedTime", "_totalTime", "_bandagedWounds"];
|
||||
_args = _this select 0;
|
||||
_caller = _args select 0;
|
||||
_target = _args select 1;
|
||||
_elapsedTime = _this select 1;
|
||||
_totalTime = _this select 2;
|
||||
|
||||
private "_bandagedWounds";
|
||||
params ["_args", "_elapsedTime", "_totalTime"];
|
||||
_args params ["_caller", "_target"];
|
||||
|
||||
_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
|
||||
//In case two people stitch up one patient and the last wound has already been closed we can stop already
|
||||
if (count _bandagedWounds == 0) exitWith {false};
|
||||
if (count _bandagedWounds == 0) exitWith { false };
|
||||
|
||||
//Has enough time elapsed that we can close another wound?
|
||||
if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then {
|
||||
@ -25,4 +32,4 @@ if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then {
|
||||
_target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true];
|
||||
};
|
||||
|
||||
true
|
||||
true
|
||||
|
@ -9,7 +9,7 @@
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -17,11 +17,8 @@
|
||||
#include "script_component.hpp"
|
||||
#define BANDAGEHEAL 0.8
|
||||
|
||||
private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point", "_damage"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selection = _this select 2;
|
||||
_className = _this select 3;
|
||||
private ["_hitSelections", "_hitPoints", "_point", "_damage"];
|
||||
params ["_caller", "_target", "_selection", "_className"];
|
||||
|
||||
if (_selection == "all") then {
|
||||
_target setDamage ((damage _target - BANDAGEHEAL) max 0);
|
||||
|
@ -9,16 +9,13 @@
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_treatmentClassname"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_treatmentClassname = _this select 3;
|
||||
params ["_caller", "_target", "_treatmentClassname"];
|
||||
|
||||
[[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "script_component.hpp"
|
||||
#define BLOODBAGHEAL 70
|
||||
|
||||
PARAMS_2(_target,_treatmentClassname);
|
||||
params ["_target", "_treatmentClassname"];
|
||||
|
||||
private ["_blood", "_bloodAdded"];
|
||||
|
||||
|
@ -9,17 +9,13 @@
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target","_className"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_className = _this select 3;
|
||||
params ["_caller", "_target","_className"];
|
||||
|
||||
[_target, false] call FUNC(setUnconscious);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -17,8 +17,6 @@
|
||||
#include "script_component.hpp"
|
||||
#define MORPHINEHEAL 0.4
|
||||
|
||||
private ["_caller", "_target"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_caller", "_target"];
|
||||
|
||||
[[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -15,8 +15,8 @@
|
||||
#include "script_component.hpp"
|
||||
#define MORPHINEHEAL 0.4
|
||||
|
||||
private ["_target", "_morphine", "_pain"];
|
||||
_target = _this select 0;
|
||||
private ["_morphine", "_pain"];
|
||||
params ["_target"];
|
||||
|
||||
// reduce pain, pain sensitivity
|
||||
_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1;
|
||||
|
@ -8,26 +8,23 @@
|
||||
* 2: SelectionName <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* <BOOL>
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
private "_removeItem";
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
if (count _items == 0) exitwith {false};
|
||||
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||
|
||||
true
|
||||
|
@ -8,16 +8,15 @@
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_treatmentClassname", "_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"];
|
||||
_target = _this select 0;
|
||||
_treatmentClassname = _this select 1;
|
||||
private ["_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"];
|
||||
params ["_target", "_treatmentClassname"];
|
||||
|
||||
_bloodVolume = _target getvariable [QGVAR(bloodVolume), 100];
|
||||
if (_bloodVolume >= 100) exitwith {};
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* <BOOL>
|
||||
* Succesful treatment started <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -24,7 +24,7 @@ _selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
if (count _items == 0) exitwith {false};
|
||||
|
||||
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
||||
if (_part == 0 || _part == 1) exitwith {
|
||||
@ -47,4 +47,4 @@ _removeItem = _items select 0;
|
||||
[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||
|
||||
|
||||
true;
|
||||
true
|
||||
|
@ -7,16 +7,14 @@
|
||||
* 1: Item used classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_tourniquetItem", "_part", "_tourniquets", "_applyingTo", "_selectionName"];
|
||||
_target = _this select 0;
|
||||
_tourniquetItem = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
private ["_tourniquetItem", "_part", "_applyingTo"];
|
||||
params ["_target", "_tourniquets", "_selectionName"];
|
||||
|
||||
[_target] call FUNC(addToInjuredCollection);
|
||||
|
||||
@ -29,24 +27,21 @@ _tourniquets set[_part, _applyingTo];
|
||||
_target setvariable [QGVAR(tourniquets), _tourniquets, true];
|
||||
|
||||
[{
|
||||
private ["_args","_target","_applyingTo","_part", "_tourniquets", "_time"];
|
||||
_args = _this select 0;
|
||||
_target = _args select 0;
|
||||
_applyingTo = _args select 1;
|
||||
_part = _args select 2;
|
||||
_time = _args select 3;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_target", "_applyingTo", "_part", "_time"];
|
||||
|
||||
if (!alive _target) exitwith {
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] 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;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (ACE_time - _time > 120) then {
|
||||
_target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005];
|
||||
};
|
||||
}, 5, [_target, _applyingTo, _part, ACE_time] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true;
|
||||
true
|
||||
|
@ -10,21 +10,16 @@
|
||||
* 4: Items available <ARRAY<STRING>>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect", "_lastAnim"];
|
||||
|
||||
_args = _this select 0;
|
||||
_caller = _args select 0;
|
||||
_target = _args select 1;
|
||||
_selectionName = _args select 2;
|
||||
_className = _args select 3;
|
||||
_usersOfItems = _args select 5;
|
||||
private ["_config", "_callback", "_weaponSelect", "_lastAnim"];
|
||||
params ["_args"];
|
||||
_args params ["_caller", "_target", "_selectionName", "_className", "_usersOfItems"];
|
||||
|
||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||
@ -33,14 +28,15 @@ if (vehicle _caller == _caller) then {
|
||||
_lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""];
|
||||
//Don't play another medic animation (when player is rapidily treating)
|
||||
TRACE_2("Reseting to old animation", animationState player, _lastAnim);
|
||||
switch (true) do {
|
||||
case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"};
|
||||
case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"};
|
||||
case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"};
|
||||
case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
|
||||
case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
|
||||
switch _lastAnim do {
|
||||
case "AinvPknlMstpSlayWrflDnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"};
|
||||
case "AinvPpneMstpSlayWrflDnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"};
|
||||
case "AinvPknlMstpSlayWnonDnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"};
|
||||
case "AinvPpneMstpSlayWpstDnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
|
||||
case "AinvPknlMstpSlayWpstDnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
|
||||
};
|
||||
[_caller, _lastAnim, 1] call EFUNC(common,doAnimation);
|
||||
[_caller, _lastAnim, 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||
|
||||
@ -57,8 +53,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "")
|
||||
};
|
||||
|
||||
{
|
||||
(_x select 0) addItem (_x select 1);
|
||||
}foreach _usersOfItems;
|
||||
_x params ["_unit", "_item"];
|
||||
_unit addItem _item;
|
||||
} foreach _usersOfItems;
|
||||
|
||||
// Record specific callback
|
||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||
@ -67,10 +64,10 @@ if (GVAR(level) >= 2) then {
|
||||
};
|
||||
|
||||
_callback = getText (_config >> "callbackFailure");
|
||||
if (isNil _callback) then {
|
||||
_callback = compile _callback;
|
||||
_callback = if (isNil _callback) then {
|
||||
compile _callback
|
||||
} else {
|
||||
_callback = missionNamespace getvariable _callback;
|
||||
missionNamespace getvariable _callback
|
||||
};
|
||||
|
||||
_args call _callback;
|
||||
|
@ -10,19 +10,16 @@
|
||||
* 4: Items available <ARRAY<STRING>>
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect", "_lastAnim"];
|
||||
_args = _this select 0;
|
||||
_caller = _args select 0;
|
||||
_target = _args select 1;
|
||||
_selectionName = _args select 2;
|
||||
_className = _args select 3;
|
||||
private ["_config", "_callback", "_weaponSelect", "_lastAnim"];
|
||||
params ["_args"];
|
||||
_args params ["_caller", "_target","_selectionName","_className"];
|
||||
|
||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||
@ -31,12 +28,12 @@ if (vehicle _caller == _caller) then {
|
||||
_lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""];
|
||||
//Don't play another medic animation (when player is rapidily treating)
|
||||
TRACE_2("Reseting to old animation", animationState player, _lastAnim);
|
||||
switch (true) do {
|
||||
case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"};
|
||||
case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"};
|
||||
case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"};
|
||||
case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
|
||||
case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
|
||||
switch _lastAnim do {
|
||||
case "AinvPknlMstpSlayWrflDnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"};
|
||||
case "AinvPpneMstpSlayWrflDnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"};
|
||||
case "AinvPknlMstpSlayWnonDnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"};
|
||||
case "AinvPpneMstpSlayWpstDnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
|
||||
case "AinvPknlMstpSlayWpstDnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
|
||||
};
|
||||
[_caller, _lastAnim, 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
@ -13,21 +13,15 @@
|
||||
* 1: PFEH ID <NUMBER>
|
||||
*
|
||||
* ReturnValue:
|
||||
* nil
|
||||
* None
|
||||
*
|
||||
* Public: yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_minWaitingTime", "_slotInfo", "_hasMovedOut", "_parachuteCheck", "_args", "_originalPos", "_startingTime", "_awakeInVehicleAnimation", "_oldVehicleAnimation", "_vehicle"];
|
||||
_args = _this select 0;
|
||||
_unit = _args select 0;
|
||||
_originalPos = _args select 1;
|
||||
_startingTime = _args select 2;
|
||||
_minWaitingTime = _args select 3;
|
||||
_hasMovedOut = _args select 4;
|
||||
_parachuteCheck = _args select 5;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_originalPos", "_startingTime", "_minWaitingTime", "_hasMovedOut", "_parachuteCheck"];
|
||||
|
||||
if (!alive _unit) exitwith {
|
||||
if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then {
|
||||
@ -45,7 +39,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;
|
||||
[_idPFH] 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
|
||||
@ -57,7 +51,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith {
|
||||
TRACE_1("Removing fake weapon [on wakeup]",_unit);
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
|
||||
|
||||
if (vehicle _unit == _unit) then {
|
||||
if (animationState _unit == "AinjPpneMstpSnonWrflDnon") then {
|
||||
[_unit,"AinjPpneMstpSnonWrflDnon_rolltofront", 2] call EFUNC(common,doAnimation);
|
||||
@ -99,7 +93,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;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (!_hasMovedOut) then {
|
||||
// Reset the unit back to the previous captive state.
|
||||
@ -132,7 +126,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;
|
||||
[_idPFH] 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
|
||||
|
@ -8,17 +8,16 @@
|
||||
* 2: Item <STRING>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
* 0: success <BOOL>
|
||||
* 1: Unit <OBJECT>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_medic", "_patient", "_item", "_return","_crew"];
|
||||
_medic = _this select 0;
|
||||
_patient = _this select 1;
|
||||
_item = _this select 2;
|
||||
private ["_return","_crew"];
|
||||
params ["_medic", "_patient", "_item"];
|
||||
|
||||
if (isnil QGVAR(setting_allowSharedEquipment)) then {
|
||||
GVAR(setting_allowSharedEquipment) = true;
|
||||
@ -42,7 +41,7 @@ if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic})
|
||||
_return = [true, _x];
|
||||
[[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
}foreach _crew;
|
||||
} foreach _crew;
|
||||
};
|
||||
|
||||
_return;
|
||||
_return
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 2: Items <ARRAY<STRING>>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
@ -16,9 +16,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_medic", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"];
|
||||
_medic = _this select 0;
|
||||
_patient = _this select 1;
|
||||
_items = _this select 2;
|
||||
params ["_medic", "_patient", "_items"];
|
||||
|
||||
_itemsUsedBy = [];
|
||||
{
|
||||
@ -27,7 +25,7 @@ _itemsUsedBy = [];
|
||||
{
|
||||
_itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem);
|
||||
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
|
||||
}foreach _x;
|
||||
} foreach _x;
|
||||
};
|
||||
|
||||
// handle required item
|
||||
@ -35,6 +33,6 @@ _itemsUsedBy = [];
|
||||
_itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem);
|
||||
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
|
||||
};
|
||||
}foreach _items;
|
||||
} foreach _items;
|
||||
|
||||
[count _items == count _itemsUsedBy, _itemsUsedBy];
|
||||
|
Loading…
Reference in New Issue
Block a user