Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106,403 changes: 106,325 additions & 78 deletions maps/vn_the_bra/mission.sqm

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions mission/config/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,8 @@ class CfgFunctions
class sites_create_hq {};

// Composition and entity spawning
class create_aa_emplacement {};
class create_camp_buildings {};
class create_hq_buildings {};
class create_mortar {};

//Supporting functions
class sites_aa_reveal_targets {};
Expand Down
3 changes: 3 additions & 0 deletions mission/functions/core/fn_marker_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ vn_mf_markers_wreck_recovery = [];
vn_mf_markers_no_harass = [];

{
if (_x find "site_index_" isEqualTo 0) then {
deleteMarker _x;
};
if (_x find "mf_respawn_" isEqualTo 0) then {
vn_mf_markers_base_respawns pushBack _x;
};
Expand Down
30 changes: 0 additions & 30 deletions mission/functions/systems/sites/fn_create_aa_emplacement.sqf

This file was deleted.

28 changes: 0 additions & 28 deletions mission/functions/systems/sites/fn_create_mortar.sqf

This file was deleted.

6 changes: 5 additions & 1 deletion mission/functions/systems/sites/fn_scout_action.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ private _distanceTexts = [
private _fnc_siteToDrawableIcon = {
private _distance = getPos _this distance2D _playerRef;
private _isDiscovered = _this getVariable ["discovered", false];
private _text = if (_isDiscovered) then { toUpper (_this getVariable ["site_type", ""]) } else { "???" };

// PR COMMENT: @dijksterhuis: lookup site type name from stringtable
// PR COMMENT: @dijksterhuis: allows custom site types to have different names rendered
private _stringtableKey = format ["STR_vn_mf_site_type_name_long_%1", _this getVariable ["site_type", "err"]];
private _text = if (_isDiscovered) then { toUpper (localize _stringtableKey) } else { "???" };
// Full opacity up to X metres, then starts reducing linearly.
private _opacity = 1 - ((_distance - 200 max 0) / vn_mf_scout_max_distance);
private _distanceText = _distanceTexts select (_distanceTexts findIf {_x # 0 >= _distance}) select 1;
Expand Down
45 changes: 16 additions & 29 deletions mission/functions/systems/sites/fn_sites_create_aa_site.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,54 @@
["zone_saigon"] call vn_mf_fnc_zones_create_aa_site
*/

params ["_pos"];
params ["_siteObj"];

[
"aa",
_pos,
_siteObj,
//Setup Code
{
params ["_siteStore"];
private _siteId = _siteStore getVariable "site_id";
private _sitePos = getPos _siteStore;
private _spawnPos = _sitePos;
private _siteType = _siteStore getVariable "site_type";
private _spawnPos = (getPos _siteStore) vectorMultiply [1, 1, 0];

private _result = [_spawnPos, "HEAVY"] call vn_mf_fnc_create_aa_emplacement;
private _createdThings = _result select 0;
private _cls = selectRandom ["vn_o_nva_static_zpu4"];
private _aaGun = createVehicle [_cls, _spawnPos, [], 0, "CAN_COLLIDE"];
[_aaGun, true] call para_s_fnc_enable_dynamic_sim;

private _baseMarkerText = localize (format ["STR_vn_mf_site_type_name_short_%1", _siteType]);
//Create an AA warning marker.
private _markerPos = _spawnPos getPos [5 + random 10, random 360];
private _aaZoneMarker = createMarker [format ["AA_zone_%1", _siteId], _markerPos];
private _aaZoneMarker = createMarker [format ["%1_%2", _siteType, _siteId], _markerPos];
_aaZoneMarker setMarkerSize [1000, 1000];
_aaZoneMarker setMarkerShape "ELLIPSE";
_aaZoneMarker setMarkerBrush "DiagGrid";
_aaZoneMarker setMarkerColor "ColorRed";
// hiden at spawn 0.3
_aaZoneMarker setMarkerAlpha 0;


// create partially discovered marker
private _partialPos = _spawnPos getPos [10 + random 40, random 360];
private _partialMarker = createMarker [format ["AA_zone_%1_partial", _siteId], _partialPos];
private _partialMarker = createMarker [format ["%1_%2_partial", _siteType, _siteId], _partialPos];
_partialMarker setMarkerSize [400, 400];
_partialMarker setMarkerShape "ELLIPSE";
_partialMarker setMarkerText "Suspected AA";
_partialMarker setMarkerText format ["Suspected %1", _baseMarkerText];
_partialMarker setMarkerColor "ColorRed";
_partialMarker setMarkerAlpha 0; // hiden at spawn 0.3

private _aaMarker = createMarker [format ["AA_%1", _siteId], _markerPos];
private _aaMarker = createMarker [format ["%1_%2", _siteType, _siteId], _markerPos];
_aaMarker setMarkerType "o_antiair";
_aaMarker setMarkerText "AA";
_aaMarker setMarkerText _baseMarkerText;
// hiden at spawn 0.5
_aaMarker setMarkerAlpha 0;

private _vehicles = _createdThings select 0;
private _groups = _createdThings select 1;
{
[_x, true] call para_s_fnc_enable_dynamic_sim;
} forEach (_vehicles + _groups);

private _guns = _result select 1;
private _objectives = [];
{
_objectives pushBack ([_x] call para_s_fnc_ai_obj_request_crew);
} forEach _guns;
_objectives pushBack ([_aaGun] call para_s_fnc_ai_obj_request_crew);
_objectives pushBack ([_spawnPos, 2, 3] call para_s_fnc_ai_obj_request_defend);

_siteStore setVariable ["aiObjectives", _objectives];
_siteStore setVariable ["aaGuns", _guns];
_siteStore setVariable ["vehicles", _vehicles];
_siteStore setVariable ["units", (_createdThings select 1)];
_siteStore setVariable ["groups", _groups];


_siteStore setVariable ["aaGuns", [_aaGun]];
_siteStore setVariable ["markers", [_aaZoneMarker, _aaMarker], true];
_siteStore setVariable ["partialMarkers", [_partialMarker], true];
},
Expand All @@ -102,7 +89,7 @@ params ["_pos"];

{
deleteVehicle _x;
} forEach ((_siteStore getVariable "vehicles") + (_siteStore getVariable "units"));
} forEach (_siteStore getVariable "aaGuns");

{
[_x] call para_s_fnc_ai_obj_finish_objective;
Expand Down
52 changes: 19 additions & 33 deletions mission/functions/systems/sites/fn_sites_create_artillery_site.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,46 @@
["zone_saigon"] call vn_mf_fnc_zones_create_artillery_site
*/

params ["_pos"];
params ["_siteObj"];

[
"artillery",
_pos,
_siteObj,
//Setup Code
{
params ["_siteStore"];
private _siteId = _siteStore getVariable "site_id";
private _sitePos = getPos _siteStore;
private _spawnPos = _sitePos;
private _siteType = _siteStore getVariable "site_type";
private _spawnPos = (getPos _siteStore) vectorMultiply [1, 1, 0];

private _result = [_spawnPos] call vn_mf_fnc_create_mortar;
private _createdThings = _result select 0;
private _cls = selectRandom vehicles_vc_mortars;
private _mortar = createVehicle [_cls, _spawnPos, [], 0, "CAN_COLLIDE"];
[_mortar, true] call para_s_fnc_enable_dynamic_sim;
_mortar enableWeaponDisassembly false;

private _objectives = [];
_objectives pushBack ([_mortar] call para_s_fnc_ai_obj_request_crew);
_objectives pushBack ([_spawnPos, 1, 2] call para_s_fnc_ai_obj_request_defend);

private _baseMarkerText = localize (format ["STR_vn_mf_site_type_name_short_%1", _siteType]);
private _markerPos = _spawnPos getPos [random 5, random 360];
private _artilleryMarker = createMarker [format ["Artillery_%1", _siteId], _markerPos];
private _artilleryMarker = createMarker [format ["%1_%2", _siteType, _siteId], _markerPos];
_artilleryMarker setMarkerType "o_art";
_artilleryMarker setMarkerText "Artillery";
_artilleryMarker setMarkerText _baseMarkerText;
// Hiden at spawn 0.5
_artilleryMarker setMarkerAlpha 0;

// create partially discovered marker
private _partialPos = _spawnPos getPos [10 + random 40, random 360];
private _partialMarker = createMarker [format ["artillery_zone_%1_partial", _siteId], _partialPos];
private _partialMarker = createMarker [format ["%1_%2_partial", _siteType, _siteId], _partialPos];
_partialMarker setMarkerSize [400, 400];
_partialMarker setMarkerShape "ELLIPSE";
_partialMarker setMarkerText "Suspected Artillery";
_partialMarker setMarkerText format ["Suspected %1", _baseMarkerText];
_partialMarker setMarkerColor "ColorRed";
_partialMarker setMarkerAlpha 0; // hiden at spawn 0.3

private _vehicles = _createdThings select 0;
{
//Disable weapon dissassembly - statics don't get deleted properly when disassembled, so it breaks the site/mission.
_x enableWeaponDisassembly false;
} forEach _vehicles;
private _groups = _createdThings select 1;
{
[_x, true] call para_s_fnc_enable_dynamic_sim;
} forEach (_vehicles + _groups);

private _mortars = _result select 1;
private _objectives = [];
{
_objectives pushBack ([_x] call para_s_fnc_ai_obj_request_crew);
} forEach _mortars;
_objectives pushBack ([_spawnPos, 1, 2] call para_s_fnc_ai_obj_request_defend);

_siteStore setVariable ["aiObjectives", _objectives];
_siteStore setVariable ["mortars", _mortars];
_siteStore setVariable ["vehicles", _vehicles];
_siteStore setVariable ["units", (_createdThings select 1)];
_siteStore setVariable ["groups", _groups];

_siteStore setVariable ["mortars", [_mortar]];
_siteStore setVariable ["markers", [_artilleryMarker], true];
_siteStore setVariable ["partialMarkers", [_partialMarker], true];
},
Expand All @@ -94,7 +80,7 @@ params ["_pos"];

{
deleteVehicle _x;
} forEach ((_siteStore getVariable "vehicles") + (_siteStore getVariable "units"));
} forEach ((_siteStore getVariable "mortars"));

{
[_x] call para_s_fnc_ai_obj_finish_objective;
Expand Down
23 changes: 10 additions & 13 deletions mission/functions/systems/sites/fn_sites_create_hq.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@
[markerPos "myHq"] call vn_mf_fnc_sites_create_hq
*/

params ["_pos"];
params ["_siteObj"];

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

//Hide all nearby terrain objects.
{
_x hideObjectGlobal true;
} forEach (nearestTerrainObjects [_spawnPos, ["TREE", "BUSH", "SMALL TREE", "ROCK", "ROCKS"], 50, false, true]);
private _siteType = _siteStore getVariable "site_type";
private _spawnPos = (getPos _siteStore) vectorMultiply [1, 1, 0];

private _hqObjects = [_spawnPos] call vn_mf_fnc_create_hq_buildings;
private _objectsToDestroy = _hqObjects select {_x isKindOf "land_vn_pavn_ammo"};
Expand All @@ -40,20 +35,22 @@ params ["_pos"];
[_x, true] call para_s_fnc_enable_dynamic_sim;
} forEach _hqObjects;

private _baseMarkerText = localize (format ["STR_vn_mf_site_type_name_short_%1", _siteType]);

//Create a HQ marker.
private _markerPos = _spawnPos getPos [10 + random 20, random 360];
private _hqMarker = createMarker [format ["HQ_%1", _siteId], _markerPos];
private _hqMarker = createMarker [format ["%1_%2", _siteType, _siteId], _markerPos];
_hqMarker setMarkerType "o_hq";
_hqMarker setMarkerText "HQ";
_hqMarker setMarkerText _baseMarkerText;
// Hide at spawn 0.5
_hqMarker setMarkerAlpha 0;

// create partially discovered marker
private _partialPos = _spawnPos getPos [10 + random 40, random 360];
private _partialMarker = createMarker [format ["hq_zone_%1_partial", _siteId], _partialPos];
private _partialMarker = createMarker [format ["%1_%2_partial", _siteType, _siteId], _partialPos];
_partialMarker setMarkerSize [400, 400];
_partialMarker setMarkerShape "ELLIPSE";
_partialMarker setMarkerText "Suspected HQ";
_partialMarker setMarkerText format ["Suspected %1", _baseMarkerText];
_partialMarker setMarkerColor "ColorRed";
_partialMarker setMarkerAlpha 0; // hiden at spawn 0.3

Expand Down
11 changes: 2 additions & 9 deletions mission/functions/systems/sites/fn_sites_create_site.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Parameter(s):
_type - Name of the type of site [STRING]
_pos - Position to create the site at [ARRAY]
_siteStore - Spawn object created during init [OBJECT]
_setup - Code to set the site up, spawn in assets, etc [CODE]
_setupTeardownConditionTriggers - Code to set up when _teardownCondition should be checked [CODE]
_teardownCondition - Returns true when the site should be torn down (removed) [CODE]
Expand All @@ -20,7 +20,7 @@
Example(s):
[parameter] call vn_fnc_myFunction
*/
params ["_type", "_pos", "_setup", "_setupTeardownConditionTriggers", "_teardownCondition", "_teardown"];
params ["_type", "_siteStore", "_setup", "_setupTeardownConditionTriggers", "_teardownCondition", "_teardown"];

//Give the site a unique ID
private _siteId = missionNamespace getVariable ["site_current_id", 0];
Expand All @@ -29,13 +29,6 @@ missionNamespace setVariable ["site_current_id", _siteId];
publicVariable "site_current_id";

private _siteKey = format ["site_%1", _siteId];

//Create a store for the site data, and save it under the site's id.
//Use a simple object, because sites inherently have a position.
//Therefore simple objects give us much, much more power to run queries (like `inAreaArray`)
private _siteStore = createSimpleObject ["a3\weapons_f\empty.p3d", AGLtoASL _pos, false];
//Make sure we're in exactly the right position.
_siteStore setPos _pos;
missionNamespace setVariable [_siteKey, _siteStore];
publicVariable _siteKey;

Expand Down
Loading