Skip to content

Commit 2abf0c5

Browse files
authored
Updated airport, changed vehiclesSpawner function (#146)
1 parent c1d1e49 commit 2abf0c5

File tree

4 files changed

+434
-760
lines changed

4 files changed

+434
-760
lines changed

Olympus.Stratis/functions/fn_featureOverview.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ _player createDiaryRecord ["features", ["Environment Controller", "
2424

2525
_player createDiaryRecord ["features", ["Vehicle Spawner", "
2626
<br/><img image='x\tacr\addons\images\olympus\feature\vehicleSpawn.jpg' width='300' height='350'/>
27-
<br/>The main base has a <marker name = 'tac_olympus_vehicleSpawnerMarker'>vehicle spawner</marker> that allows you to spawn and delete various vehicles.
27+
<br/>The main base has a <marker name = 'TAC_Olympus_vehicleSpawnerMarker'>vehicle spawner</marker> that allows you to spawn and delete various vehicles.
28+
<br/>The airfield also has 2 spawners for aircraft, they are functionally the same.
2829
"]];
2930

3031
_player createDiaryRecord ["features", ["Chat Commands", "

Olympus.Stratis/functions/fn_vehicleSpawner.sqf

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,49 @@
55
*
66
* Arguments:
77
* 0: Controller <OBJECT>
8+
* 1: Spawn Position <OBJECT>
9+
* 2: Type <STRING>
810
*
911
* Return Value:
1012
* None
1113
*
1214
* Example:
13-
* [this, spawnPad] call TAC_Olympus_fnc_vehicleSpawner
15+
* [this, spawnPad, "ground"] call TAC_Olympus_fnc_vehicleSpawner
1416
*/
1517

16-
params ["_controller", "_spawnPos"];
17-
18-
// Make empty marker for featureOverview
19-
createMarker [QGVAR(vehicleSpawnerMarker), _controller];
18+
params ["_controller", "_spawnPos", "_type"];
19+
20+
private _groundVehicles = [
21+
// "classname"
22+
"tacs_Arcadian_B_Black",
23+
"tacs_Arcadian_B_Green",
24+
"tacs_Arcadian_B_Tan",
25+
"B_LSV_01_unarmed_F",
26+
"C_SUV_01_F",
27+
"C_Offroad_01_F",
28+
"C_Offroad_01_covered_F",
29+
"C_Offroad_02_unarmed_F",
30+
"C_Van_02_transport_F"
31+
];
32+
33+
private _airVehicles = [
34+
// "classname"
35+
"tacs_MELB_B_MH6M_Theseus_Black",
36+
"tacs_MELB_B_AH6M_L_Theseus_Black",
37+
"tacs_MELB_B_AH6M_M_Theseus_Black",
38+
"tacs_MELB_B_AH6M_H_Theseus_Black",
39+
"CUP_B_UH60M_US",
40+
"B_Heli_Transport_03_F",
41+
"C_Plane_Civil_01_racing_F",
42+
"B_T_VTOL_01_infantry_F"
43+
];
44+
45+
private _allowedVehicles = [];
46+
switch (_type) do {
47+
case "ground": { _allowedVehicles = _groundVehicles; };
48+
case "air": { _allowedVehicles = _airVehicles; };
49+
default { _allowedVehicles = _groundVehicles; };
50+
};
2051

2152
private _spawnAction = [
2253
QGVAR(SpawnVehicle),
@@ -25,20 +56,7 @@ private _spawnAction = [
2556
{},
2657
{true},
2758
{
28-
(_this select 2) params ["_controller", "_spawnPos"];
29-
30-
private _allowedVehicles = [
31-
// "classname"
32-
"tacs_Arcadian_B_Black",
33-
"tacs_Arcadian_B_Green",
34-
"tacs_Arcadian_B_Tan",
35-
"B_LSV_01_unarmed_F",
36-
"C_SUV_01_F",
37-
"C_Offroad_01_F",
38-
"C_Offroad_01_covered_F",
39-
"C_Offroad_02_unarmed_F",
40-
"C_Van_02_transport_F"
41-
];
59+
(_this select 2) params ["_controller", "_spawnPos", "_allowedVehicles"];
4260

4361
private _actions = [];
4462
{
@@ -52,20 +70,22 @@ private _spawnAction = [
5270
{
5371
(_this select 2) params ["_controller", "_spawnPos", "_classname"];
5472

55-
if (count (_spawnPos nearEntities 5) == 1) then {
73+
if (count (_spawnPos nearEntities 5) == 0) then {
5674
private _spawnedVehicle = createVehicle [_classname, _spawnPos, [], 0, "CAN_COLLIDE"];
57-
_spawnedVehicle setDir 60;
75+
_spawnedVehicle setDir (getDir _spawnPos);
5876
clearItemCargoGlobal _spawnedVehicle;
5977
clearBackpackCargoGlobal _spawnedVehicle;
6078
clearWeaponCargoGlobal _spawnedVehicle;
6179
clearMagazineCargoGlobal _spawnedVehicle;
6280
_spawnedVehicle addItemCargoGlobal ["ToolKit", 1];
63-
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
64-
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
81+
if (_object isKindOf "LandVehicle") then {
82+
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
83+
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
84+
};
6585

66-
private _spawnedVehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
86+
private _spawnedVehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
6787
_spawnedVehicles pushBack [_spawnedVehicle, name player];
68-
_controller setVariable [QGVAR(SpawnedVehicles), _spawnedVehicles, true];
88+
GVAR(spawnedVehiclesNamespace) setVariable [QGVAR(SpawnedVehicles), _spawnedVehicles, true];
6989
} else {
7090
["Could not spawn vehicle, there is already a vehicle on the spawn position"] call CBA_fnc_notify;
7191
};
@@ -80,7 +100,7 @@ private _spawnAction = [
80100

81101
_actions
82102
},
83-
[_controller, _spawnPos]
103+
[_controller, _spawnPos, _allowedVehicles]
84104
] call ACEFUNC(interact_menu,createAction);
85105

86106
[_controller, 0, ["ACE_MainActions"], _spawnAction] call ACEFUNC(interact_menu,addActionToObject);
@@ -93,13 +113,13 @@ private _removeAction = [
93113
{
94114
(_this select 2) params ["_controller"];
95115

96-
private _spawnedVehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
116+
private _spawnedVehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
97117
!(_spawnedVehicles isEqualTo [])
98118
},
99119
{
100120
(_this select 2) params ["_controller"];
101121

102-
private _spawnedvehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
122+
private _spawnedvehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
103123

104124
private _actions = [];
105125
{
@@ -115,9 +135,9 @@ private _removeAction = [
115135

116136
if ((crew _vehicle) isEqualTo []) then {
117137
deleteVehicle _vehicle;
118-
private _spawnedvehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
138+
private _spawnedvehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
119139
_spawnedvehicles deleteAt (_spawnedVehicles find [_vehicle, _playerName]);
120-
_controller setVariable [QGVAR(spawnedVehicles), _spawnedvehicles, true];
140+
GVAR(spawnedVehiclesNamespace) setVariable [QGVAR(spawnedVehicles), _spawnedvehicles, true];
121141
} else {
122142
["Could not delete vehicle, there are still people in the vehicle"] call CBA_fnc_notify;
123143
};

Olympus.Stratis/initServer.sqf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
#include "script_component.hpp"
2+
13
//Removes corpse after disconnect.
24
addMissionEventHandler ["HandleDisconnect", {
35
deleteVehicle (_this select 0);
46
}];
7+
8+
GVAR(spawnedVehiclesNamespace) = true call CBA_fnc_createNamespace;
9+
publicVariable QGVAR(spawnedVehiclesNamespace)

0 commit comments

Comments
 (0)