Replace execRemoteFnc in ace_medical

This commit is contained in:
esteldunedain 2016-02-17 22:54:43 -03:00
parent c456e1a631
commit 88eae19646
19 changed files with 94 additions and 24 deletions

View File

@ -251,7 +251,7 @@ call FUNC(checkFiles);
// Publish all settings data after all configs and modules are read
publicVariable QGVAR(settings);
};
// Load user settings from profile
if (hasInterface) then {
call FUNC(loadSettingsFromProfile);
@ -476,6 +476,8 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
};
}] call FUNC(addEventhandler);
["useItem", DFUNC(useItem)] call FUNC(addEventHandler);
//////////////////////////////////////////////////
// Add various canInteractWith conditions

View File

@ -12,7 +12,23 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"];
//Treatment EventHandlers:
["medical_advMedication", FUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler);
["actionCheckBloodPressureLocal", DFUNC(actionCheckBloodPressureLocal)] call EFUNC(common,addEventHandler);
["actionCheckPulseLocal", DFUNC(actionCheckPulseLocal)] call EFUNC(common,addEventHandler);
["addToInjuredCollection", DFUNC(addToInjuredCollection)] call EFUNC(common,addEventHandler);
["addToMedicalLog", DFUNC(addToLog)] call EFUNC(common,addEventHandler);
["addToTriageList", DFUNC(addToTriageList)] call EFUNC(common,addEventHandler);
["setDead", DFUNC(setDead)] call EFUNC(common,addEventHandler);
["setHitPointDamage", DFUNC(setHitPointDamage)] call EFUNC(common,addEventHandler);
["setUnconscious", DFUNC(setUnconscious)] call EFUNC(common,addEventHandler);
["treatmentAdvanced_bandageLocal", DFUNC(treatmentAdvanced_bandageLocal)] call EFUNC(common,addEventHandler);
["treatmentAdvanced_CPRLocal", DFUNC(treatmentAdvanced_CPRLocal)] call EFUNC(common,addEventHandler);
["treatmentAdvanced_fullHealLocal", DFUNC(treatmentAdvanced_fullHealLocal)] call EFUNC(common,addEventHandler);
["treatmentAdvanced_medicationLocal", DFUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler);
["treatmentBasic_bandageLocal", DFUNC(treatmentBasic_bandageLocal)] call EFUNC(common,addEventHandler);
["treatmentBasic_bloodbagLocal", DFUNC(treatmentBasic_bloodbagLocal)] call EFUNC(common,addEventHandler);
["treatmentBasic_morphineLocal", DFUNC(treatmentBasic_morphineLocal)] call EFUNC(common,addEventHandler);
["treatmentIVLocal", DFUNC(treatmentIVLocal)] call EFUNC(common,addEventHandler);
["treatmentTourniquetLocal", DFUNC(treatmentTourniquetLocal)] call EFUNC(common,addEventHandler);
["medical_onUnconscious", {
params ["_unit", "_status"];

View File

@ -15,4 +15,8 @@
#include "script_component.hpp"
params ["_caller", "_target", "_selectionName"];
[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["actionCheckBloodPressureLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent);
} else {
["actionCheckBloodPressureLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent);
};

View File

@ -15,5 +15,8 @@
#include "script_component.hpp"
params ["_caller","_target", "_selectionName"];
[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["actionCheckPulseLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent);
} else {
["actionCheckPulseLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent);
};

View File

@ -18,7 +18,7 @@ params ["_unit", ["_force", false]];
if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
if !(local _unit) exitWith {
[[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
["addToInjuredCollection", _unit, [_unit, _force]] call EFUNC(common,targetEvent);
};
if ((_unit getVariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitWith{};

View File

@ -20,7 +20,7 @@ private ["_moment", "_logVarName", "_log","_newLog", "_logs"];
params ["_unit", "_type", "_message", "_arguments"];
if (!local _unit) exitWith {
[_this, QFUNC(addToLog), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
["addToMedicalLog", _unit, _this] call EFUNC(common,targetEvent);
};
date params ["", "", "", "_hour", "_minute"];

View File

@ -18,7 +18,7 @@ private ["_log", "_inList", "_amount"];
params ["_unit", "_newItem"];
if (!local _unit) exitWith {
[_this, QUOTE(DFUNC(addToTriageCard)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
["addToTriageList", _unit, _this] call EFUNC(common,targetEvent);
};
_log = _unit getVariable [QGVAR(triageCard), []];

View File

@ -20,7 +20,7 @@ params ["_unit", ["_force", false], ["_delaySetDamage", false]];
if ((!alive _unit) || {_unit getVariable ["ACE_isDead", false]}) exitWith {true};
if (!local _unit) exitwith {
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
["setDead", _unit, [_unit, _force]] call EFUNC(common,targetEvent);
false;
};
@ -86,7 +86,7 @@ if (isPLayer _unit) then {
["medical_onSetDead", [_unit]] call EFUNC(common,localEvent);
//Delay a frame before killing the unit via scripted damage
//Delay a frame before killing the unit via scripted damage
//to avoid triggering the "Killed" Event twice (and having the wrong killer)
if (!_delaySetDamage) then {

View File

@ -26,7 +26,7 @@ params ["_unit", "_selection", "_damage", ["_disabled", false]];
// Unit isn't local, give function to machine where it is.
if !(local _unit) exitWith {
[_this, QUOTE(DFUNC(setHitPointDamage)), _unit] call EFUNC(common,execRemoteFnc);
["setHitPointDamage", _unit, _this] call EFUNC(common,targetEvent);
};
// Check if overall damage adjustment is disabled

View File

@ -39,7 +39,7 @@ if !(_set) exitWith {
if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitWith{};
if (!local _unit) exitWith {
[[_unit, _set, _minWaitingTime, _force], QUOTE(DFUNC(setUnconscious)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
["setUnconscious", _unit, [_unit, _set, _minWaitingTime, _force]] call EFUNC(common,targetEvent);
};
_unit setVariable ["ACE_isUnconscious", true, true];

View File

@ -19,6 +19,10 @@
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 */
if (local _target) then {
["treatmentAdvanced_CPRLocal", [_caller, _target]] call EFUNC(common,localEvent);
} else {
["treatmentAdvanced_CPRLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent);
};
};
true;

View File

@ -26,7 +26,12 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitWith {
_this call FUNC(treatmentBasic_bandage);
};
[[_target, _className, _selectionName, _specificSpot], QUOTE(DFUNC(treatmentAdvanced_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentAdvanced_bandageLocal", [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,localEvent);
} else {
["treatmentAdvanced_bandageLocal", _target, [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,targetEvent);
};
/* {
if (_x != "") then {
[_target, _x] call FUNC(addToTriageCard);

View File

@ -12,7 +12,10 @@
params ["_caller", "_target", "_selectionName", "_className", "_items"];
// TODO replace by event system
[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentAdvanced_fullHealLocal", [_caller, _target]] call EFUNC(common,localEvent);
} else {
["treatmentAdvanced_fullHealLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent);
};
true;

View File

@ -20,4 +20,8 @@
private ["_hitSelections", "_hitPoints", "_point", "_damage"];
params ["_caller", "_target", "_selection", "_className"];
[[_target, _selection], QUOTE(DFUNC(treatmentBasic_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentBasic_bandageLocal", [_target, _selection]] call EFUNC(common,localEvent);
} else {
["treatmentBasic_bandageLocal", _target, [_target, _selection]] call EFUNC(common,targetEvent);
};

View File

@ -18,4 +18,8 @@
params ["_caller", "_target", "_treatmentClassname"];
[[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentBasic_bloodbagLocal", [_target, _treatmentClassname]] call EFUNC(common,localEvent);
} else {
["treatmentBasic_bloodbagLocal", _target, [_target, _treatmentClassname]] call EFUNC(common,targetEvent);
};

View File

@ -19,4 +19,8 @@
params ["_caller", "_target"];
[[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentBasic_morphineLocal", [_target]] call EFUNC(common,localEvent);
} else {
["treatmentBasic_morphineLocal", _target, [_target]] call EFUNC(common,targetEvent);
};

View File

@ -22,7 +22,12 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"];
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 */
if (local _target) then {
["treatmentIVLocal", [_target, _className]] call EFUNC(common,localEvent);
} else {
["treatmentIVLocal", _target, [_target, _className]] call EFUNC(common,targetEvent);
};
[_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message

View File

@ -40,7 +40,11 @@ if ((_tourniquets select _part) > 0) exitWith {
};
_removeItem = _items select 0;
[[_target, _removeItem, _selectionName], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _target) then {
["treatmentTourniquetLocal", [_target, _removeItem, _selectionName]] call EFUNC(common,localEvent);
} else {
["treatmentTourniquetLocal", _target, [_target, _removeItem, _selectionName]] call EFUNC(common,targetEvent);
};
[_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);

View File

@ -24,12 +24,20 @@ if (isNil QGVAR(setting_allowSharedEquipment)) then {
};
if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith {
[[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _patient) then {
["useItem", [_patient, _item]] call EFUNC(common,localEvent);
} else {
["useItem", _patient, [_patient, _item]] call EFUNC(common,targetEvent);
};
[true, _patient];
};
if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
[[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _medic) then {
["useItem", [_medic, _item]] call EFUNC(common,localEvent);
} else {
["useItem", _medic, [_medic, _item]] call EFUNC(common,targetEvent);
};
[true, _medic];
};
@ -39,7 +47,11 @@ if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic})
{
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith {
_return = [true, _x];
[[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
if (local _x) then {
["useItem", [_x, _item]] call EFUNC(common,localEvent);
} else {
["useItem", _x, [_x, _item]] call EFUNC(common,targetEvent);
};
};
} forEach _crew;
};