diff --git a/addons/wp/functions/Modules/fnc_modulePatrol.sqf b/addons/wp/functions/Modules/fnc_modulePatrol.sqf index ebdd584e..5c1920f4 100644 --- a/addons/wp/functions/Modules/fnc_modulePatrol.sqf +++ b/addons/wp/functions/Modules/fnc_modulePatrol.sqf @@ -34,13 +34,14 @@ switch (_mode) do { [LSTRING(Module_TaskPatrol_Range_DisplayName), "SLIDER", LSTRING(Module_TaskPatrol_Range_ToolTip), [20, 2000], [1, 0.5], TASK_PATROL_SIZE, 1], [LSTRING(Module_TaskPatrol_Waypoints_DisplayName), "SLIDER", LSTRING(Module_TaskPatrol_Waypoints_ToolTip), [2, 15], [2, 1], TASK_PATROL_WAYPOINTCOUNT, 0], [LSTRING(Module_TaskPatrol_MoveWaypoints_DisplayName), "BOOLEAN", LSTRING(Module_TaskPatrol_MoveWaypoints_ToolTip), TASK_PATROL_MOVEWAYPOINTS], - [LSTRING(Module_Task_EnableReinforcement_DisplayName), "BOOLEAN", LSTRING(Module_Task_EnableReinforcement_ToolTip), TASK_PATROL_ENABLEREINFORCEMENT] + [LSTRING(Module_Task_EnableReinforcement_DisplayName), "BOOLEAN", LSTRING(Module_Task_EnableReinforcement_ToolTip), TASK_PATROL_ENABLEREINFORCEMENT], + [LSTRING(Module_TaskGarrison_Teleport_DisplayName), "BOOLEAN", LSTRING(Module_TaskGarrison_Teleport_Tooltip), TASK_PATROL_TELEPORT] ], { params ["_data", "_args"]; _args params ["_groups", "_logic"]; _data params ["_groupIndex", "_range", "_waypointCount", "_moveWaypoint", "_enableReinforcement"]; private _group = _groups select _groupIndex; - [QGVAR(taskPatrol), [_group, getPos _logic, _range, _waypointCount, [], _moveWaypoint, _enableReinforcement], leader _group] call CBA_fnc_targetEvent; + [QGVAR(taskPatrol), [_group, getPos _logic, _range, _waypointCount, [], _moveWaypoint, _enableReinforcement, _teleport], leader _group] call CBA_fnc_targetEvent; deleteVehicle _logic; }, { params ["", "_logic"]; @@ -63,13 +64,14 @@ switch (_mode) do { [LSTRING(Module_TaskPatrol_Range_DisplayName), "SLIDER", LSTRING(Module_TaskPatrol_Range_ToolTip), [20, 2000], [1, 0.5], TASK_PATROL_SIZE, 1], [LSTRING(Module_TaskPatrol_Waypoints_DisplayName), "SLIDER", LSTRING(Module_TaskPatrol_Waypoints_ToolTip), [2, 15], [2, 1], TASK_PATROL_WAYPOINTCOUNT, 0], [LSTRING(Module_TaskPatrol_MoveWaypoints_DisplayName), "BOOLEAN", LSTRING(Module_TaskPatrol_MoveWaypoints_ToolTip), TASK_PATROL_MOVEWAYPOINTS], - [LSTRING(Module_Task_EnableReinforcement_DisplayName), "BOOLEAN", LSTRING(Module_Task_EnableReinforcement_ToolTip), TASK_PATROL_ENABLEREINFORCEMENT] + [LSTRING(Module_Task_EnableReinforcement_DisplayName), "BOOLEAN", LSTRING(Module_Task_EnableReinforcement_ToolTip), TASK_PATROL_ENABLEREINFORCEMENT], + [LSTRING(Module_TaskGarrison_Teleport_DisplayName), "BOOLEAN", LSTRING(Module_TaskGarrison_Teleport_Tooltip), TASK_PATROL_TELEPORT] ], { params ["_data", "_args"]; _args params ["_targets", "_logic", "_group"]; - _data params ["_targetIndex", "_range", "_waypointCount", "_moveWaypoint", "_enableReinforcement"]; + _data params ["_targetIndex", "_range", "_waypointCount", "_moveWaypoint", "_enableReinforcement", "_teleport"]; private _target = _targets select _targetIndex; - [QGVAR(taskPatrol), [_group, getPos _target, _range, _waypointCount, [], _moveWaypoint, _enableReinforcement], leader _group] call CBA_fnc_targetEvent; + [QGVAR(taskPatrol), [_group, getPos _target, _range, _waypointCount, [], _moveWaypoint, _enableReinforcement, _teleport], leader _group] call CBA_fnc_targetEvent; if (_logic isNotEqualTo _target) then { deleteVehicle _logic; }; @@ -91,8 +93,9 @@ switch (_mode) do { private _moveWaypoint = _logic getVariable [QGVAR(moveWaypoints), TASK_PATROL_MOVEWAYPOINTS]; private _enableReinforcement = _logic getVariable [QGVAR(EnableReinforcement), TASK_PATROL_ENABLEREINFORCEMENT]; private _waypointCount =_logic getVariable [QGVAR(WaypointCount), TASK_PATROL_WAYPOINTCOUNT]; + private _teleport =_logic getVariable [QGVAR(Teleport), TASK_PATROL_TELEPORT]; { - [QGVAR(taskPatrol), [_x, getPos _logic, _range, _waypointCount, _area, _moveWaypoint, _enableReinforcement], leader _x] call CBA_fnc_targetEvent; + [QGVAR(taskPatrol), [_x, getPos _logic, _range, _waypointCount, _area, _moveWaypoint, _enableReinforcement, _teleport], leader _x] call CBA_fnc_targetEvent; } forEach _groups; deleteVehicle _logic; }; diff --git a/addons/wp/functions/fnc_taskCamp.sqf b/addons/wp/functions/fnc_taskCamp.sqf index 1793595a..7abdea45 100644 --- a/addons/wp/functions/fnc_taskCamp.sqf +++ b/addons/wp/functions/fnc_taskCamp.sqf @@ -81,12 +81,12 @@ if (_patrol) then { // orders if (_area isEqualTo []) then { - [_patrolGroup, _pos, _range * 2, 4, nil, true] call FUNC(taskPatrol); + [_patrolGroup, _pos, _range * 2, 4, nil, true, false, _teleport] call FUNC(taskPatrol); } else { private _area2 = +_area; _area2 set [0, (_area2 select 0) * 2]; _area2 set [0, (_area2 select 1) * 2]; - [_patrolGroup, _pos, _range * 2, 4, _area2, true] call FUNC(taskPatrol); + [_patrolGroup, _pos, _range * 2, 4, _area2, true, false, _teleport] call FUNC(taskPatrol); }; // eventhandler diff --git a/addons/wp/functions/fnc_taskGarrison.sqf b/addons/wp/functions/fnc_taskGarrison.sqf index 7950797d..88e37470 100644 --- a/addons/wp/functions/fnc_taskGarrison.sqf +++ b/addons/wp/functions/fnc_taskGarrison.sqf @@ -108,12 +108,12 @@ if (_patrol) then { // orders if (_area isEqualTo []) then { - [_patrolGroup, _pos, _radius, 4, nil, true] call FUNC(taskPatrol); + [_patrolGroup, _pos, _radius, 4, nil, true, false, _teleport] call FUNC(taskPatrol); } else { private _area2 = +_area; _area2 set [0, (_area2 select 0) * 2]; _area2 set [1, (_area2 select 1) * 2]; - [_patrolGroup, _pos, _radius, 4, _area2, true] call FUNC(taskPatrol); + [_patrolGroup, _pos, _radius, 4, _area2, true, false, _teleport] call FUNC(taskPatrol); }; // eventhandler diff --git a/addons/wp/functions/fnc_taskPatrol.sqf b/addons/wp/functions/fnc_taskPatrol.sqf index be8e9a18..df4bb408 100644 --- a/addons/wp/functions/fnc_taskPatrol.sqf +++ b/addons/wp/functions/fnc_taskPatrol.sqf @@ -12,6 +12,7 @@ * 4: Area the AI Camps in, default [] * 5: Dynamic patrol pattern, default false * 6: enable dynamic reinforcement + * 7: Teleport group * * Return Value: * none @@ -32,7 +33,8 @@ params [ ["_waypointCount", TASK_PATROL_WAYPOINTCOUNT, [0]], ["_area", [], [[]]], ["_moveWaypoints", TASK_PATROL_MOVEWAYPOINTS, [false]], - ["_enableReinforcement", TASK_PATROL_ENABLEREINFORCEMENT, [false]] + ["_enableReinforcement", TASK_PATROL_ENABLEREINFORCEMENT, [false]], + ["_teleport", TASK_PATROL_TELEPORT, [false]] ]; // sort grp @@ -118,6 +120,16 @@ if (_moveWaypoints) then { _wp setWaypointStatements ["true", format ["if (local this) then {(group this) enableGunLights 'forceOn'; (group this) setCurrentWaypoint [(group this), %1];};", _fistWPId]]; }; +// teleport to random waypoint position +if (_teleport) then { + + private _teleportDestination = waypointPosition (selectRandom (waypoints _group)); + { + (vehicle _x) setVehiclePosition [_teleportDestination, [], precision (vehicle _x), "NONE"]; + } forEach units _group; + +}; + // debug if (EGVAR(main,debug_functions)) then { ["%1 taskPatrol: %2 Patrols", side _group, groupId _group] call EFUNC(main,debugLog); diff --git a/addons/wp/modules.hpp b/addons/wp/modules.hpp index c50efa5c..8e6ab517 100644 --- a/addons/wp/modules.hpp +++ b/addons/wp/modules.hpp @@ -394,6 +394,19 @@ class GVAR(TaskPatrol) : GVAR(BaseModule) { typeName = "BOOL"; defaultValue = QUOTE(TASK_PATROL_ENABLEREINFORCEMENT); }; + + class GVAR(Teleport): Checkbox { + displayName = CSTRING(Module_TaskGarrison_Teleport_DisplayName); + tooltip = CSTRING(Module_TaskGarrison_Teleport_Tooltip); + property = QGVAR(teleport); + unique = 0; + validate = "none"; + condition = "0"; + typeName = "BOOL"; + defaultValue = QUOTE(TASK_PATROL_TELEPORT); + }; + + class ModuleDescription: ModuleDescription {}; }; class ModuleDescription: ModuleDescription { diff --git a/addons/wp/script_component.hpp b/addons/wp/script_component.hpp index 4ca0627d..6450cf0c 100644 --- a/addons/wp/script_component.hpp +++ b/addons/wp/script_component.hpp @@ -42,6 +42,7 @@ #define TASK_PATROL_MOVEWAYPOINTS false #define TASK_PATROL_SIZE 200 #define TASK_PATROL_ENABLEREINFORCEMENT false +#define TASK_PATROL_TELEPORT false #define TASK_CREEP_MOVINGCENTER false #define TASK_CREEP_PLAYERSONLY false diff --git a/addons/wp/stringtable.xml b/addons/wp/stringtable.xml index 4964a842..77c8dce9 100644 --- a/addons/wp/stringtable.xml +++ b/addons/wp/stringtable.xml @@ -419,7 +419,7 @@ 传送单位 - Teleport units instantly to position + Teleport units instantly into position Teleportovat jednotky ihned na pozice Teleportiert Einheiten sofort zur Position Teleportuj jednostki od razu na pozycje