mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use variable to enable/disable aspects
This commit is contained in:
parent
96501b0087
commit
6d65fc42e8
@ -1,22 +1,26 @@
|
|||||||
// #define DEBUG_MODE_FULL
|
// #define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
[QEGVAR(medical,setUnconscious), LINKFUNC(setUnconscious)] call CBA_fnc_addEventHandler;
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
[QEGVAR(medical,setUnconscious), LINKFUNC(setUnconscious)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Fractures affect base sway, pain makes it worse
|
if (!hasInterface) exitWith {};
|
||||||
["baseline", {
|
|
||||||
ACE_player getVariable [QEGVAR(medical_engine,aimFracture), 0]
|
|
||||||
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
|
|
||||||
|
|
||||||
// Max pain = 5x sway
|
// Fractures affect base sway, pain makes it worse
|
||||||
["multiplier", {
|
["baseline", {
|
||||||
1 + (GET_PAIN_PERCEIVED(ACE_player) * 4)
|
ACE_player getVariable [QEGVAR(medical_engine,aimFracture), 0]
|
||||||
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
|
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
|
||||||
|
|
||||||
#ifdef DEBUG_MODE_FULL
|
// Max pain = 5x sway
|
||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\reportSettings.sqf);
|
["multiplier", {
|
||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\watchVariable.sqf);
|
1 + (GET_PAIN_PERCEIVED(ACE_player) * 4)
|
||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\debugDisplay.sqf);
|
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
|
||||||
#endif
|
|
||||||
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
call compile preprocessFileLineNumbers QPATHTOF(dev\reportSettings.sqf);
|
||||||
|
call compile preprocessFileLineNumbers QPATHTOF(dev\watchVariable.sqf);
|
||||||
|
call compile preprocessFileLineNumbers QPATHTOF(dev\debugDisplay.sqf);
|
||||||
|
#endif
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -23,6 +23,12 @@
|
|||||||
*/
|
*/
|
||||||
// #define DEBUG_TESTRESULTS
|
// #define DEBUG_TESTRESULTS
|
||||||
|
|
||||||
|
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
|
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(addDamageToUnit), _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {false};
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_unit", objNull, [objNull]],
|
["_unit", objNull, [objNull]],
|
||||||
["_damageToAdd", -1, [0]],
|
["_damageToAdd", -1, [0]],
|
||||||
|
@ -12,12 +12,18 @@
|
|||||||
* The new pain level <NUMBER>
|
* The new pain level <NUMBER>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [guy, 0.5] call ace_medical_fnc_adjustPainLevel
|
* [player, 0.5] call ace_medical_fnc_adjustPainLevel
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit", "_addedPain"];
|
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
|
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(adjustPainLevel), _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
|
params [["_unit", objNull, [objNull]], ["_addedPain", 0, [0]]];
|
||||||
|
|
||||||
if (!local _unit) exitWith { ERROR_1("unit [%1] is not local",_unit); };
|
if (!local _unit) exitWith { ERROR_1("unit [%1] is not local",_unit); };
|
||||||
|
|
||||||
|
@ -15,6 +15,13 @@
|
|||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
|
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(deserializeState), _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
params [["_unit", objNull, [objNull]], ["_json", "{}", [""]]];
|
params [["_unit", objNull, [objNull]], ["_json", "{}", [""]]];
|
||||||
|
|
||||||
// Don't run in scheduled environment
|
// Don't run in scheduled environment
|
||||||
|
@ -10,10 +10,17 @@
|
|||||||
* Serialized state as JSON string <STRING>
|
* Serialized state as JSON string <STRING>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player] call ace_medical_fnc_serializeState
|
* player call ace_medical_fnc_serializeState
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
|
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(serializeState), _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {""};
|
||||||
|
|
||||||
params [["_unit", objNull, [objNull]]];
|
params [["_unit", objNull, [objNull]]];
|
||||||
|
|
||||||
private _state = [] call CBA_fnc_createNamespace;
|
private _state = [] call CBA_fnc_createNamespace;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The unit that will be put in an unconscious state <OBJECT>
|
* 0: The unit that will be put in an unconscious state <OBJECT>
|
||||||
* 1: Set unconsciouns <BOOL> (default: true)
|
* 1: Set unconsciouns <BOOL> (default: true)
|
||||||
* 2: Minimum unconscious time (set to 0 to ignore) <NUMBER><OPTIONAL> (default: 0)
|
* 2: Minimum unconscious time (set to 0 to ignore) <NUMBER> (default: 0)
|
||||||
* 3: Force wakeup at given time if vitals are stable <BOOL><OPTIONAL> (default: false)
|
* 3: Force wakeup at given time if vitals are stable <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Success? <BOOLEAN>
|
* Success? <BOOLEAN>
|
||||||
@ -19,11 +19,12 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// only run this after the settings are initialized
|
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(setUnconscious), _this];
|
||||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
params [["_unit", objNull, [objNull]], ["_knockOut", true, [false]], ["_minWaitingTime", 0, [0]], ["_forcedWakup", false, [false]]];
|
params [["_unit", objNull, [objNull]], ["_knockOut", true, [false]], ["_minWaitingTime", 0, [0]], ["_forcedWakup", false, [false]]];
|
||||||
TRACE_4("setUnconscious",_unit,_knockOut,_minWaitingTime,_forcedWakup);
|
TRACE_4("setUnconscious",_unit,_knockOut,_minWaitingTime,_forcedWakup);
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
["CBA_settingsInitialized", {
|
["CBA_settingsInitialized", {
|
||||||
TRACE_1("settingsInitialized",GVAR(enabledFor));
|
TRACE_2("settingsInitialized",GVAR(enabledFor),GETEGVAR(medical,enabled,false));
|
||||||
if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled
|
|
||||||
|
if (GVAR(enabledFor) == 0 || {!(GETEGVAR(medical,enabled,false))}) exitWith {}; // 0: disabled
|
||||||
if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients
|
if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients
|
||||||
|
|
||||||
["ace_firedNonPlayer", {
|
["ace_firedNonPlayer", {
|
||||||
@ -20,5 +21,4 @@
|
|||||||
}] call CBA_fnc_addClassEventHandler;
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
#include "stateMachine.inc.sqf"
|
#include "stateMachine.inc.sqf"
|
||||||
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
// To support public API regardless of component settings
|
["CBA_settingsInitialized", {
|
||||||
[QGVAR(spurt), LINKFUNC(spurt)] call CBA_fnc_addEventHandler;
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
if (isServer) then {
|
// To support public API regardless of component settings
|
||||||
GVAR(bloodDrops) = [];
|
[QGVAR(spurt), LINKFUNC(spurt)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(bloodDropCreated), {
|
if (isServer) then {
|
||||||
params ["_bloodDrop", "_source"];
|
GVAR(bloodDrops) = [];
|
||||||
|
|
||||||
// Add to created queue with format: [expire time, blood object, source unit]
|
[QGVAR(bloodDropCreated), {
|
||||||
private _index = GVAR(bloodDrops) pushBack [CBA_missionTime + GVAR(bloodLifetime), _bloodDrop, _source];
|
params ["_bloodDrop", "_source"];
|
||||||
|
|
||||||
if (count GVAR(bloodDrops) >= GVAR(maxBloodObjects)) then {
|
// Add to created queue with format: [expire time, blood object, source unit]
|
||||||
(GVAR(bloodDrops) deleteAt 0) params ["", "_deletedBloodDrop"];
|
private _index = GVAR(bloodDrops) pushBack [CBA_missionTime + GVAR(bloodLifetime), _bloodDrop, _source];
|
||||||
deleteVehicle _deletedBloodDrop;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start the cleanup loop
|
if (count GVAR(bloodDrops) >= GVAR(maxBloodObjects)) then {
|
||||||
if (_index == 0) then {
|
(GVAR(bloodDrops) deleteAt 0) params ["", "_deletedBloodDrop"];
|
||||||
[LINKFUNC(cleanupLoop), [], GVAR(bloodLifetime)] call CBA_fnc_waitAndExecute;
|
deleteVehicle _deletedBloodDrop;
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
};
|
// Start the cleanup loop
|
||||||
|
if (_index == 0) then {
|
||||||
|
[LINKFUNC(cleanupLoop), [], GVAR(bloodLifetime)] call CBA_fnc_waitAndExecute;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,112 +1,116 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
[QGVAR(updateDamageEffects), LINKFUNC(updateDamageEffects)] call CBA_fnc_addEventHandler;
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
["unit", {
|
[QGVAR(updateDamageEffects), LINKFUNC(updateDamageEffects)] call CBA_fnc_addEventHandler;
|
||||||
params ["_new"];
|
|
||||||
[_new] call FUNC(updateDamageEffects); // Run on new controlled unit to update QGVAR(aimFracture)
|
|
||||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
|
||||||
["CAManBase", "init", {
|
["unit", {
|
||||||
params ["_unit"];
|
params ["_new"];
|
||||||
|
[_new] call FUNC(updateDamageEffects); // Run on new controlled unit to update QGVAR(aimFracture)
|
||||||
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
|
["CAManBase", "init", {
|
||||||
if (getNumber (configOf _unit >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit);};
|
params ["_unit"];
|
||||||
|
|
||||||
private _allHitPoints = getAllHitPointsDamage _unit param [0, []];
|
if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
|
||||||
if ((GVAR(customHitpoints) arrayIntersect _allHitPoints) isNotEqualTo GVAR(customHitpoints)) exitWith {
|
if (getNumber (configOf _unit >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit);};
|
||||||
ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit);
|
|
||||||
|
private _allHitPoints = getAllHitPointsDamage _unit param [0, []];
|
||||||
|
if ((GVAR(customHitpoints) arrayIntersect _allHitPoints) isNotEqualTo GVAR(customHitpoints)) exitWith {
|
||||||
|
ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Calling this function inside curly brackets allows the usage of
|
||||||
|
// "exitWith", which would be broken with "HandleDamage" otherwise.
|
||||||
|
_unit setVariable [
|
||||||
|
QEGVAR(medical,HandleDamageEHID),
|
||||||
|
_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]
|
||||||
|
];
|
||||||
|
|
||||||
|
_unit addEventHandler ["HandleHeal", {
|
||||||
|
params ["_injured", "_healer"];
|
||||||
|
|
||||||
|
// Replace the items so that the unit can't heal
|
||||||
|
_healer call EFUNC(common,replaceRegisteredItems);
|
||||||
|
|
||||||
|
AISFinishHeal [_injured, _healer, true];
|
||||||
|
|
||||||
|
// Set animation to what it was before starting the healing animation
|
||||||
|
[{"dnon_medic" in animationState (_this select 0)}, {
|
||||||
|
[_this select 0, _this select 1, 2] call EFUNC(common,doAnimation);
|
||||||
|
}, [_healer, _healer call EFUNC(common,getDefaultAnim)], 5] call CBA_fnc_waitUntilAndExecute;
|
||||||
|
}];
|
||||||
|
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
|
if !(["ace_medical_treatment"] call EFUNC(common,isModLoaded)) then {
|
||||||
|
[TYPE_FIRST_AID_KIT, ""] call EFUNC(common,registerItemReplacement);
|
||||||
|
[TYPE_MEDIKIT, ""] call EFUNC(common,registerItemReplacement);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calling this function inside curly brackets allows the usage of
|
#ifdef DEBUG_MODE_FULL
|
||||||
// "exitWith", which would be broken with "HandleDamage" otherwise.
|
[QEGVAR(medical,woundReceived), {
|
||||||
_unit setVariable [
|
params ["_unit", "_damages", "_shooter", "_ammo"];
|
||||||
QEGVAR(medical,HandleDamageEHID),
|
TRACE_4("wound",_unit,_damages,_shooter,_ammo);
|
||||||
_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]
|
//systemChat str _this;
|
||||||
];
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
#endif
|
||||||
|
|
||||||
_unit addEventHandler ["HandleHeal", {
|
// this handles moving units into vehicles via load functions or zeus
|
||||||
params ["_injured", "_healer"];
|
// needed, because the vanilla INCAPACITATED state does not handle vehicles
|
||||||
|
["CAManBase", "GetInMan", {
|
||||||
|
params ["_unit", "", "_vehicle"];
|
||||||
|
|
||||||
// Replace the items so that the unit can't heal
|
if (local _unit && {lifeState _unit == "INCAPACITATED"}) then {
|
||||||
_healer call EFUNC(common,replaceRegisteredItems);
|
[_unit, true] call FUNC(setUnconsciousAnim);
|
||||||
|
};
|
||||||
|
|
||||||
AISFinishHeal [_injured, _healer, true];
|
if (local _vehicle) then {
|
||||||
|
|
||||||
// Set animation to what it was before starting the healing animation
|
|
||||||
[{"dnon_medic" in animationState (_this select 0)}, {
|
|
||||||
[_this select 0, _this select 1, 2] call EFUNC(common,doAnimation);
|
|
||||||
}, [_healer, _healer call EFUNC(common,getDefaultAnim)], 5] call CBA_fnc_waitUntilAndExecute;
|
|
||||||
}];
|
|
||||||
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
|
|
||||||
|
|
||||||
if !(["ace_medical_treatment"] call EFUNC(common,isModLoaded)) then {
|
|
||||||
[TYPE_FIRST_AID_KIT, ""] call EFUNC(common,registerItemReplacement);
|
|
||||||
[TYPE_MEDIKIT, ""] call EFUNC(common,registerItemReplacement);
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef DEBUG_MODE_FULL
|
|
||||||
[QEGVAR(medical,woundReceived), {
|
|
||||||
params ["_unit", "_damages", "_shooter", "_ammo"];
|
|
||||||
TRACE_4("wound",_unit,_damages,_shooter,_ammo);
|
|
||||||
//systemChat str _this;
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
#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", "", "_vehicle"];
|
|
||||||
|
|
||||||
if (local _unit && {lifeState _unit == "INCAPACITATED"}) then {
|
|
||||||
[_unit, true] call FUNC(setUnconsciousAnim);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (local _vehicle) then {
|
|
||||||
[_unit] call FUNC(lockUnconsciousSeat);
|
|
||||||
};
|
|
||||||
}] call CBA_fnc_addClassEventHandler;
|
|
||||||
|
|
||||||
["CAManBase", "GetOutMan", {
|
|
||||||
params ["_unit", "", "_vehicle"];
|
|
||||||
|
|
||||||
if (local _vehicle) then {
|
|
||||||
[_unit] call FUNC(unlockUnconsciousSeat);
|
|
||||||
};
|
|
||||||
}] call CBA_fnc_addClassEventHandler;
|
|
||||||
|
|
||||||
// Fixes units being stuck in unconscious animation when being knocked over by a PhysX object
|
|
||||||
["CAManBase", "AnimDone", {
|
|
||||||
params ["_unit", "_anim"];
|
|
||||||
if (local _unit && {_anim find QUNCON_ANIM(face) != -1 && {lifeState _unit != "INCAPACITATED"}}) then {
|
|
||||||
[_unit, false] call FUNC(setUnconsciousAnim);
|
|
||||||
};
|
|
||||||
}] call CBA_fnc_addClassEventHandler;
|
|
||||||
|
|
||||||
["ace_unconscious", {
|
|
||||||
params ["_unit", "_unconscious"];
|
|
||||||
TRACE_3("unit uncon",_unit,objectParent _unit,local _unit);
|
|
||||||
if (!isNull objectParent _unit && {local objectParent _unit}) then {
|
|
||||||
if (_unconscious) then {
|
|
||||||
[_unit] call FUNC(lockUnconsciousSeat);
|
[_unit] call FUNC(lockUnconsciousSeat);
|
||||||
} else {
|
};
|
||||||
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
|
["CAManBase", "GetOutMan", {
|
||||||
|
params ["_unit", "", "_vehicle"];
|
||||||
|
|
||||||
|
if (local _vehicle) then {
|
||||||
[_unit] call FUNC(unlockUnconsciousSeat);
|
[_unit] call FUNC(unlockUnconsciousSeat);
|
||||||
};
|
};
|
||||||
};
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
["ace_killed", { // global event
|
// Fixes units being stuck in unconscious animation when being knocked over by a PhysX object
|
||||||
params ["_unit"];
|
["CAManBase", "AnimDone", {
|
||||||
TRACE_3("unit Killed",_unit,objectParent _unit,local _unit);
|
params ["_unit", "_anim"];
|
||||||
if (!isNull objectParent _unit && {local objectParent _unit}) exitWith {
|
if (local _unit && {_anim find QUNCON_ANIM(face) != -1 && {lifeState _unit != "INCAPACITATED"}}) then {
|
||||||
[_unit] call FUNC(lockUnconsciousSeat);
|
[_unit, false] call FUNC(setUnconsciousAnim);
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
["CAManBase", "Deleted", {
|
["ace_unconscious", {
|
||||||
params ["_unit"];
|
params ["_unit", "_unconscious"];
|
||||||
TRACE_3("unit deleted",_unit,objectParent _unit,local _unit);
|
TRACE_3("unit uncon",_unit,objectParent _unit,local _unit);
|
||||||
if ((!isNull objectParent _unit) && {local objectParent _unit}) then {
|
if (!isNull objectParent _unit && {local objectParent _unit}) then {
|
||||||
[_unit] call FUNC(unlockUnconsciousSeat);
|
if (_unconscious) then {
|
||||||
};
|
[_unit] call FUNC(lockUnconsciousSeat);
|
||||||
}, true, []] call CBA_fnc_addClassEventHandler;
|
} else {
|
||||||
|
[_unit] call FUNC(unlockUnconsciousSeat);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
["ace_killed", { // global event
|
||||||
|
params ["_unit"];
|
||||||
|
TRACE_3("unit Killed",_unit,objectParent _unit,local _unit);
|
||||||
|
if (!isNull objectParent _unit && {local objectParent _unit}) exitWith {
|
||||||
|
[_unit] call FUNC(lockUnconsciousSeat);
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
["CAManBase", "Deleted", {
|
||||||
|
params ["_unit"];
|
||||||
|
TRACE_3("unit deleted",_unit,objectParent _unit,local _unit);
|
||||||
|
if ((!isNull objectParent _unit) && {local objectParent _unit}) then {
|
||||||
|
[_unit] call FUNC(unlockUnconsciousSeat);
|
||||||
|
};
|
||||||
|
}, true, []] call CBA_fnc_addClassEventHandler;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,141 +1,145 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
[QEGVAR(medical,injured), {
|
["CBA_settingsInitialized", {
|
||||||
params ["_unit", "_painLevel"];
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
|
||||||
|
|
||||||
if (hasInterface && {_unit == ace_player}) then {
|
[QEGVAR(medical,injured), {
|
||||||
|
params ["_unit", "_painLevel"];
|
||||||
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
||||||
|
|
||||||
|
if (hasInterface && {_unit == ace_player}) then {
|
||||||
|
[true] call FUNC(handleEffects);
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
[QEGVAR(medical,moan), {
|
||||||
|
params ["_unit", "_painLevel"];
|
||||||
|
[_unit, "moan", PAIN_TO_MOAN(_painLevel)] call FUNC(playInjuredSound);
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
[QEGVAR(medical,fracture), {
|
||||||
|
params ["_unit"];
|
||||||
|
if (_unit == ACE_player) then {
|
||||||
|
playSound SND_FRACTURE;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
GVAR(nextFadeIn) = 0;
|
||||||
|
GVAR(heartBeatEffectRunning) = false;
|
||||||
|
GVAR(lastHeartBeatSound) = 0;
|
||||||
|
GVAR(bloodTickCounter) = 0;
|
||||||
|
|
||||||
|
[false] call FUNC(initEffects);
|
||||||
|
[true] call FUNC(handleEffects);
|
||||||
|
[LINKFUNC(handleEffects), 1, false] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
["ace_unconscious", {
|
||||||
|
params ["_unit", "_unconscious"];
|
||||||
|
|
||||||
|
if (_unit != ACE_player) exitWith {};
|
||||||
|
TRACE_1("player unconscious eh",_unconscious);
|
||||||
|
|
||||||
|
if (_unconscious && {cameraView == "GUNNER"} && {(vehicle _unit) != _unit} && {cameraOn == vehicle _unit}) then {
|
||||||
|
TRACE_2("exiting gunner view",cameraOn,cameraView);
|
||||||
|
ACE_player switchCamera "INTERNAL";
|
||||||
|
};
|
||||||
|
|
||||||
|
[!_unconscious, _unit] call EFUNC(common,setVolume);
|
||||||
|
|
||||||
|
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
|
||||||
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
||||||
|
[QUOTE(ADDON), _volume, _unconscious] call EFUNC(common,setHearingCapability);
|
||||||
|
|
||||||
|
[_unconscious, 1] call FUNC(effectUnconscious);
|
||||||
[true] call FUNC(handleEffects);
|
[true] call FUNC(handleEffects);
|
||||||
};
|
["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QEGVAR(medical,moan), {
|
// Reset volume upon death for spectators
|
||||||
params ["_unit", "_painLevel"];
|
[QEGVAR(medical,death), {
|
||||||
[_unit, "moan", PAIN_TO_MOAN(_painLevel)] call FUNC(playInjuredSound);
|
params ["_unit"];
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (_unit != ACE_player) exitWith {};
|
||||||
|
// Players always able to hear for any systems that might run while dead (e.g. spectator)
|
||||||
[QEGVAR(medical,fracture), {
|
|
||||||
params ["_unit"];
|
|
||||||
if (_unit == ACE_player) then {
|
|
||||||
playSound SND_FRACTURE;
|
|
||||||
};
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
GVAR(nextFadeIn) = 0;
|
|
||||||
GVAR(heartBeatEffectRunning) = false;
|
|
||||||
GVAR(lastHeartBeatSound) = 0;
|
|
||||||
GVAR(bloodTickCounter) = 0;
|
|
||||||
|
|
||||||
[false] call FUNC(initEffects);
|
|
||||||
[true] call FUNC(handleEffects);
|
|
||||||
[LINKFUNC(handleEffects), 1, false] call CBA_fnc_addPerFrameHandler;
|
|
||||||
|
|
||||||
["ace_unconscious", {
|
|
||||||
params ["_unit", "_unconscious"];
|
|
||||||
|
|
||||||
if (_unit != ACE_player) exitWith {};
|
|
||||||
TRACE_1("player unconscious eh",_unconscious);
|
|
||||||
|
|
||||||
if (_unconscious && {cameraView == "GUNNER"} && {(vehicle _unit) != _unit} && {cameraOn == vehicle _unit}) then {
|
|
||||||
TRACE_2("exiting gunner view",cameraOn,cameraView);
|
|
||||||
ACE_player switchCamera "INTERNAL";
|
|
||||||
};
|
|
||||||
|
|
||||||
[!_unconscious, _unit] call EFUNC(common,setVolume);
|
|
||||||
|
|
||||||
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
|
|
||||||
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
||||||
[QUOTE(ADDON), _volume, _unconscious] call EFUNC(common,setHearingCapability);
|
|
||||||
|
|
||||||
[_unconscious, 1] call FUNC(effectUnconscious);
|
|
||||||
[true] call FUNC(handleEffects);
|
|
||||||
["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus);
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
// Reset volume upon death for spectators
|
|
||||||
[QEGVAR(medical,death), {
|
|
||||||
params ["_unit"];
|
|
||||||
|
|
||||||
if (_unit != ACE_player) exitWith {};
|
|
||||||
// Players always able to hear for any systems that might run while dead (e.g. spectator)
|
|
||||||
[true, _unit] call EFUNC(common,setVolume);
|
|
||||||
|
|
||||||
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
// Update effects to match new unit's current status (this also handles respawn)
|
|
||||||
["unit", {
|
|
||||||
params ["_new"];
|
|
||||||
private _status = IS_UNCONSCIOUS(_new);
|
|
||||||
|
|
||||||
[!_status, _new] call EFUNC(common,setVolume);
|
|
||||||
|
|
||||||
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
||||||
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
|
||||||
[true] call FUNC(handleEffects);
|
|
||||||
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
|
||||||
// Update effects for featureCamera (curator, arsenal, etc)
|
|
||||||
["featureCamera", {
|
|
||||||
params ["_unit", "_newCamera"];
|
|
||||||
|
|
||||||
[true] call FUNC(handleEffects);
|
|
||||||
|
|
||||||
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
||||||
|
|
||||||
if (_newCamera == "") then { // switched back to player view
|
|
||||||
private _status = IS_UNCONSCIOUS(_unit);
|
|
||||||
[!_status, _unit] call EFUNC(common,setVolume);
|
|
||||||
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
|
||||||
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
|
||||||
} else { // camera view
|
|
||||||
[true, _unit] call EFUNC(common,setVolume);
|
[true, _unit] call EFUNC(common,setVolume);
|
||||||
|
|
||||||
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
||||||
["unconscious", false] call EFUNC(common,setDisableUserInputStatus);
|
}] call CBA_fnc_addEventHandler;
|
||||||
};
|
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
|
||||||
// Forced say3D
|
// Update effects to match new unit's current status (this also handles respawn)
|
||||||
[QGVAR(forceSay3D), {
|
["unit", {
|
||||||
params ["_unit", "_sound", "_distance"];
|
params ["_new"];
|
||||||
|
private _status = IS_UNCONSCIOUS(_new);
|
||||||
|
|
||||||
if (ACE_player distance _unit > _distance) exitWith {};
|
[!_status, _new] call EFUNC(common,setVolume);
|
||||||
|
|
||||||
if (isNull objectParent _unit) then {
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
||||||
// say3D waits for the previous sound to finish, so use a dummy instead
|
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
||||||
private _dummy = "#dynamicsound" createVehicleLocal [0, 0, 0];
|
[true] call FUNC(handleEffects);
|
||||||
_dummy attachTo [_unit, [0, 0, 0], "camera"];
|
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
||||||
_dummy say3D [_sound, _distance, 1, false];
|
}] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
[{
|
// Update effects for featureCamera (curator, arsenal, etc)
|
||||||
detach _this;
|
["featureCamera", {
|
||||||
deleteVehicle _this;
|
params ["_unit", "_newCamera"];
|
||||||
}, _dummy, 5] call CBA_fnc_waitAndExecute;
|
|
||||||
} else {
|
[true] call FUNC(handleEffects);
|
||||||
// Fallback: attachTo doesn't work within vehicles
|
|
||||||
_unit say3D [_sound, _distance, 1, false];
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
||||||
};
|
|
||||||
|
if (_newCamera == "") then { // switched back to player view
|
||||||
|
private _status = IS_UNCONSCIOUS(_unit);
|
||||||
|
[!_status, _unit] call EFUNC(common,setVolume);
|
||||||
|
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
||||||
|
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
||||||
|
} else { // camera view
|
||||||
|
[true, _unit] call EFUNC(common,setVolume);
|
||||||
|
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
||||||
|
["unconscious", false] call EFUNC(common,setDisableUserInputStatus);
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
|
// Forced say3D
|
||||||
|
[QGVAR(forceSay3D), {
|
||||||
|
params ["_unit", "_sound", "_distance"];
|
||||||
|
|
||||||
|
if (ACE_player distance _unit > _distance) exitWith {};
|
||||||
|
|
||||||
|
if (isNull objectParent _unit) then {
|
||||||
|
// say3D waits for the previous sound to finish, so use a dummy instead
|
||||||
|
private _dummy = "#dynamicsound" createVehicleLocal [0, 0, 0];
|
||||||
|
_dummy attachTo [_unit, [0, 0, 0], "camera"];
|
||||||
|
_dummy say3D [_sound, _distance, 1, false];
|
||||||
|
|
||||||
|
[{
|
||||||
|
detach _this;
|
||||||
|
deleteVehicle _this;
|
||||||
|
}, _dummy, 5] call CBA_fnc_waitAndExecute;
|
||||||
|
} else {
|
||||||
|
// Fallback: attachTo doesn't work within vehicles
|
||||||
|
_unit say3D [_sound, _distance, 1, false];
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Kill vanilla bleeding feedback effects.
|
||||||
|
#ifdef DISABLE_VANILLA_DAMAGE_EFFECTS
|
||||||
|
TRACE_1("disabling vanilla bleeding feedback effects",_this);
|
||||||
|
[{
|
||||||
|
{isNil _x} count [
|
||||||
|
"BIS_fnc_feedback_damageCC",
|
||||||
|
"BIS_fnc_feedback_damageRadialBlur",
|
||||||
|
"BIS_fnc_feedback_damageBlur"
|
||||||
|
] == 0
|
||||||
|
}, {
|
||||||
|
{
|
||||||
|
ppEffectDestroy _x;
|
||||||
|
} forEach [
|
||||||
|
BIS_fnc_feedback_damageCC,
|
||||||
|
BIS_fnc_feedback_damageRadialBlur,
|
||||||
|
BIS_fnc_feedback_damageBlur
|
||||||
|
];
|
||||||
|
}] call CBA_fnc_waitUntilAndExecute;
|
||||||
|
#endif
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Kill vanilla bleeding feedback effects.
|
|
||||||
#ifdef DISABLE_VANILLA_DAMAGE_EFFECTS
|
|
||||||
TRACE_1("disabling vanilla bleeding feedback effects",_this);
|
|
||||||
[{
|
|
||||||
{isNil _x} count [
|
|
||||||
"BIS_fnc_feedback_damageCC",
|
|
||||||
"BIS_fnc_feedback_damageRadialBlur",
|
|
||||||
"BIS_fnc_feedback_damageBlur"
|
|
||||||
] == 0
|
|
||||||
}, {
|
|
||||||
{
|
|
||||||
ppEffectDestroy _x;
|
|
||||||
} forEach [
|
|
||||||
BIS_fnc_feedback_damageCC,
|
|
||||||
BIS_fnc_feedback_damageRadialBlur,
|
|
||||||
BIS_fnc_feedback_damageBlur
|
|
||||||
];
|
|
||||||
}] call CBA_fnc_waitUntilAndExecute;
|
|
||||||
#endif
|
|
||||||
|
@ -4,7 +4,7 @@ class CfgVehicles {
|
|||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class ACE_Medical {
|
class ACE_Medical {
|
||||||
displayName = CSTRING(Medical);
|
displayName = CSTRING(Medical);
|
||||||
condition = QGVAR(enableSelfActions);
|
condition = QUOTE(missionNamespace getVariable [ARR_2(QQEGVAR(medical,enabled),false)] && GVAR(enableSelfActions));
|
||||||
exceptions[] = {"isNotInside", "isNotSitting", "isNotSwimming"};
|
exceptions[] = {"isNotInside", "isNotSitting", "isNotSwimming"};
|
||||||
statement = QUOTE([ARR_2(_target,-1)] call FUNC(displayPatientInformation));
|
statement = QUOTE([ARR_2(_target,-1)] call FUNC(displayPatientInformation));
|
||||||
runOnHover = 1;
|
runOnHover = 1;
|
||||||
@ -23,7 +23,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
#define ACTION_CONDITION condition = QUOTE(GVAR(enableActions) == 0);
|
#define ACTION_CONDITION condition = QUOTE(missionNamespace getVariable [ARR_2(QQEGVAR(medical,enabled),false)] && GVAR(enableActions) == 0);
|
||||||
#include "InteractionBodyParts.hpp"
|
#include "InteractionBodyParts.hpp"
|
||||||
#undef ACTION_CONDITION
|
#undef ACTION_CONDITION
|
||||||
class ACE_MainActions {
|
class ACE_MainActions {
|
||||||
@ -38,7 +38,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
class ACE_Medical_Radial {
|
class ACE_Medical_Radial {
|
||||||
displayName = CSTRING(Medical);
|
displayName = CSTRING(Medical);
|
||||||
condition = QUOTE((GVAR(enableActions) == 1 || {GVAR(enableActions) != 2 && {!isNull objectParent _target && {objectParent _target isEqualTo objectParent _player}}}));
|
condition = QUOTE(missionNamespace getVariable [ARR_2(QQEGVAR(medical,enabled),false)] && (GVAR(enableActions) == 1 || {GVAR(enableActions) != 2 && {!isNull objectParent _target && {objectParent _target isEqualTo objectParent _player}}}));
|
||||||
exceptions[] = {"isNotInside", "isNotSitting"};
|
exceptions[] = {"isNotInside", "isNotSitting"};
|
||||||
statement = QUOTE([ARR_2(_target,-1)] call FUNC(displayPatientInformation));
|
statement = QUOTE([ARR_2(_target,-1)] call FUNC(displayPatientInformation));
|
||||||
runOnHover = 1;
|
runOnHover = 1;
|
||||||
@ -49,7 +49,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
class ACE_LoadPatient {
|
class ACE_LoadPatient {
|
||||||
displayName = CSTRING(LoadPatient);
|
displayName = CSTRING(LoadPatient);
|
||||||
condition = QUOTE(_target getVariable [ARR_2('ACE_isUnconscious',false)] && {alive _target} && {isNull objectParent _target} && {(_target call EFUNC(common,nearestVehiclesFreeSeat)) isNotEqualTo []});
|
condition = QUOTE(missionNamespace getVariable [ARR_2(QQEGVAR(medical,enabled),false)] && {_target getVariable [ARR_2('ACE_isUnconscious',false)]} && {alive _target} && {isNull objectParent _target} && {(_target call EFUNC(common,nearestVehiclesFreeSeat)) isNotEqualTo []});
|
||||||
exceptions[] = {"isNotDragging", "isNotCarrying"};
|
exceptions[] = {"isNotDragging", "isNotCarrying"};
|
||||||
statement = QUOTE([ARR_2(_player,_target)] call EFUNC(medical_treatment,loadUnit));
|
statement = QUOTE([ARR_2(_player,_target)] call EFUNC(medical_treatment,loadUnit));
|
||||||
icon = QPATHTOF(ui\cross.paa);
|
icon = QPATHTOF(ui\cross.paa);
|
||||||
|
@ -2,115 +2,63 @@
|
|||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
GVAR(target) = objNull;
|
#include "initKeybinds.inc.sqf"
|
||||||
GVAR(previousTarget) = objNull;
|
|
||||||
GVAR(selectedBodyPart) = 0;
|
|
||||||
GVAR(selectedCategory) = "triage";
|
|
||||||
|
|
||||||
GVAR(lastOpenedOn) = -1;
|
["CBA_settingsInitialized", {
|
||||||
GVAR(pendingReopen) = false;
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
|
GVAR(target) = objNull;
|
||||||
|
GVAR(previousTarget) = objNull;
|
||||||
|
GVAR(selectedBodyPart) = 0;
|
||||||
|
GVAR(selectedCategory) = "triage";
|
||||||
|
|
||||||
GVAR(menuPFH) = -1;
|
GVAR(lastOpenedOn) = -1;
|
||||||
|
GVAR(pendingReopen) = false;
|
||||||
|
|
||||||
GVAR(peekLastOpenedOn) = -1;
|
GVAR(menuPFH) = -1;
|
||||||
GVAR(peekOnHitLastOpenedOn) = -1;
|
|
||||||
|
|
||||||
GVAR(selfInteractionActions) = [];
|
GVAR(peekLastOpenedOn) = -1;
|
||||||
[] call FUNC(addTreatmentActions);
|
GVAR(peekOnHitLastOpenedOn) = -1;
|
||||||
[] call FUNC(collectActions);
|
|
||||||
|
|
||||||
[QEGVAR(interact_menu,newControllableObject), {
|
GVAR(selfInteractionActions) = [];
|
||||||
params ["_type"]; // string of the object's classname
|
[] call FUNC(addTreatmentActions);
|
||||||
if !(_type isKindOf "CAManBase") exitWith {};
|
[] call FUNC(collectActions);
|
||||||
{
|
|
||||||
_x set [0, _type];
|
|
||||||
_x call EFUNC(interact_menu,addActionToClass);
|
|
||||||
} forEach GVAR(selfInteractionActions);
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
["ace_treatmentSucceded", {
|
[QEGVAR(interact_menu,newControllableObject), {
|
||||||
if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then {
|
params ["_type"]; // string of the object's classname
|
||||||
GVAR(pendingReopen) = false;
|
if !(_type isKindOf "CAManBase") exitWith {};
|
||||||
[FUNC(openMenu), GVAR(target)] call CBA_fnc_execNextFrame;
|
{
|
||||||
};
|
_x set [0, _type];
|
||||||
}] call CBA_fnc_addEventHandler;
|
_x call EFUNC(interact_menu,addActionToClass);
|
||||||
|
} forEach GVAR(selfInteractionActions);
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(openMedicalMenuKey), localize LSTRING(OpenMedicalMenu), {
|
["ace_treatmentSucceded", {
|
||||||
// Get target (cursorTarget, cursorObject, and lineIntersectsSurfaces along camera to maxDistance), if not valid then target is ACE_player
|
if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then {
|
||||||
TRACE_3("Open menu key",cursorTarget,cursorObject,ACE_player);
|
GVAR(pendingReopen) = false;
|
||||||
private _target = cursorTarget;
|
[FUNC(openMenu), GVAR(target)] call CBA_fnc_execNextFrame;
|
||||||
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
|
||||||
_target = cursorObject;
|
|
||||||
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
|
||||||
private _start = AGLToASL positionCameraToWorld [0, 0, 0];
|
|
||||||
private _end = AGLToASL positionCameraToWorld [0, 0, GVAR(maxDistance)];
|
|
||||||
private _intersections = lineIntersectsSurfaces [_start, _end, ACE_player, objNull, true, -1, "FIRE"];
|
|
||||||
{
|
|
||||||
_x params ["", "", "_intersectObject"];
|
|
||||||
// Only look "through" player and player's vehicle
|
|
||||||
if (!(_intersectObject isKindOf "CAManBase") && {_intersectObject != vehicle ACE_player}) exitWith {};
|
|
||||||
if (_intersectObject != ACE_player && {_intersectObject isKindOf "CAManBase" && {[ACE_player, _intersectObject] call FUNC(canOpenMenu)}}) exitWith {
|
|
||||||
_target =_intersectObject
|
|
||||||
};
|
|
||||||
} forEach _intersections;
|
|
||||||
if (!(_target isKindOf "CAManBase") || {!([ACE_player, _target] call FUNC(canOpenMenu))}) then {
|
|
||||||
_target = ACE_player;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Check conditions: canInteract and canOpenMenu
|
// Close patient information display when interaction menu is closed
|
||||||
if !([ACE_player, _target, ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
["ace_interactMenuClosed", {
|
||||||
if !([ACE_player, _target] call FUNC(canOpenMenu)) exitWith {false};
|
QGVAR(RscPatientInfo) cutFadeOut 0.3;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Statement
|
[QEGVAR(medical,woundReceived), {
|
||||||
[_target] call FUNC(openMenu);
|
params ["_unit", "_allDamages", ""];
|
||||||
false
|
if !(GVAR(peekMedicalOnHit) && {_unit == ACE_player}) exitWith {};
|
||||||
}, {
|
|
||||||
// Close menu if enough time passed from opening
|
|
||||||
if (CBA_missionTime - GVAR(lastOpenedOn) > 0.5) exitWith {
|
|
||||||
[objNull] call FUNC(openMenu);
|
|
||||||
};
|
|
||||||
false
|
|
||||||
}, [DIK_H, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(peekMedicalInfoKey), localize LSTRING(PeekMedicalInfo),
|
private _bodypart = toLowerANSI (_allDamages select 0 select 1);
|
||||||
{
|
private _bodypartIndex = ALL_BODY_PARTS find _bodypart;
|
||||||
// Conditions: canInteract
|
|
||||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
||||||
|
|
||||||
// Statement
|
[ACE_player, _bodypartIndex] call FUNC(displayPatientInformation);
|
||||||
[ACE_player, -1] call FUNC(displayPatientInformation);
|
|
||||||
false
|
|
||||||
}, {
|
|
||||||
if (CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)) then {
|
|
||||||
[{
|
|
||||||
CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)
|
|
||||||
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
|
||||||
};
|
|
||||||
GVAR(peekLastOpenedOn) = CBA_missionTime;
|
|
||||||
false
|
|
||||||
}, [DIK_H, [false, true, false]], false, 0] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
|
if (CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)) then {
|
||||||
// Close patient information display when interaction menu is closed
|
[{
|
||||||
["ace_interactMenuClosed", {
|
CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)
|
||||||
QGVAR(RscPatientInfo) cutFadeOut 0.3;
|
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
||||||
}] call CBA_fnc_addEventHandler;
|
};
|
||||||
|
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
|
||||||
[QEGVAR(medical,woundReceived), {
|
}] call CBA_fnc_addEventHandler;
|
||||||
params ["_unit", "_allDamages", ""];
|
|
||||||
if !(GVAR(peekMedicalOnHit) && {_unit == ACE_player}) exitWith {};
|
|
||||||
|
|
||||||
private _bodypart = toLowerANSI (_allDamages select 0 select 1);
|
|
||||||
private _bodypartIndex = ALL_BODY_PARTS find _bodypart;
|
|
||||||
|
|
||||||
[ACE_player, _bodypartIndex] call FUNC(displayPatientInformation);
|
|
||||||
|
|
||||||
if (CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)) then {
|
|
||||||
[{
|
|
||||||
CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)
|
|
||||||
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
|
||||||
};
|
|
||||||
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {false};
|
||||||
|
|
||||||
params ["_player", "_target"];
|
params ["_player", "_target"];
|
||||||
|
|
||||||
// If in Zeus
|
// If in Zeus
|
||||||
|
@ -18,7 +18,10 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
params ["_target", "_player", "", "_actionData"];
|
params ["_target", "_player", "", "_actionData"];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
GVAR(interactionMenuShowTriage) == 1 // Anyone
|
GVAR(interactionMenuShowTriage) == 1 // Anyone
|
||||||
|| {GVAR(interactionMenuShowTriage) == 2 && {[_player] call EFUNC(medical_treatment,isMedic)}} // Medics & Doctors
|
|| {GVAR(interactionMenuShowTriage) == 2 && {[_player] call EFUNC(medical_treatment,isMedic)}} // Medics & Doctors
|
||||||
|
56
addons/medical_gui/initKeybinds.inc.sqf
Normal file
56
addons/medical_gui/initKeybinds.inc.sqf
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
["ACE3 Common", QGVAR(openMedicalMenuKey), LLSTRING(OpenMedicalMenu), {
|
||||||
|
// Get target (cursorTarget, cursorObject, and lineIntersectsSurfaces along camera to maxDistance), if not valid then target is ACE_player
|
||||||
|
TRACE_3("Open menu key",cursorTarget,cursorObject,ACE_player);
|
||||||
|
private _target = cursorTarget;
|
||||||
|
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
||||||
|
_target = cursorObject;
|
||||||
|
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
||||||
|
private _start = AGLToASL positionCameraToWorld [0, 0, 0];
|
||||||
|
private _end = AGLToASL positionCameraToWorld [0, 0, GVAR(maxDistance)];
|
||||||
|
private _intersections = lineIntersectsSurfaces [_start, _end, ACE_player, objNull, true, -1, "FIRE"];
|
||||||
|
{
|
||||||
|
_x params ["", "", "_intersectObject"];
|
||||||
|
// Only look "through" player and player's vehicle
|
||||||
|
if (!(_intersectObject isKindOf "CAManBase") && {_intersectObject != vehicle ACE_player}) exitWith {};
|
||||||
|
if (_intersectObject != ACE_player && {_intersectObject isKindOf "CAManBase" && {[ACE_player, _intersectObject] call FUNC(canOpenMenu)}}) exitWith {
|
||||||
|
_target = _intersectObject
|
||||||
|
};
|
||||||
|
} forEach _intersections;
|
||||||
|
if (!(_target isKindOf "CAManBase") || {!([ACE_player, _target] call FUNC(canOpenMenu))}) then {
|
||||||
|
_target = ACE_player;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check conditions: canInteract and canOpenMenu
|
||||||
|
if !([ACE_player, _target, ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
if !([ACE_player, _target] call FUNC(canOpenMenu)) exitWith {false};
|
||||||
|
|
||||||
|
// Statement
|
||||||
|
[_target] call FUNC(openMenu);
|
||||||
|
false
|
||||||
|
}, {
|
||||||
|
// Close menu if enough time passed from opening
|
||||||
|
if (CBA_missionTime - GVAR(lastOpenedOn) > 0.5) exitWith {
|
||||||
|
[objNull] call FUNC(openMenu);
|
||||||
|
};
|
||||||
|
}, [DIK_H, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
|
||||||
|
|
||||||
|
["ACE3 Common", QGVAR(peekMedicalInfoKey), localize LSTRING(PeekMedicalInfo),
|
||||||
|
{
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
|
// Statement
|
||||||
|
[ACE_player, -1] call FUNC(displayPatientInformation);
|
||||||
|
false
|
||||||
|
}, {
|
||||||
|
if (CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)) then {
|
||||||
|
[{
|
||||||
|
CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)
|
||||||
|
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
||||||
|
};
|
||||||
|
GVAR(peekLastOpenedOn) = CBA_missionTime;
|
||||||
|
}, [DIK_H, [false, true, false]], false, 0] call CBA_fnc_addKeybind;
|
@ -1,14 +1,18 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
["ace_killed", { // global event
|
["CBA_settingsInitialized", {
|
||||||
params ["_unit"];
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
// Prevent second ragdoll of uncon units when they're killed
|
["ace_killed", { // global event
|
||||||
if (
|
params ["_unit"];
|
||||||
IS_UNCONSCIOUS(_unit) && !isAwake _unit // uncon and not ragdolling
|
|
||||||
&& {isPlayer _unit || {_unit getVariable [QGVAR(AIUnconsciousness), GVAR(AIUnconsciousness)]}}
|
// Prevent second ragdoll of uncon units when they're killed
|
||||||
) then {
|
if (
|
||||||
_unit enableSimulation false;
|
IS_UNCONSCIOUS(_unit) && !isAwake _unit // uncon and not ragdolling
|
||||||
[{_this enableSimulation true}, _unit, 2] call CBA_fnc_waitAndExecute;
|
&& {isPlayer _unit || {_unit getVariable [QGVAR(AIUnconsciousness), GVAR(AIUnconsciousness)]}}
|
||||||
};
|
) then {
|
||||||
|
_unit enableSimulation false;
|
||||||
|
[{_this enableSimulation true}, _unit, 2] call CBA_fnc_waitAndExecute;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,36 +1,41 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
// Handle pain changes on injury
|
["CBA_settingsInitialized", {
|
||||||
[QEGVAR(medical,injured), LINKFUNC(adjustPainLevel)] call CBA_fnc_addEventHandler;
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
|
// Handle pain changes on injury
|
||||||
|
[QEGVAR(medical,injured), LINKFUNC(adjustPainLevel)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Add inventory and open backpack actions to units
|
// Add inventory and open backpack actions to units
|
||||||
[QGVAR(addInventoryActions), LINKFUNC(addInventoryActions)] call CBA_fnc_addEventHandler;
|
[QGVAR(addInventoryActions), LINKFUNC(addInventoryActions)] call CBA_fnc_addEventHandler;
|
||||||
// apply to all living and dead now
|
|
||||||
{
|
|
||||||
[QGVAR(addInventoryActions), _x] call CBA_fnc_localEvent;
|
|
||||||
} forEach (allUnits + allDeadMen);
|
|
||||||
// apply to all future units
|
|
||||||
["CAManBase", "init", LINKFUNC(addInventoryActions), true, [], false] call CBA_fnc_addClassEventHandler;
|
|
||||||
// Respawn is called locally
|
|
||||||
["CAManBase", "respawn", {
|
|
||||||
params ["_unit"];
|
|
||||||
if (!local _unit) exitWith {};
|
|
||||||
[QGVAR(addInventoryActions), _unit] call CBA_fnc_globalEvent;
|
|
||||||
}, true] call CBA_fnc_addClassEventHandler;
|
|
||||||
|
|
||||||
|
// Apply to all living and dead now
|
||||||
|
{
|
||||||
|
[QGVAR(addInventoryActions), _x] call CBA_fnc_localEvent;
|
||||||
|
} forEach (allUnits + allDeadMen);
|
||||||
|
|
||||||
// Handle comms status effects for spectator
|
// Apply to all future units
|
||||||
// Separate from medical_feedback as these affect unit behavior rather than what the player sees
|
["CAManBase", "init", LINKFUNC(addInventoryActions), true, [], false] call CBA_fnc_addClassEventHandler;
|
||||||
["featureCamera", {
|
|
||||||
params ["_unit", "_newCamera"];
|
|
||||||
|
|
||||||
if (_unit isNotEqualTo ACE_player) exitWith {};
|
// Respawn is called locally
|
||||||
|
["CAManBase", "respawn", {
|
||||||
|
params ["_unit"];
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
|
[QGVAR(addInventoryActions), _unit] call CBA_fnc_globalEvent;
|
||||||
|
}, true] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
if (_newCamera == "") then { // switched back to player view
|
// Handle comms status effects for spectator
|
||||||
private _status = IS_UNCONSCIOUS(_unit);
|
// Separate from medical_feedback as these affect unit behavior rather than what the player sees
|
||||||
[_unit, _status] call FUNC(setStatusEffects);
|
["featureCamera", {
|
||||||
} else {
|
params ["_unit", "_newCamera"];
|
||||||
[_unit, false, true] call FUNC(setStatusEffects);
|
|
||||||
};
|
if (_unit isNotEqualTo ACE_player) exitWith {};
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
if (_newCamera == "") then { // switched back to player view
|
||||||
|
private _status = IS_UNCONSCIOUS(_unit);
|
||||||
|
[_unit, _status] call FUNC(setStatusEffects);
|
||||||
|
} else {
|
||||||
|
[_unit, false, true] call FUNC(setStatusEffects);
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,41 +1,44 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
[QEGVAR(medical_status,initialized), {
|
|
||||||
params ["_unit"];
|
|
||||||
|
|
||||||
// Clear all saved medical logs
|
|
||||||
{
|
|
||||||
_unit setVariable [_x, nil, true];
|
|
||||||
} forEach (_unit getVariable [QEGVAR(medical,allLogs), []]);
|
|
||||||
|
|
||||||
_unit setVariable [QEGVAR(medical,allLogs), [], true];
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
// Handle body removal and litter on server
|
|
||||||
if (isServer) then {
|
|
||||||
[QGVAR(createLitterServer), LINKFUNC(createLitterServer)] call CBA_fnc_addEventHandler;
|
|
||||||
["ace_placedInBodyBag", LINKFUNC(removeBody)] call CBA_fnc_addEventHandler;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Treatment events
|
|
||||||
[QGVAR(bandageLocal), LINKFUNC(bandageLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(checkBloodPressureLocal), LINKFUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(checkPulseLocal), LINKFUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(cprLocal), LINKFUNC(cprLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(fullHealLocal), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(ivBagLocal), LINKFUNC(ivBagLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(medicationLocal), LINKFUNC(medicationLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(placeInBodyBagOrGrave), LINKFUNC(placeInBodyBagOrGrave)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
// Logging events
|
|
||||||
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
// replace medical items with their ACE equivalents
|
|
||||||
["CBA_settingsInitialized", {
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly
|
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly
|
||||||
|
|
||||||
|
[QEGVAR(medical_status,initialized), {
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
// Clear all saved medical logs
|
||||||
|
{
|
||||||
|
_unit setVariable [_x, nil, true];
|
||||||
|
} forEach (_unit getVariable [QEGVAR(medical,allLogs), []]);
|
||||||
|
|
||||||
|
_unit setVariable [QEGVAR(medical,allLogs), [], true];
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Handle body removal and litter on server
|
||||||
|
if (isServer) then {
|
||||||
|
[QGVAR(createLitterServer), LINKFUNC(createLitterServer)] call CBA_fnc_addEventHandler;
|
||||||
|
["ace_placedInBodyBag", LINKFUNC(removeBody)] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Treatment events
|
||||||
|
[QGVAR(bandageLocal), LINKFUNC(bandageLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(checkBloodPressureLocal), LINKFUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(checkPulseLocal), LINKFUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(cprLocal), LINKFUNC(cprLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(fullHealLocal), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(ivBagLocal), LINKFUNC(ivBagLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(medicationLocal), LINKFUNC(medicationLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(placeInBodyBagOrGrave), LINKFUNC(placeInBodyBagOrGrave)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Logging events
|
||||||
|
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Replace medical items with their ACE equivalents
|
||||||
{
|
{
|
||||||
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
|
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
|
||||||
private _replacements = [];
|
private _replacements = [];
|
||||||
@ -59,41 +62,43 @@ if (isServer) then {
|
|||||||
// register replacement
|
// register replacement
|
||||||
[_toReplace, _replacements] call EFUNC(common,registerItemReplacement);
|
[_toReplace, _replacements] call EFUNC(common,registerItemReplacement);
|
||||||
} forEach (configProperties [configFile >> QEGVAR(medical,replacementItems), "isArray _x"]);
|
} forEach (configProperties [configFile >> QEGVAR(medical,replacementItems), "isArray _x"]);
|
||||||
|
|
||||||
|
if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
||||||
|
if (hasInterface) then {
|
||||||
|
private _checkHeadstoneAction = [
|
||||||
|
QGVAR(checkHeadstone),
|
||||||
|
LLSTRING(checkHeadstoneName),
|
||||||
|
QPATHTOEF(medical_gui,ui\grave.paa),
|
||||||
|
{
|
||||||
|
[
|
||||||
|
[_target getVariable QGVAR(headstoneData)],
|
||||||
|
true
|
||||||
|
] call CBA_fnc_notify;
|
||||||
|
},
|
||||||
|
{!isNil {_target getVariable QGVAR(headstoneData)}}
|
||||||
|
] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
|
[missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
["ace_placedInBodyBag", {
|
||||||
|
params ["_target", "_restingPlace"];
|
||||||
|
|
||||||
|
TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace);
|
||||||
|
|
||||||
|
if (isNull _restingPlace) exitWith {};
|
||||||
|
|
||||||
|
private _targetName = if (_target isKindOf "ACE_bodyBagObject") then {
|
||||||
|
_target getVariable [QGVAR(headstoneData), ""]
|
||||||
|
} else {
|
||||||
|
[_target, false, true] call EFUNC(common,getName)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_targetName == "") exitWith {};
|
||||||
|
|
||||||
|
_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
|
||||||
if (hasInterface) then {
|
|
||||||
private _checkHeadstoneAction = [
|
|
||||||
QGVAR(checkHeadstone),
|
|
||||||
LLSTRING(checkHeadstoneName),
|
|
||||||
QPATHTOEF(medical_gui,ui\grave.paa),
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[_target getVariable QGVAR(headstoneData)],
|
|
||||||
true
|
|
||||||
] call CBA_fnc_notify;
|
|
||||||
},
|
|
||||||
{!isNil {_target getVariable QGVAR(headstoneData)}}
|
|
||||||
] call EFUNC(interact_menu,createAction);
|
|
||||||
|
|
||||||
[missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isServer) then {
|
|
||||||
["ace_placedInBodyBag", {
|
|
||||||
params ["_target", "_restingPlace"];
|
|
||||||
TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace);
|
|
||||||
if (isNull _restingPlace) exitWith {};
|
|
||||||
|
|
||||||
private _targetName = "";
|
|
||||||
if (_target isKindOf "ACE_bodyBagObject") then {
|
|
||||||
_targetName = _target getVariable [QGVAR(headstoneData), ""];
|
|
||||||
} else {
|
|
||||||
_targetName = [_target, false, true] call EFUNC(common,getName);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_targetName == "") exitWith {};
|
|
||||||
_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {false};
|
||||||
|
|
||||||
params ["_unloader", "_target"];
|
params ["_unloader", "_target"];
|
||||||
|
|
||||||
!isNull objectParent _target &&
|
!isNull objectParent _target &&
|
||||||
|
@ -21,7 +21,7 @@ params ["_logic"];
|
|||||||
|
|
||||||
if !(local _logic) exitWith {};
|
if !(local _logic) exitWith {};
|
||||||
|
|
||||||
if (isNil QEFUNC(medical,setUnconscious)) then {
|
if !(GETEGVAR(medical,enabled,false)) then {
|
||||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||||
} else {
|
} else {
|
||||||
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||||
|
Loading…
Reference in New Issue
Block a user