Skip to content

Commit

Permalink
Community 3.7.0 updates (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenceIsFatto authored Sep 15, 2024
1 parent baca9c2 commit 91bf0a3
Show file tree
Hide file tree
Showing 28 changed files with 282 additions and 23 deletions.
3 changes: 3 additions & 0 deletions A3A/addons/core/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ class CfgFunctions
class SUP_SAM {};
class SUP_SAMAvailable {};
class SUP_SAMRoutine {};
class SUP_tank {};
class SUP_tankAvailable {};
class SUP_tankRoutine {};
class SUP_UAV {};
class SUP_UAVRoutine {};
class SUP_QRFVehAirdrop {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Vehicles //
//////////////////////////

["attributeMoreTrucks", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time
["attributeLowAir", true] call _fnc_saveToTemplate; // due to emissions in "the zone" and such, you don't want helis and planes flying around all the time

["ammobox", "B_supplyCrate_F"] call _fnc_saveToTemplate;
Expand Down
16 changes: 9 additions & 7 deletions A3A/addons/core/functions/Base/fn_destroyCity.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ params ["_markerX"];

private _positionX = getMarkerPos _markerX;
private _size = [_markerX] call A3A_fnc_sizeMarker;
private _buildings = _positionX nearobjects ["house",_size];

private _buildings = _positionX nearObjects ["house",_size];

{
if (random 100 < 70) then {
for "_i" from 1 to 7 do {
_x setHit [format ["dam%1",_i],1];
_x setHit [format ["dam %1",_i],1];
};
};
private _hitpoints = getAllHitPointsDamage _x;
if (_hitpoints isEqualTo []) then { continue };
if (random 100 < 30) then { continue };
private _building = _x;
{
_building setHit [_x, 1];
} forEach (_hitpoints # 1 select { _x find "dam" == 0 });
} forEach _buildings;

[_markerX,false] spawn A3A_fnc_blackout;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Arguments:
Return value:
<ARRAY> [vehType, weight, vehType2, weight2, ...]
*/
params ["_side", "_level"];
params ["_side", "_level", ["_tanksOnly", false]];
_level = (_level max 1 min 10) - 1;
private _faction = [A3A_faction_occ, A3A_faction_inv] select (_side == Invaders);

Expand All @@ -31,6 +31,10 @@ private _ltankWeight = [ 0, 10, 15, 25, 30, 35, 30, 25, 20, 15] select _lev
private _vehAA = (_faction get "vehiclesAA") select { A3A_vehicleResourceCosts get _x >= 100 };
if (_vehAA isEqualTo []) then { _tankWeight = _tankWeight + _aaWeight };

[_faction get "vehiclesLightTanks", _ltankWeight] call _fnc_addArrayToWeights;
[_faction get "vehiclesTanks", _tankWeight] call _fnc_addArrayToWeights;
if (_tanksOnly) exitWith { _vehWeights };

// only occupants use militia vehicles?
if (_side == Occupants) then {
[_faction get "vehiclesMilitiaLightArmed", _milCarWeight] call _fnc_addArrayToWeights;
Expand All @@ -40,8 +44,6 @@ if (_side == Occupants) then {
};
};
[_faction get "vehiclesLightArmed", _carWeight] call _fnc_addArrayToWeights;
[_faction get "vehiclesTanks", _tankWeight] call _fnc_addArrayToWeights;
[_faction get "vehiclesLightTanks", _ltankWeight] call _fnc_addArrayToWeights;
[_vehAA, _aaWeight] call _fnc_addArrayToWeights;

_vehWeights;
15 changes: 13 additions & 2 deletions A3A/addons/core/functions/Base/fn_getVehiclesGroundTransport.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,20 @@ private _ltankWeight = [ 0, 0, 15, 25, 30, 35, 30, 25, 20, 15] select _level
// Assumption is that at least one of APC or battle bus exists
if (_faction get "vehiclesTanks" isEqualTo []) then { _tankWeight = _tankWeight + _ltankWeight };
if (_faction get "vehiclesLightTanks" isEqualTo []) then { _ltankWeight = _ltankWeight + _ifvWeight };
if (_faction get "vehiclesIFVs" isEqualTo []) then { _apcWeight = _apcWeight + _ifvWeight };
if (_faction get "vehiclesAPCs" isEqualTo []) then { _lapcWeight = _lapcWeight + _apcWeight };

if (_faction getOrDefault ["attributeMoreTrucks", false]) then {
_truckWeight = [60, 60, 60, 60, 60, 60, 55, 50, 45, 40] select _level;
_lapcWeight = [10, 15, 20, 20, 20, 20, 20, 20, 20, 20] select _level;
_apcWeight = [ 0, 4, 8, 12, 16, 20, 20, 20, 20, 20] select _level;
_ifvWeight = [ 0, 0, 2, 4, 6, 8, 12, 16, 20, 25] select _level;
};

if (_faction get "vehiclesLightAPCs" isEqualTo []) then { _apcWeight = _apcWeight + _lapcWeight/2; _truckWeight = _truckWeight + _lapcWeight/2; };
if (_faction get "vehiclesIFVs" isEqualTo []) then { _apcWeight = _apcWeight + _ifvWeight };
if (_faction get "vehiclesAPCs" isEqualTo []) then {
if (_faction get "vehiclesLightAPCs" isEqualTo []) exitWith { _ifvWeight = _ifvWeight + _apcWeight };
_lapcWeight = _lapcWeight + _apcWeight;
};

// only occupants use militia vehicle types?
if (_side == Occupants) then {
Expand Down
29 changes: 24 additions & 5 deletions A3A/addons/core/functions/CREATE/fn_createAttackForceLand.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Arguments:
<INTEGER> Number of attack/support vehicles to create
<INTEGER> Optional, tier modifier to apply to vehicle selection (Default: 0)
<STRING> Optional, troop type to use (Default: "Normal")
<BOOL> Optional, true to only use tanks (Default: false)
Return array:
<SCALAR> Resources spent
Expand All @@ -24,26 +25,44 @@ Return array:
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()

params ["_side", "_base", "_target", "_resPool", "_vehCount", "_vehAttackCount", ["_tierMod", 0]];
params ["_side", "_base", "_target", "_resPool", "_vehCount", "_vehAttackCount", ["_tierMod", 0], ["_troopType", "Normal"], ["_tanksOnly", false]];
private _targpos = if (_target isEqualType []) then { _target } else { markerPos _target };
private _transportRatio = 1 - _vehAttackCount / _vehCount;

if (_tierMod isEqualTo 0) then {_tierMod = 1};

private _resourcesSpent = 0;
private _vehicles = [];
private _crewGroups = [];
private _cargoGroups = [];

private _transportPool = [_side, tierWar+_tierMod] call A3A_fnc_getVehiclesGroundTransport;
private _supportPool = [_side, tierWar+_tierMod] call A3A_fnc_getVehiclesGroundSupport;
private _transportPool = [];
private _supportPool = [];

// Bandaid fix for whatever was causing everything to break, this seems to work consistently. If _tierMod was 0, even the normal pools would break...
if (_tanksOnly) then {
_transportPool = [_side, 6] call A3A_fnc_getVehiclesGroundTransport;
_supportPool = [_side, 6, true] call A3A_fnc_getVehiclesGroundSupport;
} else {
_transportPool = [_side, tierWar+_tierMod] call A3A_fnc_getVehiclesGroundTransport;
_supportPool = [_side, tierWar+_tierMod, true] call A3A_fnc_getVehiclesGroundSupport;
};

private _numTransports = 0;
private _isTransport = _vehAttackCount < _vehCount; // normal case, first vehicle should be a transport
private _landPosBlacklist = [];

for "_i" from 1 to _vehCount do {
private _vehType = selectRandomWeighted ([_supportPool, _transportPool] select _isTransport);
private _vehType = ObjNull;

// Attempt to grab veh types
_vehType = selectRandomWeighted ([_supportPool, _transportPool] select _isTransport);
if (isNil "_vehType") then {
Error_1("Failed to grab land vehicle, attempting to grab a transport vehicle.", _base);
_vehType = selectRandomWeighted _transportPool;
};

private _vehData = [_vehType, "Normal", _resPool, _landPosBlacklist, _side, _base, _targPos] call A3A_fnc_createAttackVehicle;
private _vehData = [_vehType, _troopType, _resPool, _landPosBlacklist, _side, _base, _targPos] call A3A_fnc_createAttackVehicle;
if !(_vehData isEqualType []) exitWith {
Error_1("Failed to spawn land vehicle at marker %1", _base);
}; // couldn't create for some reason, assume we're out of spawn places?
Expand Down
1 change: 1 addition & 0 deletions A3A/addons/core/functions/Supports/fn_SUP_ASFRoutine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ _plane setVariable ["SupportData", _suppData]; // for use in EHs
private _group = [_side, _plane] call A3A_fnc_createVehicleCrew;
{ [_x, nil, false, _resPool] call A3A_fnc_NATOinit } forEach units _group;
_group deleteGroupWhenEmpty true;
[-10 * count units _group, _side, _resPool] call A3A_fnc_addEnemyResources;

_plane addEventHandler ["Killed", {
params ["_plane"];
Expand Down
1 change: 1 addition & 0 deletions A3A/addons/core/functions/Supports/fn_SUP_CASRoutine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private _group = [_side, _plane] call A3A_fnc_createVehicleCrew;
{ [_x, nil, false, _resPool] call A3A_fnc_NATOinit } forEach units _group;
_group deleteGroupWhenEmpty true;
_group setBehaviourStrong "CARELESS";
[-10 * count units _group, _side, _resPool] call A3A_fnc_addEnemyResources;

_plane setVehicleRadar 1;

Expand Down
1 change: 1 addition & 0 deletions A3A/addons/core/functions/Supports/fn_SUP_UAVRoutine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private _uav = createVehicle [_planeType, _spawnPos, [], 0, "FLY"];
[_side, _uav] call A3A_fnc_createVehicleCrew;
_groupVeh = group driver _uav;
{ [_x, nil, false, _resPool] call A3A_fnc_NATOinit } forEach (crew _uav); // arguable
[-10 * count units _groupVeh, _side, _resPool] call A3A_fnc_addEnemyResources;
[_uav, _side, _resPool] call A3A_fnc_AIVEHinit;
private _gunner = gunner _uav;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ _group deleteGroupWhenEmpty true;
_x disableAI "TARGET";
_x disableAI "AUTOTARGET";
} forEach units _group;
[-10 * count units _group, _side, _resPool] call A3A_fnc_addEnemyResources;

// Should we really have these?
_plane addEventHandler ["Killed", {
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/core/functions/Supports/fn_SUP_artillery.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ A3A_activeSupports pushBack _suppData;
[_reveal, _side, "ARTILLERY", _targPos, _delay] spawn A3A_fnc_showInterceptedSetupCall;

// Vehicle cost + extra support cost for balance
(A3A_vehicleResourceCosts get _vehType) + 200;
(A3A_vehicleResourceCosts get _vehType) + (10 * count units _group) + 200;
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ if (_target isKindOf "Air") exitWith { 0 }; // can't hit air

// Weighted against mortars
if(tierWar < 5) exitWith { 0 };
(tierWar - 4) / 8; // ~12.5% at tier 5, 75% at tier 10
(tierWar - 4) / 12; // ~8.3% at tier 5, 50% at tier 10
2 changes: 1 addition & 1 deletion A3A/addons/core/functions/Supports/fn_SUP_mortar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ A3A_activeSupports pushBack _suppData;
[_reveal, _side, "MORTAR", _targPos, _delay] spawn A3A_fnc_showInterceptedSetupCall;

// Mortar cost (might be free?) + extra support cost for balance
(A3A_vehicleResourceCosts getOrDefault [_vehType, 0]) + 100;
(A3A_vehicleResourceCosts getOrDefault [_vehType, 0]) + (10 * count units _group) + 100;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ if (_target isKindOf "Air") exitWith { 0 }; // can't hit air
// balance this one against artillery
if (tierWar < 2) exitWith { 0 };
if (tierWar < 5 or !("ARTILLERY" in _availTypes)) exitWith { 1 };
1 - (tierWar - 4) / 8; // // 87.5% at tier 5, 25% at tier 10
1 - (tierWar - 4) / 12; // // 91.7% at tier 5, 50% at tier 1
51 changes: 51 additions & 0 deletions A3A/addons/core/functions/Supports/fn_SUP_tank.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* Sets up a land QRF support
Environment: Server, scheduled, internal
Arguments:
<STRING> The (unique) name of the support, mostly for logging
<SIDE> The side from which the support should be sent (occupants or invaders)
<STRING> Resource pool used for this support. Should be "attack" or "defence"
<SCALAR> Maximum resources to spend on this support. Must be greater than zero
<OBJECT|BOOL> Initial target, or "false" for none.
<POSITION> Estimated position of target, or center of target zone
<SCALAR> Reveal value 0-1, higher values mean more information provided about support
<SCALAR> Setup delay time in seconds, if negative will calculate based on war tier
Returns:
<SCALAR> Resource cost of support call, or -1 for failure
*/

#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()

params ["_suppName", "_side", "_resPool", "_maxSpend", "_target", "_targPos", "_reveal", "_delay"];

private _base = [_side, _targPos] call A3A_fnc_availableBasesLand;
if (isNil "_base") exitWith { Info("Tanks cancelled because no land bases available"); -1 };

// Prevent ground QRFs spawning on top of each other. Should be gone after a minute.
[_base, 1] call A3A_fnc_addTimeForIdle;

private _vehCount = 2 min ceil (_maxSpend / 200);
private _estResources = _vehCount * 200;

// Land QRF delay is purely dependent on travel as they're slow enough already
if (_delay < 0) then { _delay = 0 }; // land QRFs slow enough already

private _targArray = [];
if (_target isEqualType objNull and {!isNull _target}) then {
// Should probably put a partial "troops" entry in here too?
A3A_supportStrikes pushBack [_side, "TARGET", _target, time + 1800, 1800, 150*_vehCount];
_targArray = [_target, _targPos];
};

// name, side, suppType, center, radius, [target, targpos]
private _suppData = [_supportName, _side, "TANK", _targPos, 1000, _targArray];
A3A_activeSupports pushBack _suppData;
[_suppData, _resPool, _base, _vehCount, _delay, _estResources] spawn A3A_fnc_SUP_tankRoutine;

private _approxTime = _delay + (markerPos _base distance2D _targPos) / (30 / 3.6); // (badly) estimated travel time
[_reveal, _side, "TANK", _targPos, _approxTime] spawn A3A_fnc_showInterceptedSetupCall;

_estResources; // *estimated* resource cost of vehicles
22 changes: 22 additions & 0 deletions A3A/addons/core/functions/Supports/fn_SUP_tankAvailable.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Get tank support selection weight against target
Arguments:
<OBJECT> Target object
<SIDE> Side to send support from
<SCALAR> Max resource spend (not currently used)
<ARRAY> Array of strings of available types for this faction
Return value:
<SCALAR> Weight value, 0 for unavailable or useless
*/

#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()

params ["_target", "_side", "_maxSpend", "_availTypes"];

if (_target isKindOf "Air") exitWith { 0 }; // can't hit air

if (_target isKindOf "Man") exitWith { 0.001 }; // Don't spawn to attack meatsacks, but re-use active supports

// Against vehicles and statics, use more frequently against more dangerous stuff
private _threat = A3A_groundVehicleThreat getOrDefault [typeOf _target, 0];
0.001 + _threat / 80;
Loading

0 comments on commit 91bf0a3

Please sign in to comment.