5
5
*
6
6
* Arguments:
7
7
* 0: Controller <OBJECT>
8
+ * 1: Spawn Position <OBJECT>
9
+ * 2: Type <STRING>
8
10
*
9
11
* Return Value:
10
12
* None
11
13
*
12
14
* Example:
13
- * [this, spawnPad] call TAC_Olympus_fnc_vehicleSpawner
15
+ * [this, spawnPad, "ground" ] call TAC_Olympus_fnc_vehicleSpawner
14
16
*/
15
17
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
+ };
20
51
21
52
private _spawnAction = [
22
53
QGVAR(SpawnVehicle),
@@ -25,20 +56,7 @@ private _spawnAction = [
25
56
{},
26
57
{true },
27
58
{
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" ];
42
60
43
61
private _actions = [];
44
62
{
@@ -52,20 +70,22 @@ private _spawnAction = [
52
70
{
53
71
(_this select 2 ) params [" _controller" , " _spawnPos" , " _classname" ];
54
72
55
- if (count (_spawnPos nearEntities 5 ) == 1 ) then {
73
+ if (count (_spawnPos nearEntities 5 ) == 0 ) then {
56
74
private _spawnedVehicle = createVehicle [_classname , _spawnPos , [], 0 , " CAN_COLLIDE" ];
57
- _spawnedVehicle setDir 60 ;
75
+ _spawnedVehicle setDir ( getDir _spawnPos ) ;
58
76
clearItemCargoGlobal _spawnedVehicle ;
59
77
clearBackpackCargoGlobal _spawnedVehicle ;
60
78
clearWeaponCargoGlobal _spawnedVehicle ;
61
79
clearMagazineCargoGlobal _spawnedVehicle ;
62
80
_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
+ };
65
85
66
- private _spawnedVehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
86
+ private _spawnedVehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
67
87
_spawnedVehicles pushBack [_spawnedVehicle , name player ];
68
- _controller setVariable [QGVAR(SpawnedVehicles), _spawnedVehicles , true ];
88
+ GVAR(spawnedVehiclesNamespace) setVariable [QGVAR(SpawnedVehicles), _spawnedVehicles , true ];
69
89
} else {
70
90
[" Could not spawn vehicle, there is already a vehicle on the spawn position" ] call CBA_fnc_notify ;
71
91
};
@@ -80,7 +100,7 @@ private _spawnAction = [
80
100
81
101
_actions
82
102
},
83
- [_controller , _spawnPos ]
103
+ [_controller , _spawnPos , _allowedVehicles ]
84
104
] call ACEFUNC(interact_menu,createAction);
85
105
86
106
[_controller , 0 , [" ACE_MainActions" ], _spawnAction ] call ACEFUNC(interact_menu,addActionToObject);
@@ -93,13 +113,13 @@ private _removeAction = [
93
113
{
94
114
(_this select 2 ) params [" _controller" ];
95
115
96
- private _spawnedVehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
116
+ private _spawnedVehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
97
117
! (_spawnedVehicles isEqualTo [])
98
118
},
99
119
{
100
120
(_this select 2 ) params [" _controller" ];
101
121
102
- private _spawnedvehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
122
+ private _spawnedvehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
103
123
104
124
private _actions = [];
105
125
{
@@ -115,9 +135,9 @@ private _removeAction = [
115
135
116
136
if ((crew _vehicle ) isEqualTo []) then {
117
137
deleteVehicle _vehicle ;
118
- private _spawnedvehicles = _controller getVariable [QGVAR(spawnedVehicles), []];
138
+ private _spawnedvehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
119
139
_spawnedvehicles deleteAt (_spawnedVehicles find [_vehicle , _playerName ]);
120
- _controller setVariable [QGVAR(spawnedVehicles), _spawnedvehicles , true ];
140
+ GVAR(spawnedVehiclesNamespace) setVariable [QGVAR(spawnedVehicles), _spawnedvehicles , true ];
121
141
} else {
122
142
[" Could not delete vehicle, there are still people in the vehicle" ] call CBA_fnc_notify ;
123
143
};
0 commit comments