This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -3,28 +3,46 @@ class GRAD_publicTransport {
class behaviour {
file = grad_publicTransport\functions\bus\behaviour;

class openDoors {};
class addBehaviour {};
class closeDoors {};
class honk {};
class addBehaviour {};
class openDoors {};
class waitForPassengers {};
};

class debug {
file = grad_publicTransport\functions\bus\debug;

class createDebugMarker {};
};

class pathfinding_by_coding {
file = grad_publicTransport\functions\bus\pathfinding_by_coding;

class addVectors {};
class aStar {};
class calcRoute {};
class cost {};
class createRoute {};
class getNearestRoad {};
class mark {};
class removeMarker {};
class start {};
class h {};
};

class stations {
file = grad_publicTransport\functions\bus\stations;

class assignRoute {};
class createStations {};
class createWaypoints {};
class findStations {};
class getNextStation {};
class getStationDataAToB {};
class getStationDataBToA {};
class getReturnRoute {};
class isAtStation {};
class sortByDistance {};
};

class debug {
file = grad_publicTransport\functions\bus\debug;

class createDebugMarker {};
class isOnRightSide {};
class waypointGetNext {};
class waypointSetStatements {};
class waypointsCreate {};
};
};
@@ -0,0 +1,27 @@
params ["_driver"];

_bus = vehicle _driver;
_waitingTime = 10 + (random 2);

[_bus, ['doors_1', 'doors_2', 'doors_3']] call grad_publicTransport_fnc_openDoors;


// check if potential passengers are nearby
if (count (_driver nearEntities ["Man", 15]) > 0) then {
_waitingTime = _waitingTime + 10;
};

sleep _waitingTime;

// make drive ready
[_bus] call grad_publicTransport_fnc_honk;
[_bus, ['doors_2']] call grad_publicTransport_fnc_closeDoors;
sleep 0.5;
[_bus, ['doors_3']] call grad_publicTransport_fnc_closeDoors;
sleep 0.75;
[_bus, ['doors_1']] call grad_publicTransport_fnc_closeDoors;
sleep 0.5;
[_bus] call grad_publicTransport_fnc_honk;

// next waypoint for this line
[_driver] call grad_publicTransport_fnc_waypointGetNext;
@@ -1,11 +1,15 @@
params ["_pos", ["_dir", 0]];
params ["_pos", ["_color", "colorRed"], "_number"];

_marker = createMarker [format["%1", toString _pos],_pos];
// diag_log format ["GRAD_CIV_DEBUG: Marker %1 created", _marker];


diag_log format ["GRAD_publicTransport: Marker %1 created", _pos];


_marker setMarkerShape "ICON";
_marker setMarkerType "hd_arrow";
_marker setMarkerType "hd_dot";

_marker setMarkerAlpha 1;
_marker setMarkerColor "ColorRed";
_marker setMarkerText "";
_marker setMarkerDir _dir;
_marker setMarkerColor _color;
_marker setMarkerText (str _number);

@@ -0,0 +1,74 @@
params["_src","_dst"];
private _closed = [];
private _open = [_src];
private _markerArray = [];

missionNamespace setVariable ["CODI_Path_g_" + str _src, 0];
CODI_Path_variables pushBack ("CODI_Path_g_" + str _src);
missionNamespace setVariable ["CODI_Path_f_" + str _src, [_src, _dst] call GRAD_publicTransport_fnc_h];
CODI_Path_variables pushBack ("CODI_Path_f_" + str _src);
while {!(_open isEqualTo [])} do
{
private _current = objNull;
{
if ((missionNamespace getVariable ["CODI_Path_f_" + str _x, 999999]) < (missionNamespace getVariable ["CODI_Path_f_" + str _current, 999999])) then
{
_current = _x;
};
nil
}
count _open;
if (_current == _dst) exitWith
{
_markerArray = [_dst] call GRAD_publicTransport_fnc_mark;
};
_open = _open - [_current];
_closed pushBack _current;
private _roads = roadsConnectedTo _current;
{
if (_x != _current) then
{
_roads pushBackUnique _x;
};
nil
}
count ((getPos _current) nearRoads 20);
{
if (!(_x in _closed)) then
{
private _tentativeG = (missionNamespace getVariable ["CODI_Path_g_" + str _current, 999999]) + ([_current, _x] call GRAD_publicTransport_fnc_cost);
private _continue = false;
if (!(_x in _open)) then
{
_open pushBack _x;
}
else
{
if (_tentativeG >= (missionNamespace getVariable ["CODI_Path_g_" + str _x, 999999])) then
{
_continue = true;
};

};
if (!_continue) then
{
private _marker = createMarkerLocal [str _x, getPos _x];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerColorLocal "ColorWEST";
_marker setMarkerTypeLocal "MIL_DOT";
_marker setMarkerAlphaLocal 0.25;
CODI_Path_markersLocal pushBack _marker;
missionNamespace setVariable ["CODI_Path_parent_" + str _x, _current];
CODI_Path_variables pushBack ("CODI_Path_parent_" + str _x);
missionNamespace setVariable ["CODI_Path_g_" + str _x, _tentativeG];
CODI_Path_variables pushBack ("CODI_Path_g_" + str _x);
missionNamespace setVariable ["CODI_Path_f_" + str _x, (missionNamespace getVariable ["CODI_Path_g_" + str _x, 999999]) + ([_x, _dst] call GRAD_publicTransport_fnc_h)];
CODI_Path_variables pushBack ("CODI_Path_f_" + str _x);
};
};
nil
}
count _roads;
};

_markerArray
@@ -0,0 +1,20 @@
params ["_array", "_endpoint"];

_vectorizedArray = [];

_posBefore = _array select 0;
_dir = _posBefore getDir _endpoint;

_vectorizedArray = _vectorizedArray + [[_posBefore, _dir]];

{
if (_forEachIndex > 0) then {
_dir = _x getDir _posBefore;

diag_log format ["dir %1",_dir];
_vectorizedArray = _vectorizedArray + [[_x, _dir]];
_posBefore = _x;
};
} forEach _array;

_vectorizedArray
@@ -0,0 +1,52 @@
params["_src","_dst", ["_lineNumber", 1]];

private _srcRoad = [_src] call GRAD_publicTransport_fnc_getNearestRoad;
private _dstRoad = [_dst] call GRAD_publicTransport_fnc_getNearestRoad;

if (isNull _srcRoad || isNull _dstRoad) exitWith {hint "src or dst not close to a road"};
_rawData = [_srcRoad, _dstRoad] call GRAD_publicTransport_fnc_aStar;
_targetRouteDir = [_rawData, _dst] call GRAD_publicTransport_fnc_addVectors;

_returnRaw = [_rawData] call GRAD_publicTransport_fnc_getReturnRoute;
_returnRouteDir = [_returnRaw, _src] call GRAD_publicTransport_fnc_addVectors;

_stationArrayUp = [];
_stationArrayDown = [];

diag_log format ["_targetRoute %1", _targetRouteDir];
diag_log format ["_returnRoute %1", _returnRouteDir];

_nextStation = [];

{

_nextStation = [_x select 0, _x select 1] call GRAD_publicTransport_fnc_getNextStation;

if (_nextStation select 0) then {
_stationArrayUp = _stationArrayUp + [_nextStation select 1];
};
} forEach _targetRouteDir;

{
[getPos _x, "colorRed", _forEachIndex] call GRAD_publicTransport_fnc_createDebugMarker;
} forEach _stationArrayUp;


/* return route */
_nextStation = [];

{
_nextStation = [_x select 0, _x select 1] call GRAD_publicTransport_fnc_getNextStation;

if (_nextStation select 0) then {
_stationArrayDown = _stationArrayDown + [_nextStation select 1];
};
} forEach _returnRouteDir;

{
[getPos _x, "colorBlue", _forEachIndex] call GRAD_publicTransport_fnc_createDebugMarker;
} forEach _stationArrayDown;



missionNameSpace setVariable ["GRAD_publicTransport_Stations_Line_" + (str _lineNumber), [_stationArrayUp, _stationArrayDown], true];
@@ -0,0 +1,10 @@
params["_src","_dst"];
private _dist = ((getPos _src) distance (getPos _dst))*1;

_stationMapObjects = (nearestTerrainObjects [getPos _dst, [ "BUSSTOP"], 20]);
if (count _stationMapObjects == 0) then {
diag_log format ["dist %1 added 10", _dist];
_dist = _dist + 10;
};

_dist
@@ -0,0 +1,3 @@
params ["_start", "_end"];

_handle = [_start, _end] spawn GRAD_publicTransport_fnc_calcRoute;
@@ -0,0 +1,13 @@
params["_pos"];
private _roads = _pos nearRoads 1000;
if (_roads isEqualTo []) exitWith {objNull};
private _road = _roads deleteAt 0;
{
if (((getPos _x) distance2d _pos) < ((getPos _road) distance2d _pos)) then
{
_road = _x;
};
nil
}
count _roads;
_road
@@ -0,0 +1,3 @@
params["_src","_dst"];
private _dist = ((getPos _src) distance (getPos _dst))*1.5;
_dist
@@ -0,0 +1,37 @@
{
deleteMarkerLocal _x;
nil
}
count CODI_Path_markersLocal;
CODI_Path_markersLocal = [];

private _dst = param[0, objNull];
private _marker = createMarker [str _dst, getPos _dst];
private _array = [];

_marker setMarkerShape "ICON";
_marker setMarkerColor "ColorWEST";
_marker setMarkerType "MIL_DOT";
CODI_Path_markers pushBack _marker;

while {!isNull _dst} do
{
if ((getMarkerPos _marker) distance2d (getPos _dst) > 10) then
{
_marker = createMarker [str _dst, getPos _dst];
_marker setMarkerShape "ICON";
_marker setMarkerColor "ColorWEST";
_marker setMarkerType "MIL_DOT";
_marker setMarkerAlpha 0;
};
CODI_Path_markers pushBack _marker;
_dst = missionNamespace getVariable ["CODI_Path_parent_" + str _dst, objNull];
};

{

_array = _array + [getMarkerPos _x];

} forEach CODI_Path_markers;

_array
@@ -0,0 +1,12 @@
{
deleteMarker _x;
nil
}
count CODI_Path_markers;
CODI_Path_markers = [];
{
missionNamespace setVariable[_x, nil];
nil
}
count CODI_Path_variables;
CODI_Path_variables = [];
@@ -0,0 +1,9 @@
["CODI_Path_mapClick", "onMapSingleClick",{
[getPos player, _pos] spawn GRAD_publicTransport_fnc_calcRoute;
openMap false;
}] call BIS_fnc_addStackedEventHandler;
openMap true;
[] spawn {
waitUntil{!visibleMap};
["CODI_Path_mapClick", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
};
@@ -0,0 +1,20 @@
/*
code by coding @armaworld.de, splitted into files by nomisum
*/


CODI_Path_markers = [];
CODI_Path_markersLocal = [];
CODI_Path_variables = [];

/*
player addAction["Calculate Route", {call GRAD_publicTransport_fnc_start;}, [], 0, false, true, "", "count CODI_Path_markers == 0"];
player addAction["Delete Route", {call GRAD_publicTransport_fnc_removeMarkers;}, [], 0, false, true, "", "count CODI_Path_markers > 0"];
player addEventHandler ["Respawn", {
player addAction["Calculate Route", {call GRAD_publicTransport_fnc_start;}, [], 0, false, true, "", "count CODI_Path_markers == 0"];
player addAction["Delete Route", {call GRAD_publicTransport_fnc_removeMarkers;}, [], 0, false, true, "", "count CODI_Path_markers > 0"];
}];
*/
@@ -0,0 +1,11 @@
/*
call with
[driver cursortarget, 1] call grad_publictransport_fnc_assignRoute;
*/

params ["_driver", "_line"];

_driver setVariable ["GRAD_publicTransport_currentLine", _line];
[_driver, _line] call GRAD_publicTransport_fnc_waypointGetNext;
Empty file.
@@ -1,4 +1,4 @@
private ["_mapCenter", "_stationMapObjects", "_stationsArray"];
/* private ["_mapCenter", "_stationMapObjects", "_stationsArray"];
_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
@@ -17,4 +17,6 @@ _stationsPosArray = [];
// [getPos _x, _station select 1] call GRAD_publicTransport_fnc_createDebugMarker;
} foreach _stationMapObjects;
_sortedStationsPosArray = [_stationsPosArray] call GRAD_publicTransport_fnc_sortByDistance;
_sortedStationsPosArray = [_stationsPosArray] call GRAD_publicTransport_fnc_sortByDistance;
*/
@@ -0,0 +1,19 @@
params ["_pos", "_dir"];

private ["_station", "_stations", "_foundStation"];

_stations = (nearestTerrainObjects [_pos, [ "BUSSTOP"], 16]);
_foundStation = false;
_station = objNull;

if (count _stations > 0) then {
_station = _stations select 0;

if ([_pos, _station, _dir] call GRAD_publicTransport_fnc_isOnRightSide) then {
_foundStation = true;
};
};

diag_log format ["found station is %1", _foundStation];

[_foundStation, _station]
@@ -0,0 +1,9 @@
params ["_array"];

private ["_inverted"];


_inverted = + _array;
reverse _inverted;

_inverted

This file was deleted.

This file was deleted.

@@ -0,0 +1,19 @@
/*
checks side relative to road
*/

params ["_pos", "_obj", "_traveldirection"];


_relDir = (_pos getDir _obj) + _traveldirection;
// _roadDir = getDir _road;

_isOnRight = true;

if ((_relDir > 180 && _relDir < 360) || (_relDir < 0 && _relDir > -180)) then {
_isOnRight = false;
_isOnRight
} else {
diag_log format ["_reldir is %1", _reldir];
_isOnRight
};

This file was deleted.

@@ -0,0 +1,26 @@
params ["_driver", "_busline"];

_busline = _driver getVariable ["GRAD_publicTransport_currentLine", 1];
_currentStationIndex = _driver getVariable ["GRAD_publicTransport_currentStationIndex", 0];
_allStations = missionNamespace getVariable ["GRAD_publicTransport_Stations_Line_" + (str _busline), []];

_stationCount = count (_allStations select 0);
_nextStationIndex = 0;


if (_stationCount == 0) exitWith { diag_log format ["no stations found"]; };


if (_currentStationIndex >= _stationCount - 1) then {
_nextStationIndex = 0;
_currentStationIndex = _driver setVariable ["GRAD_publicTransport_currentStationIndex", _nextStationIndex];

hintsilent format ["resetting currentstationindex"];

} else {
_nextStationIndex = _currentStationIndex + 1;
_currentStationIndex = _driver setVariable ["GRAD_publicTransport_currentStationIndex", _nextStationIndex];
};

_nextPosition = getPos (_allStations select 0 select _nextStationIndex);
[_driver, _nextPosition] call GRAD_publicTransport_fnc_waypointsCreate;
@@ -0,0 +1,15 @@
params ["_waypoint"];

// this refers to the group leader
// thisList refers to an array containing each unit in the group

_waypoint setWaypointStatements [
"true",
"
[this] spawn grad_publicTransport_fnc_waitForPassengers;
"];

_waypoint setWaypointTimeout [0,0.25,0.5];

_waypoint setWaypointSpeed "NORMAL"; // todo adjust to behaviour
@@ -0,0 +1,5 @@
params ["_driver", "_pos"];

_wp = (group _driver) addWaypoint [_pos, 0];

[_wp] call grad_publicTransport_fnc_waypointSetStatements;
@@ -1 +1,15 @@
call GRAD_publicTransport_fnc_findStations;
/*
pathfinding by coding @armaworld.de
*/

[] execVM "grad_publicTransport\functions\bus\pathfinding_by_coding\init.sqf";

/*
{
[_x, 0] call GRAD_publicTransport_fnc_createDebugMarker;
} forEach _waypoints;
*/

// call GRAD_publicTransport_fnc_findStations;
@@ -5,30 +5,37 @@ class EditorData
angleGridStep=0.2617994;
scaleGridStep=1;
autoGroupingDist=10;
toggles=129;
toggles=1;
class ItemIDProvider
{
nextID=12;
nextID=17;
};
class MarkerIDProvider
{
nextID=2;
};
class Camera
{
pos[]={5472.1094,11.252889,2392.7688};
dir[]={-0.088900626,-0.54705369,0.83240122};
up[]={-0.058094364,0.83708829,0.54396236};
aside[]={0.99437636,5.0514063e-007,0.10619798};
pos[]={5038.3955,31.990007,2298.4297};
dir[]={0.016381741,-0.38768303,0.92164898};
up[]={0.00688976,0.92179269,0.38762328};
aside[]={0.99984479,1.4797479e-009,-0.0177716};
};
};
binarizationWanted=0;
addons[]=
{
"po_factions_me",
"rds_A2_Civilians"
"rds_A2_Civilians",
"A3_Ui_F",
"A3_Characters_F",
"CUP_Wheeled_SUV"
};
class AddonsMetaData
{
class List
{
items=2;
items=5;
class Item0
{
className="po_factions_me";
@@ -42,6 +49,25 @@ class AddonsMetaData
author="reyhard";
url="https://forums.bistudio.com/topic/170165-rds-a2-civilian-pack/";
};
class Item2
{
className="A3_Ui_F";
name="Arma 3 - User Interface";
author="Bohemia Interactive";
url="http://www.arma3.com";
};
class Item3
{
className="A3_Characters_F";
name="Arma 3 Alpha - Characters and Clothing";
author="Bohemia Interactive";
url="http://www.arma3.com";
};
class Item4
{
className="CUP_Wheeled_SUV";
name="CUP_Wheeled_SUV";
};
};
};
randomSeed=14391927;
@@ -75,7 +101,7 @@ class Mission
};
class Entities
{
items=3;
items=7;
class Item0
{
dataType="Group";
@@ -88,7 +114,7 @@ class Mission
dataType="Object";
class PositionInfo
{
position[]={5469.0283,6.9914408,2395.4199};
position[]={5061.418,6.9914465,2359.6321};
angles[]={0,2.6692157,0};
};
side="Civilian";
@@ -111,8 +137,8 @@ class Mission
dataType="Object";
class PositionInfo
{
position[]={5472.9287,8.8797884,2392.3481};
angles[]={0,4.6697931,0};
position[]={5029.2109,8.8797941,2326.1235};
angles[]={0,6.265481,0};
};
side="Civilian";
flags=6;
@@ -134,8 +160,8 @@ class Mission
dataType="Object";
class PositionInfo
{
position[]={5472.9287,6.9914408,2392.3982};
angles[]={0,4.6697931,0};
position[]={5029.2109,6.9914465,2326.1736};
angles[]={0,6.265481,0};
};
side="Civilian";
flags=7;
@@ -172,5 +198,92 @@ class Mission
};
id=10;
};
class Item3
{
dataType="Marker";
position[]={5027.2646,2.1565774e+021,2362.3359};
name="start";
type="mil_start";
id=12;
atlOffset=2.1565774e+021;
};
class Item4
{
dataType="Marker";
position[]={4796.4429,2.9632136e+031,3593.3086};
name="end";
type="mil_end";
id=13;
atlOffset=2.9632136e+031;
};
class Item5
{
dataType="Group";
side="Civilian";
class Entities
{
items=1;
class Item0
{
dataType="Object";
class PositionInfo
{
position[]={5334.2734,6.9914947,1899.826};
angles[]={0,5.7941504,0};
};
side="Civilian";
flags=6;
class Attributes
{
};
id=16;
type="C_man_hunter_1_F";
atlOffset=5.3882599e-005;
};
};
class Attributes
{
};
class CrewLinks
{
class LinkIDProvider
{
nextID=1;
};
class Links
{
items=1;
class Item0
{
linkID=0;
item0=16;
item1=15;
class CustomData
{
role=1;
};
};
};
};
id=14;
atlOffset=5.3405762e-005;
};
class Item6
{
dataType="Object";
class PositionInfo
{
position[]={5334.2847,8.0263863,1899.5326};
angles[]={0,5.7941504,0};
};
side="Civilian";
flags=6;
class Attributes
{
};
id=15;
type="CUP_C_SUV_TK";
atlOffset=5.3405762e-005;
};
};
};