Skip to content

Commit

Permalink
Various fixes fixes and improvements (#176)
Browse files Browse the repository at this point in the history
- `vehicleSpawner` add support for post-spawn command execution .
- `vehicleSpawner` replace covered offroad with Theseus variant.
- `vehicleSpawner` add standard equipment to vehicles by default. closes #175
- Replace `spawnEngineerVehicle` with above mentioned `vehicleSpawner` changes.
- Add vehicle repair stations to engineer course and weapons handling. closes #174 
- Replace airport fuel truck with Theseus variant.
- Attempt to fix stuck ATVs at airport.
- Fix floating Arcadian at driving course.
  • Loading branch information
JoramD0 authored May 6, 2023
1 parent 0b027d5 commit ff61b83
Show file tree
Hide file tree
Showing 6 changed files with 486 additions and 357 deletions.
1 change: 0 additions & 1 deletion Olympus.Stratis/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class CfgFunctions {
class rangeMarksmanTargetGroups;
class resetDamagedObjects;
class setBasicLoadout;
class spawnEngineerVehicle;
class vehicleSpawner;
};
};
Expand Down
97 changes: 0 additions & 97 deletions Olympus.Stratis/functions/fn_spawnEngineerVehicle.sqf

This file was deleted.

111 changes: 76 additions & 35 deletions Olympus.Stratis/functions/fn_vehicleSpawner.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,58 @@
params ["_controller", "_spawnPos", "_type"];

private _groundVehicles = [
// "classname"
"tacs_Arcadian_B_Black",
"tacs_Arcadian_B_Green",
"tacs_Arcadian_B_Tan",
"tacs_Polaris_B_Black",
"C_SUV_01_F",
"tacs_Offroad_B_Black",
"C_Offroad_01_covered_F", // Replace with Theseus variant when it releases
"C_Offroad_02_unarmed_F",
"tacs_Van_Transport_B_Black"
// ["classname", "specialType"]
["tacs_Arcadian_B_Black"],
["tacs_Arcadian_B_Green"],
["tacs_Arcadian_B_Tan"],
["tacs_Polaris_B_Black"],
["C_SUV_01_F"],
["tacs_Offroad_B_Black"],
["tacs_Offroad_B_Covered_Black"],
["C_Offroad_02_unarmed_F"],
["tacs_Van_Transport_B_Black"]
];

private _airVehicles = [
// "classname"
"tacs_MELB_B_MH6M_Theseus_Black",
"tacs_MELB_B_AH6M_L_Theseus_Black",
"tacs_MELB_B_AH6M_M_Theseus_Black",
"tacs_MELB_B_AH6M_H_Theseus_Black",
"tacs_Heli_B_Wildcat_Theseus_Unarmed",
"tacs_Heli_B_Wildcat_Theseus",
"CUP_B_UH60M_US",
"B_Heli_Transport_03_F",
"C_Plane_Civil_01_racing_F",
"B_T_VTOL_01_vehicle_F"
// ["classname", "specialType"]
["tacs_MELB_B_MH6M_Theseus_Black"],
["tacs_MELB_B_AH6M_L_Theseus_Black"],
["tacs_MELB_B_AH6M_M_Theseus_Black"],
["tacs_MELB_B_AH6M_H_Theseus_Black"],
["tacs_Heli_B_Wildcat_Theseus_Unarmed"],
["tacs_Heli_B_Wildcat_Theseus"],
["CUP_B_UH60M_US"],
["B_Heli_Transport_03_F"],
["C_Plane_Civil_01_racing_F"],
["B_T_VTOL_01_vehicle_F"]
];

private _seaVehicles = [
// "classname"
"CUP_B_RHIB_HIL",
"tacs_RHIB_B_Theseus_Black",
"B_Boat_Transport_01_F",
"C_Scooter_Transport_01_F"
// ["classname", "specialType"]
["CUP_B_RHIB_HIL"],
["tacs_RHIB_B_Theseus_Black"],
["B_Boat_Transport_01_F"],
["C_Scooter_Transport_01_F"]
];

private _engineerDestroyVehicles = [
// ["classname", "specialType"]
["B_MRAP_01_F", "engineer_destroy"],
["I_MBT_03_cannon_F", "engineer_destroy"]
];

private _engineerRepairVehicles = [
// ["classname", "specialType"]
["tacs_Arcadian_B_Black", "engineer_repair"]
];

private _allowedVehicles = [];
switch (_type) do {
case "ground": { _allowedVehicles = _groundVehicles; };
case "air": { _allowedVehicles = _airVehicles; };
case "ground" : { _allowedVehicles = _groundVehicles; };
case "air" : { _allowedVehicles = _airVehicles; };
case "sea" : { _allowedVehicles = _seaVehicles; };
case "engineer_destroy" : { _allowedVehicles = _engineerDestroyVehicles };
case "engineer_repair" : { _allowedVehicles = _engineerRepairVehicles };
default { _allowedVehicles = _groundVehicles; };
};

Expand All @@ -71,39 +84,58 @@ private _spawnAction = [

private _actions = [];
{
_x params ["_classname"];
_x params ["_classname", ["_specialType", ""]];
private _vehicleName = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");

private _spawnAction = [
format [QGVAR(spawnAction_%1), _classname],
format ["Spawn %1", _vehicleName],
"",
{
(_this select 2) params ["_controller", "_spawnPos", "_classname"];
(_this select 2) params ["_controller", "_spawnPos", "_classname", "_vehicleName", "_specialType"];

if (count (_spawnPos nearEntities 5) == 0) then {
private _spawnedVehicle = createVehicle [_classname, _spawnPos, [], 0, "CAN_COLLIDE"];
_spawnedVehicle setDir (getDir _spawnPos);

// Set inventory/cargo
clearItemCargoGlobal _spawnedVehicle;
clearBackpackCargoGlobal _spawnedVehicle;
clearWeaponCargoGlobal _spawnedVehicle;
clearMagazineCargoGlobal _spawnedVehicle;
_spawnedVehicle addItemCargoGlobal ["ToolKit", 1];
if (_object isKindOf "LandVehicle") then {
if (_spawnedVehicle isKindOf "LandVehicle") then {
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
["ACE_Wheel", _spawnedVehicle] call ACEFUNC(cargo,loadItem);
};
if (_spawnedVehicle isKindOf "Air") then {
["tacgt_supplies_CanisterFuel_Theseus", _spawnedVehicle] call ACEFUNC(cargo,loadItem); // TODO: REVERT IF GTArmory is not updated.
};

// Type based code execution
private _course = "";
switch (_specialType) do {
case "engineer_destroy" : {
_course = "Engineer";
_spawnedVehicle setVehicleLock "LOCKED";
_spawnedVehicle setVehicleAmmo 0;
};
case "engineer_repair" : {
_course = "Engineer";
_spawnedVehicle setDamage 0.6;
};
default {};
};
private _spawnedVehicles = GVAR(spawnedVehiclesNamespace) getVariable [QGVAR(spawnedVehicles), []];
_spawnedVehicles pushBack [_spawnedVehicle, name player];
_spawnedVehicles pushBack [_spawnedVehicle, name player, _course];
GVAR(spawnedVehiclesNamespace) setVariable [QGVAR(SpawnedVehicles), _spawnedVehicles, true];
} else {
["Could not spawn vehicle, there is already a vehicle on the spawn position"] call CBA_fnc_notify;
};
},
{true},
{},
[_controller, _spawnPos, _classname, _vehicleName]
[_controller, _spawnPos, _classname, _vehicleName, _specialType]
] call ACEFUNC(interact_menu,createAction);

_actions pushBack [_spawnAction, [], _controller];
Expand Down Expand Up @@ -137,12 +169,21 @@ private _removeAction = [

private _actions = [];
{
_x params ["_vehicle", "_playerName"];
_x params ["_vehicle", "_playerName", "_course"];
private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");

private _actionName = "";
if (_course isEqualTo "") then {
_actionName = format ["Remove %1 (%2)", _vehicleName, _playerName];
diag_log _actionName;
} else {
_actionName = format ["[%1] Remove %2 (%3)", _course, _vehicleName, _playerName];
diag_log _actionName;
};

private _removeAction = [
format [QGVAR(removeAction_%1), _vehicle],
format ["Remove %1 (%2)", _vehicleName, _playerName],
_actionName,
"",
{
(_this select 2) params ["_controller", "_vehicle", "_playerName"];
Expand Down
Loading

0 comments on commit ff61b83

Please sign in to comment.