diff --git a/addons/waypoints/$PBOPREFIX$ b/addons/waypoints/$PBOPREFIX$ new file mode 100644 index 0000000..0ae0480 --- /dev/null +++ b/addons/waypoints/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afmf\addons\waypoints \ No newline at end of file diff --git a/addons/waypoints/CfgEventHandlers.hpp b/addons/waypoints/CfgEventHandlers.hpp new file mode 100644 index 0000000..e90bed4 --- /dev/null +++ b/addons/waypoints/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/waypoints/CfgWaypoints.cfg b/addons/waypoints/CfgWaypoints.cfg new file mode 100644 index 0000000..4241a94 --- /dev/null +++ b/addons/waypoints/CfgWaypoints.cfg @@ -0,0 +1,11 @@ +class CfgWaypoints { + class ADDON { + displayName = "ArmaForces"; + class VehicleMove { + displayName = CSTRING(VehicleMoveName); + file = QPATHTOF(functions\fnc_moveVehicleWp.sqf); + icon = "\a3\3DEN\Data\CfgWaypoints\Move_ca.paa"; + tooltip = CSTRING(VehicleMoveDescription); + }; + }; +}; diff --git a/addons/waypoints/README.md b/addons/waypoints/README.md new file mode 100644 index 0000000..a89e65c --- /dev/null +++ b/addons/waypoints/README.md @@ -0,0 +1,9 @@ +## Waypoint + +Waypoints: + +- Vehicle Move - Orders vehicle to move in straight line to the waypoint position, ignoring AI orders and situation. For more vehicles in a group, the group is divided into each vehicle duplicating the waypoint for better zeus control. + +### Authors + +- Command DDOS diff --git a/addons/waypoints/XEH_PREP.hpp b/addons/waypoints/XEH_PREP.hpp new file mode 100644 index 0000000..7457e73 --- /dev/null +++ b/addons/waypoints/XEH_PREP.hpp @@ -0,0 +1,2 @@ +PREP(waypointMoveVehicle); +PREP(seperateGroupVehicles); diff --git a/addons/waypoints/XEH_postInit.sqf b/addons/waypoints/XEH_postInit.sqf new file mode 100644 index 0000000..421c54b --- /dev/null +++ b/addons/waypoints/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" diff --git a/addons/waypoints/XEH_preInit.sqf b/addons/waypoints/XEH_preInit.sqf new file mode 100644 index 0000000..ecb5d0c --- /dev/null +++ b/addons/waypoints/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; diff --git a/addons/waypoints/XEH_preStart.sqf b/addons/waypoints/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/waypoints/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/waypoints/ZEN_CfgWaypointTypes.hpp b/addons/waypoints/ZEN_CfgWaypointTypes.hpp new file mode 100644 index 0000000..443958f --- /dev/null +++ b/addons/waypoints/ZEN_CfgWaypointTypes.hpp @@ -0,0 +1,7 @@ + class ZEN_WaypointTypes { + class GVAR(VehicleMove) { + displayName = CSTRING(VehicleMoveName); + type = "SCRIPTED"; + script = QPATHTOF(functions\fnc_waypointMoveVehicle.sqf); + }; +}; diff --git a/addons/waypoints/config.cpp b/addons/waypoints/config.cpp new file mode 100644 index 0000000..6f7e11b --- /dev/null +++ b/addons/waypoints/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afmf_main" + }; + author = "ArmaForces"; + authors[] = {"Command DDOS"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWaypoints.cfg" +#include "ZEN_CfgWaypointTypes.hpp" +#include "CfgEventHandlers.hpp" diff --git a/addons/waypoints/functions/fnc_seperateGroupVehicles.sqf b/addons/waypoints/functions/fnc_seperateGroupVehicles.sqf new file mode 100644 index 0000000..1a0c9cf --- /dev/null +++ b/addons/waypoints/functions/fnc_seperateGroupVehicles.sqf @@ -0,0 +1,57 @@ +#include "script_component.hpp" +/* + * Author: Command DDOS + * + * Arguments: + * 0: group + * 1: clone waypoint from original group + * 2: random pos near cloned waypoint + * + * Return Value: + * Array of new groups + * +*/ + +params [ + ["_group", grpNull, [grpNull]], + ["_cloneWaypoint", true, [true]], + ["_waypointRandomDif", 3, [0]] +]; + +private _vehicles = []; + +{ + _vehicles pushBackUnique (vehicle _x); +} forEach (units _group); + +_vehicles = (_vehicles - [vehicle leader _group]) select {assignedDriver _x in (units _group)}; +if (count _vehicles == 0) exitWith {[]}; + +private _newgroups = []; + +{ + private _vehicle = _X; + private _oldGroup = group driver _vehicle; + private _newGroup = createGroup (side _group); + private _UnitsInVehicle = (units _group select {_x in (crew _vehicle)}); + _UnitsInVehicle joinSilent _newGroup; + _group leaveVehicle _vehicle; + _newGroup addVehicle _vehicle; + _newGroup setBehaviour (combatBehaviour _group); + + if (_cloneWaypoint) then { + private _waypointPos = (getWPPos [_oldGroup,currentWaypoint _oldGroup]); + if (_waypointPos isEqualTo [0,0,0]) exitWith {}; + private _waypointType = waypointType [_oldGroup,currentWaypoint _oldGroup]; + private _waypointScript = waypointScript [_oldGroup,currentWaypoint _oldGroup]; + private _nearPos = _waypointPos vectorAdd [random _waypointRandomDif,random _waypointRandomDif,0]; + private _waypoint = _newGroup addWaypoint [_nearPos,0]; + _newGroups = _newGroups + [_newGroup]; + _waypoint setWaypointType _waypointType; + if !(_waypointScript == "") then { + _waypoint setWaypointScript _waypointScript; + }; + }; +} forEach _vehicles; + +_newGroups \ No newline at end of file diff --git a/addons/waypoints/functions/fnc_waypointMoveVehicle.sqf b/addons/waypoints/functions/fnc_waypointMoveVehicle.sqf new file mode 100644 index 0000000..c4b7fc4 --- /dev/null +++ b/addons/waypoints/functions/fnc_waypointMoveVehicle.sqf @@ -0,0 +1,54 @@ +#include "script_component.hpp" +/* + * Author: Command DDOS + * + * Arguments: + * 0: group + * 1: pos + * + * Return Value: + * none + * +*/ + +params ["_group", "_pos"]; + +if !(local _group) exitWith {false}; + +[_group] call FUNC(seperateGroupVehicles); + +private _vehicle = vehicle leader _group; + +// creating move waypoint when leader is not in vehicle +if (vehicle leader _group == leader _group) exitWith { + _group addWaypoint [_pos, 0, (currentWaypoint _group) + 1]; + true; +}; + +//update pos used in WUAE +_vehicle setVariable [QGVAR(targetMovePosition), _pos]; + +//create WUAE only when needed +if !(_vehicle getVariable [QGVAR(ActiveVehicleMove), false]) then { + _vehicle setVariable [QGVAR(ActiveVehicleMove), true]; + //WUAE + [{ + //condition + params ["_vehicle","_scriptHandle"]; + if (scriptDone _scriptHandle) exitWith {true}; + if !(alive (driver _vehicle)) exitWith {true}; + if (lifeState (driver _vehicle) == "INCAPACITATED") exitWith {true}; + if (_vehicle distance2D (_vehicle getVariable (QGVAR(targetMovePosition))) < 8) exitWith {true}; + + _vehicle setDriveOnPath [getPosATL _vehicle, _vehicle getVariable QGVAR(targetMovePosition)]; + false; + },{ + //code when true + params ["_vehicle"]; + (group driver _vehicle) move (getPosATL _vehicle); + _vehicle setVariable [QGVAR(ActiveVehicleMove), false]; + },[_vehicle,_thisScript] + ] call CBA_fnc_waitUntilAndExecute; +}; + +waitUntil {sleep 0.2; !(_vehicle getVariable [QGVAR(ActiveVehicleMove),false])} diff --git a/addons/waypoints/functions/script_component.hpp b/addons/waypoints/functions/script_component.hpp new file mode 100644 index 0000000..372f088 --- /dev/null +++ b/addons/waypoints/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afmf\addons\waypoints\script_component.hpp" diff --git a/addons/waypoints/script_component.hpp b/addons/waypoints/script_component.hpp new file mode 100644 index 0000000..4f017a9 --- /dev/null +++ b/addons/waypoints/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT waypoints +#include "\z\afmf\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_WAYPOINTS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_WAYPOINTS + #define DEBUG_SETTINGS DEBUG_SETTINGS_WAYPOINTS +#endif + +#include "\z\afmf\addons\main\script_macros.hpp" diff --git a/addons/waypoints/stringtable.xml b/addons/waypoints/stringtable.xml new file mode 100644 index 0000000..b92c1be --- /dev/null +++ b/addons/waypoints/stringtable.xml @@ -0,0 +1,13 @@ + + + + + Direct Vehicle Move + Bezpośredni ruch pojazdu + + + Direct Vehicle Move. Waypoint create new groups for all drivers in original group and assign new waypoint for them. Waypoint is complete after reaching destination or after losing life by driver + Bezpośredni ruch pojazdu. Waypoint tworzy nowe grupy na każdego kierowce który znajduję się w grupie i przypisuje im również waypoint. Zalicza się po dotarciu lub straceniu życia przez kierowce + + +