Skip to content

Commit

Permalink
Merge pull request #391 from dijksterhuis/sites-add-hq-fuel-depot-site
Browse files Browse the repository at this point in the history
Sites: Add Fuel Depot site to HQ supply line.
  • Loading branch information
dijksterhuis authored Sep 13, 2024
2 parents 8583a0c + be88f9c commit 3122893
Show file tree
Hide file tree
Showing 11 changed files with 254 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ build_output
user_paths.py
*.code-workspace
*.pyc
user_paths_example.py
user_paths_example.py
1 change: 1 addition & 0 deletions maps/altis/map_config/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class map_config {
max_water_supply_per_zone = 2;
max_tunnels_per_zone = 3;
max_vehicle_depots_per_zone = 3;
max_fuel_per_zone = 2;
bn_zone_radius = 1000;
class zones {
#include "zones.hpp"
Expand Down
3 changes: 2 additions & 1 deletion maps/cam_lao_nam/map_config/init.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
class map_config {
starting_zones[] = {"zone_ba_ria", "zone_ban_hoang"};
max_camps_per_zone = 9;
max_camps_per_zone = 6;
max_aa_per_zone = 10;
max_artillery_per_zone = 3;
max_fortifications_per_zone = 0;
max_radars_per_zone = 2;
max_water_supply_per_zone = 2;
max_tunnels_per_zone = 3;
max_vehicle_depots_per_zone = 3;
max_fuel_per_zone = 3;
bn_zone_radius = 1000;
class zones {
#include "zones.hpp"
Expand Down
3 changes: 2 additions & 1 deletion maps/vn_khe_sanh/map_config/init.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
class map_config {
max_camps_per_zone = 9;
max_camps_per_zone = 6;
max_aa_per_zone = 10;
max_artillery_per_zone = 3;
max_fortifications_per_zone = 0;
max_tunnels_per_zone = 3;
max_radars_per_zone = 2;
max_water_supply_per_zone = 2;
max_vehicle_depots_per_zone = 3;
max_fuel_per_zone = 3;
starting_zones[] = {"zone_khe_sanh", "zone_kok", "zone_french_fort"};
bn_zone_radius = 1000;
class zones {
Expand Down
3 changes: 2 additions & 1 deletion maps/vn_the_bra/map_config/init.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
class map_config {
max_camps_per_zone = 6;
max_camps_per_zone = 4;
max_aa_per_zone = 5;
max_artillery_per_zone = 4;
max_fortifications_per_zone = 0;
max_tunnels_per_zone = 3;
max_radars_per_zone = 2;
max_water_supply_per_zone = 2;
max_vehicle_depots_per_zone = 3;
max_fuel_per_zone = 2;
starting_zones[] = {"zone_nam_phat", "zone_ban_pakha", "zone_ban_dac_maruk"};
bn_zone_radius = 1000;
class zones {
Expand Down
2 changes: 2 additions & 0 deletions mission/config/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class CfgFunctions
file = "functions\systems\sites\create\compositions";
class sites_create_compositions_aa {};
class sites_create_compositions_camp {};
class sites_create_compositions_fuel {};
class sites_create_compositions_factory {};
class sites_create_compositions_hq {};
class sites_create_compositions_mortar {};
Expand All @@ -370,6 +371,7 @@ class CfgFunctions
class sites_create_site_aa {};
class sites_create_site_artillery {};
class sites_create_site_camp {};
class sites_create_site_fuel {};
class sites_create_site_water_supply {};
class sites_create_site_tunnel {};
class sites_create_site_hq {};
Expand Down
2 changes: 2 additions & 0 deletions mission/functions/systems/actions/fn_action_destroy_task.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ private _conditionToShowString = str {
'vn_o_static_rsna75',
// tunnel
'Land_vn_o_trapdoor_01',
// fuel depot
"Land_vn_tank_rust_f",
// dac cong resapwn
'Land_vn_o_platform_04'
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
File: fn_sites_create_compositions_fuel.sqf
Author: Spoffy
Date: 2020-05-23
Last Update: 2020-07-01
Public: No
Description:
Creates buildings for a PAVN HQ.
Parameter(s):
_position - Position [Position]
Returns: nothing
Example(s): none
0: STRING - Classname
1: ARRAY - Position [delta X, delta Y, z]
2: NUMBER - Azimuth
3: NUMBER - Fuel
4: NUMBER - Damage
5: ARRAY - Return from BIS_fnc_getPitchBank (only if 2nd param is false)
6: STRING - vehicleVarName
7: STRING - Initialization commands
8: BOOLEAN - Enable simulation
9: BOOLEAN - Position is ASL
*/

params ["_position"];

vn_mf_sites_compositions_fuel = [
createHashMapFromArray [
["Author","@legend"],
["TerrainHindingKinds",""],
["MaximumAllowedTerrainGradient",10],
["WaterSpawn",0],
["Name","Fuel-1a"],
["Type","Fuel"],
["Composition",[
["vn_b_prop_prc77_01",[2.22266,-0.302734,0.449738],215.104,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[-1.46094,2.42725,0],191.491,1,0,[0,0],"","",false,false],
["Land_cargo_house_slum_F",[-1.86328,-2.12549,0],204.683,1,0,[0,0],"","",false,false],
["Land_vn_t_albizia_f",[4.73242,1.58057,0],0,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[5.12109,-3.0249,0],89.8582,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[-3.72266,-6.07617,0],5.56971,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[-1.67188,7.10156,-0.0750008],333.306,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[5.01367,5.50195,-0.0750008],20.2401,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_high_01",[2.57617,-7.34326,-0.0750008],159.54,1,0,[0,-0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[-8.32422,-1.521,-0.0750084],225.1,1,0,[0,0],"","",false,false]
]]
],
createHashMapFromArray [
["Author","@legend"],
["TerrainHindingKinds",""],
["MaximumAllowedTerrainGradient",10],
["WaterSpawn",0],
["Name","Fuel-1b"],
["Type","Fuel"],
["Composition",[
["vn_b_prop_prc77_01",[2.22266,-0.302734,0.449738],215.104,1,0,[0,0],"","",false,false],
["Land_cargo_house_slum_F",[-1.86328,-2.12549,0],204.683,1,0,[0,0],"","",false,false],
["Land_vn_t_albizia_f",[4.73242,1.58057,0],0,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[5.12109,-3.0249,0],89.8582,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[-3.72266,-6.07617,0],5.56971,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[-1.67188,7.10156,-0.0750008],333.306,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[5.01367,5.50195,-0.0750008],20.2401,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_high_01",[2.57617,-7.34326,-0.0750008],159.54,1,0,[0,-0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[-8.32422,-1.521,-0.0750084],225.1,1,0,[0,0],"","",false,false]
]]
],
createHashMapFromArray [
["Author","@legend"],
["TerrainHindingKinds",""],
["MaximumAllowedTerrainGradient",10],
["WaterSpawn",0],
["Name","NULL"],
["Type","Fuel-2"],
["Composition",[
["Land_Slum_House02_F",[-0.0839844,-0.458496,0.23],0,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[5.13086,-1.29785,0],270.022,1,0,[0,0],"","",false,false],
["vn_b_prop_prc77_01",[-4.18359,3.57471,0],0,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[-0.541016,-5.87451,0],180.435,1,0,[0,0],"","",false,false],
["vn_o_nva_65_static_zpu4",[-6.4082,-2.09717,-0.0750008],215.041,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[3.18359,6.30322,-0.0750074],33.8837,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[5.31055,-6.63379,-0.0750074],118.87,1,0,[0,-0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[-6.78906,5.25488,-0.0750008],310.753,1,0,[0,0],"","",false,false],
["Land_vn_t_fagussylvatica_2s",[-2.96094,4.39502,0],240.417,1,0,[0,0],"","",false,false]
]]
],
createHashMapFromArray [
["Author","@legend"],
["TerrainHindingKinds",""],
["MaximumAllowedTerrainGradient",10],
["WaterSpawn",0],
["Name","NULL"],
["Type","Fuel-3"],
["Composition",[
["Land_vn_tank_rust_f",[-1.91406,1.28809,0],162.65,1,0,[0,-0],"","",false,false],
["Land_cargo_house_slum_F",[-0.701172,-2.38379,0],163.056,1,0,[0,-0],"","",false,false],
["Land_vn_tank_rust_f",[-2.81836,4.41846,0],163.176,1,0,[0,-0],"","",false,false],
["vn_b_prop_prc77_01",[-4.83789,-2.92773,0],81.246,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[-6.96289,-0.313965,-0.0750074],251.73,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[4.15625,6.48877,-0.0750008],63.4053,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[-2.51953,-7.51855,-0.0750074],207.258,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_high_01",[3.50781,-6.98193,-0.0750008],95.2579,1,0,[0,-0],"","",false,false],
["Land_vn_t_juglansregia_2s",[5.38672,-2.68311,0],0,1,0,[0,0],"","",false,false]
]]
],
createHashMapFromArray [
["Author","@legend"],
["TerrainHindingKinds",""],
["MaximumAllowedTerrainGradient",10],
["WaterSpawn",0],
["Name","NULL"],
["Type","Fuel-4"],
["Composition",[
["Land_vn_tank_rust_f",[1.46094,-1.53857,0],359.268,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[1.48047,1.68408,0],359.268,1,0,[0,0],"","",false,false],
["Land_vn_tank_rust_f",[1.625,-4.88965,0],359.268,1,0,[0,0],"","",false,false],
["Land_vn_slum_house01_f",[-4.31836,-1.29248,0],88.5042,1,0,[0,0],"","",false,false],
["vn_o_nva_65_static_zpu4",[-0.992188,6.56299,-0.0750008],69.7135,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_high_01",[6.71875,0.749023,-0.0750008],95.2579,1,0,[0,-0],"","",false,false],
["vn_b_prop_prc77_01",[-5.7793,-3.94092,0],0,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_dshkm_low_01",[-6.74023,3.5708,-0.0750008],313.581,1,0,[0,0],"","",false,false],
["vn_o_nva_navy_static_m1910_low_01",[-3.65039,-6.8374,-0.0750074],225.1,1,0,[0,0],"","",false,false],
["Land_vn_pine_tree_01",[6.51367,-1.2998,0],0,1,0,[0,0],"","",false,false]
]]
]
];


private _selectedHMap = selectRandom vn_mf_sites_compositions_fuel;

private _randAngle = [1, 360] call BIS_fnc_randomInt;
private _site_objs = [_position, _randAngle, _selectedHMap get "Composition", 0] call BIS_fnc_objectsMapper;

_site_objs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
File: fn_sites_create_site_fuel.sqf
Author: @dijksterhuis
Public: No
Description:
Creates a new Factory site in the given location.
Parameter(s):
_pos - Position to spawn the HQ site at
Returns:
Function reached the end [BOOL]
Example(s):
[markerPos "myHq"] call vn_mf_fnc_sites_create_camp_site
*/

params ["_pos"];

[
"fuel",
_pos,
"hq",
//Setup Code
{
params ["_siteStore"];
private _siteId = _siteStore getVariable "site_id";
private _sitePos = getPos _siteStore;
private _spawnPos = _sitePos;

private _objs = [_spawnPos] call vn_mf_fnc_sites_create_compositions_fuel;

_objs apply {
[_x] call vn_mf_fnc_sites_utils_normalise_object_placement;
[_x] call vn_mf_fnc_sites_object_zfixer_add_object;
[_x, true] call para_s_fnc_enable_dynamic_sim;
};

vn_site_objects append _objs;

private _objectsToDestroy = _objs select {typeOf _x isEqualTo "Land_vn_tank_rust_f"};

private _markerPos = _spawnPos getPos [10 + random 20, random 360];
private _mainMarker = createMarker [format ["Fuel_%1", _siteId], _markerPos];
_mainMarker setMarkerType "o_installation";
_mainMarker setMarkerText "Fuel";
_mainMarker setMarkerAlpha 0;

private _partialMarkerPos = _spawnPos getPos [10 + random 40, random 360];
private _markerPartial = createMarker [format ["PartialFuel_%1", _siteId], _partialMarkerPos];
_markerPartial setMarkerType "o_unknown";
_markerPartial setMarkerAlpha 0;

// 50% chance to spawn an ambush
if (random 1 < 0.5) then {
_siteStore setVariable ["aiObjectives", [[_spawnPos, 0.5, 1] call para_s_fnc_ai_obj_request_ambush]];
};

if (random 1 < 0.25) then {

// create a larger amount of punji traps and fewer larger bigboom mines
private _traps = ([4, ceil random 8] call vn_mf_fnc_range) apply {
createMine [
"vn_mine_punji_02",
_pos,
[],
10
]
};

// deletes the mines once the zone is completed
vn_site_objects append _traps;
};

_siteStore setVariable ["markers", [_mainMarker]];
_siteStore setVariable ["partialMarkers", [_markerPartial]];
_siteStore setVariable ["objectsToDestroy", _objectsToDestroy];
},
//Teardown condition check code
{
//Check if we need to teardown every 15 seconds.
15 call _fnc_periodicallyAttemptTeardown;
},
//Teardown condition
{
params ["_siteStore"];
[_siteStore] call vn_mf_fnc_sites_utils_std_check_teardown;
},
//Teardown code
{
params ["_siteStore"];
[_siteStore] call vn_mf_fnc_sites_utils_std_teardown;
}
] call vn_mf_fnc_sites_create_site;
8 changes: 8 additions & 0 deletions mission/functions/systems/sites/fn_sites_generate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ private _hqPosition = [_center, vn_mf_bn_s_zone_radius, 0, 55, 5, _allTerrainObj
// [_radar, _zone] call vn_mf_fnc_sites_create_radar;
// };

// minimum 3, maximum whatever the config for the map is (6 for cam lao nam)
for "_i" from 1 to (3 + ceil random (vn_mf_s_max_camps_per_zone - 1)) do
{
//[_zoneData] call vn_mf_fnc_sites_create_camp;
private _campSite = [_center, vn_mf_bn_s_zone_radius, 0, 8, 15, _unnaturalObjects] call vn_mf_fnc_sites_get_safe_location;
[_campSite, _zone] call vn_mf_fnc_sites_create_site_camp;
};

// minimum 1, maximum whatever the config for the map is (3 for cam lao nam)
for "_i" from 1 to (1 + ceil random (vn_mf_s_max_fuel_per_zone - 1)) do
{
private _fuelSite = [_center, vn_mf_bn_s_zone_radius, 0, 5, 10, _allTerrainObjects] call vn_mf_fnc_sites_get_safe_location;
[_fuelSite, _zone] call vn_mf_fnc_sites_create_site_fuel;
};

//Create initial artillery emplacements
for "_i" from 1 to (1 + ceil random (vn_mf_s_max_artillery_per_zone - 1)) do
{
Expand Down
1 change: 1 addition & 0 deletions mission/functions/systems/sites/fn_sites_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ vn_mf_s_max_radars_per_zone = getNumber (missionConfigFile >> "map_config" >> "m
vn_mf_s_max_fortifications_per_zone = getNumber (missionConfigFile >> "map_config" >> "max_fortifications_per_zone");
vn_mf_s_max_tunnels_per_zone = getNumber (missionConfigFile >> "map_config" >> "max_tunnels_per_zone");
vn_mf_s_max_vehicle_depots_per_zone = getNumber (missionConfigFile >> "map_config" >> "max_vehicle_depots_per_zone");
vn_mf_s_max_fuel_per_zone = getNumber (missionConfigFile >> "map_config" >> "max_fuel_per_zone");

// factory and HQ have minimum radius of 55.
// Some radars seem to be larger than 55 as well.
Expand Down

0 comments on commit 3122893

Please sign in to comment.