diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index c658e43278..4a143ad380 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -116,6 +116,14 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(moduleGlobalSetSkill): GVAR(moduleBase) { + displayName = "Global Set AI Skill"; + // icon = "\a3\Modules_F_Curator\Data\iconEndMission_ca.paa"; + // portrait = "\a3\Modules_F_Curator\Data\portraitEndMission_ca.paa"; + curatorInfoType = QGVAR(RscGlobalSetSkill); + class Arguments {}; + class Attributes {};//todo, make it a threden as well + }; class GVAR(moduleSetMedic): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleSetMedic_DisplayName); @@ -146,14 +154,6 @@ class CfgVehicles { sync[] = {}; }; }; - class GVAR(moduleGlobalSetSkill): GVAR(moduleBase) { - displayName = "Global Set AI Skill"; - // icon = "\a3\Modules_F_Curator\Data\iconEndMission_ca.paa"; - // portrait = "\a3\Modules_F_Curator\Data\portraitEndMission_ca.paa"; - curatorInfoType = QGVAR(RscGlobalSetSkill); - class Arguments {}; - class Attributes {};//todo, make it a threden as well - }; class GVAR(moduleSurrender): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleSurrender_DisplayName); @@ -164,6 +164,11 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(moduleTeleportPlayers): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = "Teleport Players"; + curatorInfoType = QGVAR(RscTeleportPlayers); + }; class GVAR(moduleUnconscious): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleUnconscious_DisplayName); diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index dc937c2608..5d24c0177c 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -13,9 +13,11 @@ PREP(moduleSetMedic); PREP(moduleSetMedicalVehicle); PREP(moduleSetMedicalFacility); PREP(moduleSurrender); +PREP(moduleTeleportPlayers); PREP(moduleUnconscious); PREP(moduleZeusSettings); PREP(setSkillsLocal); PREP(ui_globalSetSkill); +PREP(ui_teleportPlayers); PREP(ui_vehCargo); PREP(zeusAttributes); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index b069ff8e90..560a6f8073 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -2,7 +2,10 @@ class CfgPatches { class ADDON { - units[] = {QGVAR(moduleGlobalSetSkill)}; + units[] = { + QGVAR(moduleGlobalSetSkill), + QGVAR(moduleTeleportPlayers) + }; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf b/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf new file mode 100644 index 0000000000..4166b0adb2 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" + +params ["_logic","_uid","_group"]; + +// Get the chosen unit +private _player = [_uid] call BIS_fnc_getUnitByUID; + +// Handle if group mode was selected +if (_group) then { + _player = units _player; +} else { + _player = [_player]; +}; + +// Handle teleportation +{ + moveOut _x; + + private _attached = attachedTo _logic; + if (isNull _attached) then { + [_x, _logic] call BIS_fnc_moveToRespawnPosition; + } else { + [_x, _attached] call BIS_fnc_moveToRespawnPosition; + }; +} forEach _player; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_ui_teleportPlayers.sqf b/addons/zeus/functions/fnc_ui_teleportPlayers.sqf new file mode 100644 index 0000000000..d9a496b17f --- /dev/null +++ b/addons/zeus/functions/fnc_ui_teleportPlayers.sqf @@ -0,0 +1,53 @@ +#include "script_component.hpp" + +disableSerialization; + +params ["_control"]; + +//Generic Init: +private _display = ctrlparent _control; +private _ctrlButtonOK = _display displayctrl 1; //IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); +TRACE_1("logicObject",_logic); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _listbox = _display displayCtrl 16189; +{ + if (alive _x) then { + _listbox lbSetData [_listbox lbAdd (name _x), getPlayerUID _x]; + }; +} forEach allPlayers; + +_listbox lbSetCurSel 0; +(_display displayCtrl 16188) cbSetChecked (_logic setVariable ["tpGroup",false]); + +private _fnc_onUnload = { + params ["_display"]; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + // Store checkbox value for reopening + _logic setVariable ["tpGroup", cbChecked (_display displayCtrl 16188)]; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {diag_log text format ["[POTATO] - ERROR Logic [%1] is null on confirm", _logic];}; + + private _lb = _display displayCtrl 16189; + + private _uid = _lb lbData (lbCurSel _lb); + private _group = cbChecked (_display displayCtrl 16188); + + [_logic, _uid, _group] call FUNC(moduleTeleportPlayers); +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm]; diff --git a/addons/zeus/ui/RscAttributes.hpp b/addons/zeus/ui/RscAttributes.hpp index ad0a09246c..641daa7af0 100644 --- a/addons/zeus/ui/RscAttributes.hpp +++ b/addons/zeus/ui/RscAttributes.hpp @@ -113,6 +113,64 @@ class GVAR(RscGlobalSetSkill): RscDisplayAttributes { }; }; + +class GVAR(RscTeleportPlayers): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscTeleportPlayers)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscTeleportPlayers)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class teleportPlayers: RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_teleportPlayers)); + idc = 26422; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(8.5); + class controls { + class Title1: RscText { + idc = -1; + text = "Teleport Player"; + toolTip = "Teleport selected player to module position"; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Value1: RscListbox { + idc = 16189; + x = 0; + y = H_PART(1.1); + w = W_PART(26); + h = H_PART(5.9); + }; + class Title2: Title1 { + idc = -1; + text = "Teleport Group"; + toolTip = "Teleports all units in group"; + y = H_PART(7.1); + w = W_PART(10); + }; + class Value2: RscCheckBox { + idc = 16188; + x = W_PART(10.1); + y = H_PART(7.1); + w = W_PART(1); + h = H_PART(1); + }; + }; + }; + }; + }; + class ButtonOK: ButtonOK {}; + class ButtonCancel: ButtonCancel {}; + }; +}; + + class GVAR(cargoAttribute): RscControlsGroupNoScrollbars { onSetFocus = QUOTE(_this call FUNC(ui_vehCargo)); idc = 80085;