diff --git a/A3A/addons/core/CfgFunctions.hpp b/A3A/addons/core/CfgFunctions.hpp index 1a88f1253e..143e50d6fd 100644 --- a/A3A/addons/core/CfgFunctions.hpp +++ b/A3A/addons/core/CfgFunctions.hpp @@ -347,6 +347,7 @@ class CfgFunctions class cityinfo {}; class clientIdleChecker {}; class credits {}; + class initACE {}; class initACEUnconsciousHandler {}; class initBases {}; class initUtilityItems {}; diff --git a/A3A/addons/core/functions/init/fn_initACE.sqf b/A3A/addons/core/functions/init/fn_initACE.sqf new file mode 100644 index 0000000000..f03740e674 --- /dev/null +++ b/A3A/addons/core/functions/init/fn_initACE.sqf @@ -0,0 +1,58 @@ +/* + * File: fn_initACE.sqf + * Function: A3A_fnc_initACE + * Function description + * Initialization code for ACE3 stuff + * Arguments: + * 0: Objects + * 1: All + * + * Return Value: + * None + * + * Example: + * call A3A_fnc_initACE; + * + * Public: No + */ + +#include "..\..\script_component.hpp" + +if (A3A_hasACEMedical) then { + // log atropine, epinephrine, and morphine use + // Appears to be local to the medic + ["ace_treatmentStarted", { + params ["_caller", "_target", "_selectionName", "_className", "_itemUser", "_usedItem"]; + if (_usedItem in ["ACE_atropine", "ACE_epinephrine", "ACE_morphine"]) then { + ServerInfo_3("Player: %1 used %2 on %3",name _caller,_usedItem,name _target); + }; + }] call CBA_fnc_addEventHandler; +}; + +["ace_explosives_place", { + params ["_explosive","_dir","_pitch","_unit"]; + if (captive player && _unit == player) then { player setCaptive false }; +}] call CBA_fnc_addEventHandler; + +["ace_throwableThrown", { + params ["_unit", "_throwable"]; + if (captive player && _unit == player) then { player setCaptive false }; +}] call CBA_fnc_addEventHandler; + +[boxX, boxX] call ace_common_fnc_claim; //Disables ALL Ace Interactions +[vehicleBox, VehicleBox] call ace_common_fnc_claim; //Disables ALL Ace Interactions + +if (isNil "ace_interact_menu_fnc_compileMenu" || isNil "ace_interact_menu_fnc_compileMenuSelfAction") exitWith { + Error("ACE non-public functions have changed, rebel group join/leave actions will not be removed."); +}; +// Remove group join action from all rebel unit types +// Need to compile the menus first, because ACE delays creating menus until a unit of that class is created +private _unitTypes = ["I_G_soldier_F", "I_G_Soldier_TL_F", "I_G_Soldier_AR_F", "I_G_medic_F", "I_G_engineer_F", "I_G_Soldier_GL_F", "I_G_officer_F"]; +{ + [_x] call ace_interact_menu_fnc_compileMenu; + [_x] call ace_interact_menu_fnc_compileMenuSelfAction; + [_x, 0, ["ACE_ApplyHandcuffs"]] call ace_interact_menu_fnc_removeActionFromClass; + [_x, 1, ["ACE_SelfActions", "ACE_TeamManagement", "ACE_LeaveGroup"]] call ace_interact_menu_fnc_removeActionFromClass; + [_x, 0, ["ACE_MainActions", "ACE_JoinGroup"]] call ace_interact_menu_fnc_removeActionFromClass; +} forEach _unitTypes; // TODO: add raw unit types from new templates + diff --git a/A3A/addons/core/functions/init/fn_initClient.sqf b/A3A/addons/core/functions/init/fn_initClient.sqf index 2cfde323ad..b4d0f3c374 100644 --- a/A3A/addons/core/functions/init/fn_initClient.sqf +++ b/A3A/addons/core/functions/init/fn_initClient.sqf @@ -288,13 +288,6 @@ player addEventHandler ["GetInMan", { }; }]; -if (A3A_hasACE) then { - ["ace_explosives_place", { - params ["_explosive","_dir","_pitch","_unit"]; - if (_unit == player) then { player setCaptive false }; - }] call CBA_fnc_addEventHandler; -}; - // Prevent players getting shot by their own AIs. EH is respawn-persistent player addEventHandler ["HandleRating", {0}]; @@ -355,27 +348,9 @@ waituntil {!isnull (finddisplay 46)}; GVAR(keys_battleMenu) = false; //initilize key flags to false -if (A3A_hasACE) then -{ - if (isNil "ace_interact_menu_fnc_compileMenu" || isNil "ace_interact_menu_fnc_compileMenuSelfAction") exitWith { - Error("ACE non-public functions have changed, rebel group join/leave actions will not be removed."); - }; - // Remove group join action from all rebel unit types - // Need to compile the menus first, because ACE delays creating menus until a unit of that class is created - private _unitTypes = ["I_G_soldier_F", "I_G_Soldier_TL_F", "I_G_Soldier_AR_F", "I_G_medic_F", "I_G_engineer_F", "I_G_Soldier_GL_F", "I_G_officer_F"]; - { - [_x] call ace_interact_menu_fnc_compileMenu; - [_x] call ace_interact_menu_fnc_compileMenuSelfAction; - [_x, 0, ["ACE_ApplyHandcuffs"]] call ace_interact_menu_fnc_removeActionFromClass; - [_x, 1, ["ACE_SelfActions", "ACE_TeamManagement", "ACE_LeaveGroup"]] call ace_interact_menu_fnc_removeActionFromClass; - [_x, 0, ["ACE_MainActions", "ACE_JoinGroup"]] call ace_interact_menu_fnc_removeActionFromClass; - } forEach _unitTypes; // TODO: add raw unit types from new templates -}; - boxX allowDamage false; // hmm... boxX addAction ["Transfer Vehicle cargo to Ammobox", {[] spawn A3A_fnc_empty;}, 4]; boxX addAction ["Move this asset", A3A_fnc_moveHQObject,nil,0,false,true,"","(_this == theBoss)", 4]; -if (A3A_hasACE) then { [boxX, boxX] call ace_common_fnc_claim;}; //Disables ALL Ace Interactions flagX allowDamage false; flagX addAction ["Unit Recruitment", {if ([getPosATL player] call A3A_fnc_enemyNearCheck) then {["Recruit Unit", "You cannot recruit units while there are enemies near you."] call A3A_fnc_customHint;} else { [] spawn A3A_fnc_unit_recruit; }},nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (side (group _this) == teamPlayer)"]; flagX addAction ["Move this asset", A3A_fnc_moveHQObject,nil,0,false,true,"","(_this == theBoss)", 4]; @@ -393,7 +368,6 @@ vehicleBox allowDamage false; vehicleBox addAction [localize "STR_A3A_actions_restore_units", A3A_fnc_vehicleBoxRestore,nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (side (group _this) == teamPlayer)", 4]; vehicleBox addAction ["Vehicle Arsenal", JN_fnc_arsenal_handleAction, [], 0, true, false, "", "alive _target && vehicle _this != _this", 10]; [vehicleBox] call HR_GRG_fnc_initGarage; -if (A3A_hasACE) then { [vehicleBox, VehicleBox] call ace_common_fnc_claim;}; //Disables ALL Ace Interactions vehicleBox addAction ["Buy Vehicle", { if ([getPosATL player] call A3A_fnc_enemyNearCheck) then { @@ -449,6 +423,8 @@ _layer = ["statisticsX"] call bis_fnc_rscLayer; //Load the player's personal save. [] spawn A3A_fnc_createDialog_shouldLoadPersonalSave; +if (A3A_hasACE) then {call A3A_fnc_initACE}; + [allCurators] remoteExecCall ["A3A_fnc_initZeusLogging",0]; initClientDone = true; diff --git a/A3A/addons/core/functions/init/fn_initServer.sqf b/A3A/addons/core/functions/init/fn_initServer.sqf index 1ed3904e2b..db3044fb14 100644 --- a/A3A/addons/core/functions/init/fn_initServer.sqf +++ b/A3A/addons/core/functions/init/fn_initServer.sqf @@ -241,6 +241,45 @@ addMissionEventHandler ["EntityKilled", { }; }]; +if ((isClass (configfile >> "CBA_Extended_EventHandlers")) && ( + isClass (configfile >> "CfgPatches" >> "lambs_danger"))) then { + // disable lambs danger fsm entrypoint + ["CAManBase", "InitPost", { + params ["_unit"]; + (group _unit) setVariable ["lambs_danger_disableGroupAI", true]; + _unit setVariable ["lambs_danger_disableAI", true]; + }] call CBA_fnc_addClassEventHandler; +}; + +// Could replace these with entityCreated handler instead... +if(A3A_hasZen) then { + ["zen_common_createZeus", { + _this spawn { + params ["_unit"]; + + // wait in case our event was called first + waitUntil {sleep 1; !isNull getAssignedCuratorLogic _unit}; + + //now add the logging to the module + [[getAssignedCuratorLogic _unit]] remoteExecCall ["A3A_fnc_initZeusLogging",0]; + }; + }] call CBA_fnc_addEventHandler; +}; + +if (A3A_hasACE) then { + ["ace_zeus_createZeus", { + _this spawn { + params ["_unit"]; + + // wait in case our event was called first + waitUntil {sleep 1; !isNull getAssignedCuratorLogic _unit}; + + //now add the logging to the module + [[getAssignedCuratorLogic _unit]] remoteExecCall ["A3A_fnc_initZeusLogging",0]; + }; + }] call CBA_fnc_addEventHandler; +}; + serverInitDone = true; publicVariable "serverInitDone"; Info("Setting serverInitDone as true"); @@ -289,46 +328,5 @@ savingServer = false; // enable saving }; }; -if ((isClass (configfile >> "CBA_Extended_EventHandlers")) && ( - isClass (configfile >> "CfgPatches" >> "lambs_danger"))) then { - // disable lambs danger fsm entrypoint - ["CAManBase", "InitPost", { - params ["_unit"]; - (group _unit) setVariable ["lambs_danger_disableGroupAI", true]; - _unit setVariable ["lambs_danger_disableAI", true]; - }] call CBA_fnc_addClassEventHandler; -}; - - - -if(A3A_hasZen) then -{ - ["zen_common_createZeus", { - [_this] spawn { - params ["_unit"]; - - // wait in case our event was called first - waitUntil {sleep 1; !isNull getAssignedCuratorLogic _unit}; - - //now add the logging to the module - [[getAssignedCuratorLogic _unit]] remoteExecCall ["A3A_fnc_initZeusLogging",0]; - }; - }] call CBA_fnc_addEventHandler; -}; - -if(A3A_hasACE) then -{ - ["ace_zeus_createZeus", { - [_this] spawn { - params ["_unit"]; - - // wait in case our event was called first - waitUntil {sleep 1; !isNull getAssignedCuratorLogic _unit}; - - //now add the logging to the module - [[getAssignedCuratorLogic _unit]] remoteExecCall ["A3A_fnc_initZeusLogging",0]; - }; - }] call CBA_fnc_addEventHandler; -}; Info("initServer completed");