Add teleport player zeus module

This commit is contained in:
SilentSpike 2016-05-15 21:02:40 +01:00
parent 4d028be876
commit 5b460205a9
6 changed files with 157 additions and 9 deletions

View File

@ -116,6 +116,14 @@ class CfgVehicles {
sync[] = {}; 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) { class GVAR(moduleSetMedic): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
displayName = CSTRING(ModuleSetMedic_DisplayName); displayName = CSTRING(ModuleSetMedic_DisplayName);
@ -146,14 +154,6 @@ class CfgVehicles {
sync[] = {}; 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) { class GVAR(moduleSurrender): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
displayName = CSTRING(ModuleSurrender_DisplayName); displayName = CSTRING(ModuleSurrender_DisplayName);
@ -164,6 +164,11 @@ class CfgVehicles {
sync[] = {}; sync[] = {};
}; };
}; };
class GVAR(moduleTeleportPlayers): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "Teleport Players";
curatorInfoType = QGVAR(RscTeleportPlayers);
};
class GVAR(moduleUnconscious): GVAR(moduleBase) { class GVAR(moduleUnconscious): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
displayName = CSTRING(ModuleUnconscious_DisplayName); displayName = CSTRING(ModuleUnconscious_DisplayName);

View File

@ -13,9 +13,11 @@ PREP(moduleSetMedic);
PREP(moduleSetMedicalVehicle); PREP(moduleSetMedicalVehicle);
PREP(moduleSetMedicalFacility); PREP(moduleSetMedicalFacility);
PREP(moduleSurrender); PREP(moduleSurrender);
PREP(moduleTeleportPlayers);
PREP(moduleUnconscious); PREP(moduleUnconscious);
PREP(moduleZeusSettings); PREP(moduleZeusSettings);
PREP(setSkillsLocal); PREP(setSkillsLocal);
PREP(ui_globalSetSkill); PREP(ui_globalSetSkill);
PREP(ui_teleportPlayers);
PREP(ui_vehCargo); PREP(ui_vehCargo);
PREP(zeusAttributes); PREP(zeusAttributes);

View File

@ -2,7 +2,10 @@
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
units[] = {QGVAR(moduleGlobalSetSkill)}; units[] = {
QGVAR(moduleGlobalSetSkill),
QGVAR(moduleTeleportPlayers)
};
weapons[] = {}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"}; requiredAddons[] = {"ace_common"};

View File

@ -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;

View File

@ -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];

View File

@ -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 { class GVAR(cargoAttribute): RscControlsGroupNoScrollbars {
onSetFocus = QUOTE(_this call FUNC(ui_vehCargo)); onSetFocus = QUOTE(_this call FUNC(ui_vehCargo));
idc = 80085; idc = 80085;