-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathfn_sites_create_artillery_site.sqf
More file actions
89 lines (75 loc) · 2.74 KB
/
Copy pathfn_sites_create_artillery_site.sqf
File metadata and controls
89 lines (75 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
File: fn_zones_create_artillery_site.sqf
Author: Savage Game Design
Public: No
Description:
Creates an artillery site in the given zone.
Parameter(s):
_zone - Zone marker name [STRING]
Returns:
Task Data store [NAMESPACE]
Example(s):
["zone_saigon"] call vn_mf_fnc_zones_create_artillery_site
*/
params ["_siteObj"];
[
"artillery",
_siteObj,
//Setup Code
{
params ["_siteStore"];
private _siteId = _siteStore getVariable "site_id";
private _siteType = _siteStore getVariable "site_type";
private _spawnPos = (getPos _siteStore) vectorMultiply [1, 1, 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 ["%1_%2", _siteType, _siteId], _markerPos];
_artilleryMarker setMarkerType "o_art";
_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 ["%1_%2_partial", _siteType, _siteId], _partialPos];
_partialMarker setMarkerSize [400, 400];
_partialMarker setMarkerShape "ELLIPSE";
_partialMarker setMarkerText format ["Suspected %1", _baseMarkerText];
_partialMarker setMarkerColor "ColorRed";
_partialMarker setMarkerAlpha 0; // hiden at spawn 0.3
_siteStore setVariable ["aiObjectives", _objectives];
_siteStore setVariable ["mortars", [_mortar]];
_siteStore setVariable ["markers", [_artilleryMarker], true];
_siteStore setVariable ["partialMarkers", [_partialMarker], true];
},
//Teardown condition check code
{
//Check if we need to teardown every 15 seconds.
15 call _fnc_periodicallyAttemptTeardown;
},
//Teardown condition
{
params ["_siteStore"];
//Teardown when all guns destroyed
(_siteStore getVariable "mortars" findIf {alive _x} == -1)
},
//Teardown code
{
params ["_siteStore"];
{
deleteMarker _x;
} forEach ((_siteStore getVariable "markers") + (_siteStore getVariable "partialMarkers"));
{
deleteVehicle _x;
} forEach ((_siteStore getVariable "mortars"));
{
[_x] call para_s_fnc_ai_obj_finish_objective;
} forEach (_siteStore getVariable ["aiObjectives", []]);
}
] call vn_mf_fnc_sites_create_site;