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:
@ -1,6 +1,9 @@
|
|||||||
// #define DEBUG_MODE_FULL
|
// #define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
[QEGVAR(medical,setUnconscious), LINKFUNC(setUnconscious)] call CBA_fnc_addEventHandler;
|
[QEGVAR(medical,setUnconscious), LINKFUNC(setUnconscious)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
@ -20,3 +23,4 @@ if (!hasInterface) exitWith {};
|
|||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\watchVariable.sqf);
|
call compile preprocessFileLineNumbers QPATHTOF(dev\watchVariable.sqf);
|
||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\debugDisplay.sqf);
|
call compile preprocessFileLineNumbers QPATHTOF(dev\debugDisplay.sqf);
|
||||||
#endif
|
#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,5 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
// To support public API regardless of component settings
|
// To support public API regardless of component settings
|
||||||
[QGVAR(spurt), LINKFUNC(spurt)] call CBA_fnc_addEventHandler;
|
[QGVAR(spurt), LINKFUNC(spurt)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
@ -23,3 +26,4 @@ if (isServer) then {
|
|||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
};
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
[QGVAR(updateDamageEffects), LINKFUNC(updateDamageEffects)] call CBA_fnc_addEventHandler;
|
[QGVAR(updateDamageEffects), LINKFUNC(updateDamageEffects)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
["unit", {
|
["unit", {
|
||||||
@ -110,3 +113,4 @@ if !(["ace_medical_treatment"] call EFUNC(common,isModLoaded)) then {
|
|||||||
[_unit] call FUNC(unlockUnconsciousSeat);
|
[_unit] call FUNC(unlockUnconsciousSeat);
|
||||||
};
|
};
|
||||||
}, true, []] call CBA_fnc_addClassEventHandler;
|
}, true, []] call CBA_fnc_addClassEventHandler;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
[QEGVAR(medical,injured), {
|
[QEGVAR(medical,injured), {
|
||||||
params ["_unit", "_painLevel"];
|
params ["_unit", "_painLevel"];
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
||||||
@ -139,3 +142,4 @@ TRACE_1("disabling vanilla bleeding feedback effects",_this);
|
|||||||
];
|
];
|
||||||
}] call CBA_fnc_waitUntilAndExecute;
|
}] call CBA_fnc_waitUntilAndExecute;
|
||||||
#endif
|
#endif
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -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,6 +2,11 @@
|
|||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
#include "initKeybinds.inc.sqf"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
GVAR(target) = objNull;
|
GVAR(target) = objNull;
|
||||||
GVAR(previousTarget) = objNull;
|
GVAR(previousTarget) = objNull;
|
||||||
GVAR(selectedBodyPart) = 0;
|
GVAR(selectedBodyPart) = 0;
|
||||||
@ -35,64 +40,6 @@ GVAR(selfInteractionActions) = [];
|
|||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(openMedicalMenuKey), localize LSTRING(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);
|
|
||||||
};
|
|
||||||
false
|
|
||||||
}, [DIK_H, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(peekMedicalInfoKey), localize LSTRING(PeekMedicalInfo),
|
|
||||||
{
|
|
||||||
// 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;
|
|
||||||
false
|
|
||||||
}, [DIK_H, [false, true, false]], false, 0] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
|
|
||||||
// Close patient information display when interaction menu is closed
|
// Close patient information display when interaction menu is closed
|
||||||
["ace_interactMenuClosed", {
|
["ace_interactMenuClosed", {
|
||||||
QGVAR(RscPatientInfo) cutFadeOut 0.3;
|
QGVAR(RscPatientInfo) cutFadeOut 0.3;
|
||||||
@ -114,3 +61,4 @@ GVAR(selfInteractionActions) = [];
|
|||||||
};
|
};
|
||||||
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
|
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] 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,5 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
["ace_killed", { // global event
|
["ace_killed", { // global event
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
@ -12,3 +15,4 @@
|
|||||||
[{_this enableSimulation true}, _unit, 2] call CBA_fnc_waitAndExecute;
|
[{_this enableSimulation true}, _unit, 2] call CBA_fnc_waitAndExecute;
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
// Handle pain changes on injury
|
// Handle pain changes on injury
|
||||||
[QEGVAR(medical,injured), LINKFUNC(adjustPainLevel)] call CBA_fnc_addEventHandler;
|
[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
|
|
||||||
|
// Apply to all living and dead now
|
||||||
{
|
{
|
||||||
[QGVAR(addInventoryActions), _x] call CBA_fnc_localEvent;
|
[QGVAR(addInventoryActions), _x] call CBA_fnc_localEvent;
|
||||||
} forEach (allUnits + allDeadMen);
|
} forEach (allUnits + allDeadMen);
|
||||||
// apply to all future units
|
|
||||||
|
// Apply to all future units
|
||||||
["CAManBase", "init", LINKFUNC(addInventoryActions), true, [], false] call CBA_fnc_addClassEventHandler;
|
["CAManBase", "init", LINKFUNC(addInventoryActions), true, [], false] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
// Respawn is called locally
|
// Respawn is called locally
|
||||||
["CAManBase", "respawn", {
|
["CAManBase", "respawn", {
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
@ -19,7 +24,6 @@
|
|||||||
[QGVAR(addInventoryActions), _unit] call CBA_fnc_globalEvent;
|
[QGVAR(addInventoryActions), _unit] call CBA_fnc_globalEvent;
|
||||||
}, true] call CBA_fnc_addClassEventHandler;
|
}, true] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
|
|
||||||
// Handle comms status effects for spectator
|
// Handle comms status effects for spectator
|
||||||
// Separate from medical_feedback as these affect unit behavior rather than what the player sees
|
// Separate from medical_feedback as these affect unit behavior rather than what the player sees
|
||||||
["featureCamera", {
|
["featureCamera", {
|
||||||
@ -34,3 +38,4 @@
|
|||||||
[_unit, false, true] call FUNC(setStatusEffects);
|
[_unit, false, true] call FUNC(setStatusEffects);
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
}] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["CBA_settingsInitialized", {
|
||||||
|
if !(GETEGVAR(medical,enabled,false)) exitWith {};
|
||||||
|
|
||||||
|
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly
|
||||||
|
|
||||||
[QEGVAR(medical_status,initialized), {
|
[QEGVAR(medical_status,initialized), {
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
@ -33,9 +38,7 @@ if (isServer) then {
|
|||||||
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// replace medical items with their ACE equivalents
|
// Replace medical items with their ACE equivalents
|
||||||
["CBA_settingsInitialized", {
|
|
||||||
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly
|
|
||||||
{
|
{
|
||||||
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
|
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
|
||||||
private _replacements = [];
|
private _replacements = [];
|
||||||
@ -59,7 +62,6 @@ 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"]);
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
||||||
if (hasInterface) then {
|
if (hasInterface) then {
|
||||||
@ -82,18 +84,21 @@ if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
|||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
["ace_placedInBodyBag", {
|
["ace_placedInBodyBag", {
|
||||||
params ["_target", "_restingPlace"];
|
params ["_target", "_restingPlace"];
|
||||||
|
|
||||||
TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace);
|
TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace);
|
||||||
|
|
||||||
if (isNull _restingPlace) exitWith {};
|
if (isNull _restingPlace) exitWith {};
|
||||||
|
|
||||||
private _targetName = "";
|
private _targetName = if (_target isKindOf "ACE_bodyBagObject") then {
|
||||||
if (_target isKindOf "ACE_bodyBagObject") then {
|
_target getVariable [QGVAR(headstoneData), ""]
|
||||||
_targetName = _target getVariable [QGVAR(headstoneData), ""];
|
|
||||||
} else {
|
} else {
|
||||||
_targetName = [_target, false, true] call EFUNC(common,getName);
|
[_target, false, true] call EFUNC(common,getName)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_targetName == "") exitWith {};
|
if (_targetName == "") exitWith {};
|
||||||
|
|
||||||
_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
|
_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}] 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,[""]);
|
||||||
|
Reference in New Issue
Block a user