Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added eventhandler and function to allow creation of zeus on loadouts #1063

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class cScripts {
class doGetOutHeloSide {};

class addObjectToCurator {};
class createCurator {};

class getChannelName {};
class clearRadioIds {};
Expand Down
7 changes: 4 additions & 3 deletions cScripts/Loadouts/CfgLoadouts_Special.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
class S3_Base: Cav_B_Seventh_Cavalry_Base_F {
displayName = "S3 Mission Control";
category[] = {};
scope = 2;
scope = 1;
loadout = [["rhs_weap_m4a1_blockII_bk","ACE_muzzle_mzls_L","acc_pointer_IR","rhsusf_acc_ACOG_RMR",["ACE_30Rnd_556x45_Stanag_M995_AP_mag",30],[],"rhsusf_acc_rvg_blk"],[],["rhs_weap_M320","","","",["ACE_HuntIR_M203",1],[],""],["USP_G3C_RS2_MC",[["ACE_tourniquet",4],["ItemcTabHCam",1],["ACE_MapTools",1],["ACE_IR_Strobe_Item",2],["ACE_microDAGR",1],["ACE_splint",4],["ACE_Flashlight_XL50",1],["kat_Painkiller",2,10],["SmokeShellPurple",2,1],["Laserbatteries",1,1]]],["rhsusf_plateframe_grenadier",[["ACE_packingBandage",20],["ACE_IR_Strobe_Item",2],["rhs_mag_M664_red_cluster",2,1],["1Rnd_SmokeRed_Grenade_shell",2,1],["1Rnd_SmokeBlue_Grenade_shell",2,1],["ACE_HuntIR_M203",2,1],["ACE_30Rnd_556x45_Stanag_M995_AP_mag",6,30],["ACE_HandFlare_Green",2,1],["SmokeShellBlue",2,1],["SmokeShellRed",2,1]]],["USP_TACTICAL_PACK_CCT7",[["Rev_darter_item",1],["ACE_HuntIR_monitor",1],["ACE_EntrenchingTool",1],["ACE_UAVBattery",1],["Laserbatteries",1,1],[["ACE_Vector","","","",[],[],""],1]]],"rhsusf_opscore_mc_cover_pelt_cam","rhsusf_shemagh2_gogg_grn",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemcTab","","ItemCompass","ItemWatch","USP_PVS15"]];
role = "officer";
role = "curator";

company = "";

insignia = "specialized_s3";

preLoadout = "_this#0 setVariable ['cScripts_Player_Unit', 'S3'];";
postLoadout = "";
postLoadout = "['cScripts_Curator_Create', [_this#0]] call CBA_fnc_serverEvent;";
};

class S3 : S3_Base { scope = 1; };
Expand Down
5 changes: 5 additions & 0 deletions cScripts/functions/init/fn_init_eventHandlers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ INFO("InitEventHandlers","Creating Server EventHandlers");
private _playerLog = missionNamespace getVariable [QEGVAR(log,players), []];
_playerLog pushBack _playerName;
missionNamespace setVariable [QEGVAR(log,players), _playerLog];
}] call CBA_fnc_addEventHandler;

[QEGVAR(Curator,Create), {
_this params ["_player"];
[_player] call FUNC(createCurator);
}] call CBA_fnc_addEventHandler;
41 changes: 41 additions & 0 deletions cScripts/functions/systems/fn_createCurator.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "..\script_component.hpp";
/*
* Author: SGT.Brostrom.A
* This function creates a zeus and attaches it for the for a defined player
*
* Arguments:
* 0: Player <OBJECT>
*
* Example:
* [player] call cScripts_fnc_createCurator
*
* Public: No
*/

params [
["_player", player, [objNull]]
];

if (!isServer) exitWith {};
if (!isNull (getAssignedCuratorLogic _player)) exitWith { SHOW_WARNING_2("Zeus", "Player %1 [%2] already assigned as curator", _player, typeOf _player); };

private _unit = _player getVariable [QEGVAR(Player,Unit), ""];
_unit = toLower _unit;
if (!(_unit in ["s3", "zeus", "curator", "debug"])) exitWith {
SHOW_WARNING_2("Zeus", "Player %1 [%2] can not be assigned as curator", _player, typeOf _player);
};

private _group = createGroup sideLogic;
private _curator = _group createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"];
_curator setVariable ["owner", _owner, true];
_curator setVariable ["Addons", 3, true];
_curator setVariable ["BIS_fnc_initModules_disableAutoActivation", false];
_curator setCuratorCoef ["Place", 0];
_curator setCuratorCoef ["Delete", 0];

_group deleteGroupWhenEmpty true;

_curator addCuratorAddons activatedAddons;
_player assignCurator _curator;

SHOW_CHAT_INFO_2("Zeus", "Curator created for %1 [%2]", _player, typeOf _player);