Skip to content

Commit

Permalink
feat(event): add new type, adjust figures, delay between completion a…
Browse files Browse the repository at this point in the history
…nd new event
  • Loading branch information
pridit committed Aug 24, 2023
1 parent 3fced52 commit 9527bc1
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/common/modules.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GVAR(modules) = [
"drag",
"event",
["event_checkpoint", "event\types\checkpoint"],
["event_tower", "event\types\tower"],
"gear",
"gesture",
"halo",
Expand Down
4 changes: 4 additions & 0 deletions diary/handle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ if (hasInterface) then {
if !(isNil QMODULE(mission_main)) then {"<br />The flag generated from completion of main targets <marker name=''>cannot</marker> be used to HALO jump - this is a base facility."} else {""}
]] call FUNC(THIS_MODULE,create);

if (!isNil QMODULE(event)) then {
__submodulePP(event);
};

if (!isNil QMODULE(construction)) then {
__submodulePP(construction);
};
Expand Down
6 changes: 5 additions & 1 deletion event/functions/fn_create.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ _location setVariable [QGVAR(units), _target select 2];

[_position, (_objects + _units)] spawn FUNC(THIS_MODULE,cleanup);

[_type, true] spawn FUNC(THIS_MODULE,create);
_type spawn {
sleep GVAR(event_time_delay);

[_this, true] spawn FUNC(THIS_MODULE,create);
};
}];
} forEach (_target select 2);

Expand Down
2 changes: 1 addition & 1 deletion event/handle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (isServer) then {
_capacity = call compile format ["d_%1_%2_positions", QUOTE(THIS_MODULE), _x];

for "_i" from 1 to (_amount min (count _capacity)) do {
sleep 10;
sleep 3;

[_x] call FUNC(THIS_MODULE,create);
};
Expand Down
9 changes: 6 additions & 3 deletions event/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
GVAR(event_types) = [];

// Minimum distance all players must be before cleaning a cleared event
GVAR(event_distance_cleanup) = 1000;
GVAR(event_distance_cleanup) = 500;

// Minimum distance from any other player before creating event
GVAR(event_distance_create) = 2000;
GVAR(event_distance_create) = 1500;

// Time of delay following an event clearing to process cleanup
// Time following completion before removing the existing creation and any orphans
GVAR(event_time_cleanup) = 600;

// Time following completion to delay next event generation
GVAR(event_time_delay) = 1800;

__cppfln(FUNC(THIS_MODULE,create),THIS_MODULE\functions\fn_create.sqf);
__cppfln(FUNC(THIS_MODULE,cleanup),THIS_MODULE\functions\fn_cleanup.sqf);

Expand Down
13 changes: 13 additions & 0 deletions event/modules/diary.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Vote Module - Diary Submodule
*/

#include "x_macros.sqf"

["Events", [
"<img image='ca\missions_e\scenarios\SPE1_Littlebird.Takistan\overview_littlebird_ca' width='200'/>",
"<br />The resistance you come across during the mission won't be isolated to towns, but across the entire map.",
"<br />A small number of events can be <marker name=''>discovered</marker>, these areas are randomly generated and will be occupied.",
"<br />Simply clearing this resistance will <marker name=''>complete</marker> the event and schedule a new one for creation.",
if !(isNil QMODULE(item)) then {"<br />Additionally, these areas can also provide an opportunity to discover items."} else {""}
]] call FUNC(diary,create);
38 changes: 38 additions & 0 deletions event/types/tower/functions/fn_create.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "x_macros.sqf"
private ["_placement", "_position", "_direction", "_objects", "_group"];

PARAMS_1(_placement);

_position = _placement select 0;
_direction = _placement select 1;

if !([count (nearestObjects [_position, ["Land_tent_east", "Land_Com_tower_ep1"], 2000]), 0] call BIS_fnc_areEqual) exitWith {false};

_objects = [
_position,
_direction,
GVAR(event_tower_composition),
[
["KORD_TK_EP1", "Fort_Crate_wood"],
["SearchLight_TK_EP1", "KORD_high_TK_EP1"],
["TKBasicAmmunitionBox_EP1"],
["TKLaunchers_EP1"],
["ZSU_TK_EP1", "Land_Com_tower_ep1"]
]
] call FUNC(server,objectMapper);

_group = [
_position,
east,
(configFile >> "CfgGroups" >> "East" >> "BIS_TK" >> "Infantry" >> "TK_InfantrySectionAA")
] call FUNC(server,spawnGroup);

if !(isNil QMODULE(unit)) then {
[_group, _position] call FUNC(unit,defend);
};

[
_position,
_objects,
units _group
]
46 changes: 46 additions & 0 deletions event/types/tower/init.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Event - Tower Module
*
* Description: This module is responsible for handling the event
* to create TK occupied communication towers with AA.
*/

#define THIS_MODULE event_tower
#include "x_macros.sqf"

// Add to the list of possible types of events
[GVAR(event_types), "Tower"] call BIS_fnc_arrayPush;

// Set minimum number of events of this type to exist
GVAR(event_tower_amount) = 2;

// Set composition of the event
GVAR(event_tower_composition) = "AntiAir1_TK_EP1";

// Set possible positions to generate the event at
GVAR(event_tower_positions) = [
[[-112.213,9524.68,0], random 360],
[[1029.54,4594.24,0], random 360],
[[2268.7,8594.85,0], random 360],
[[2634.34,4084.24,0], random 360],
[[2657.21,3852.52,0], random 360],
[[3129.69,11815,0], random 360],
[[3251.33,1356.75,0], random 360],
[[3609.56,1905.61,0], random 360],
[[3905.07,6887.76,0], random 360],
[[5088.56,2666.48,0], random 360],
[[5728.15,4094.09,0], random 360],
[[5934.88,5056.68,0], random 360],
[[6172.33,3699.6,0], random 360],
[[6578.21,6793.1,0], random 360],
[[6935.34,5360.3,0], random 360],
[[7775.62,5299.46,0], random 360],
[[9439.07,5694.56,0], random 360],
[[11056.2,7070.5,0], random 360],
[[11508.5,4465.03,0], random 360],
[[12503.6,8062.73,0], random 360]
];

__cppfln(FUNC(THIS_MODULE,create),event\types\tower\functions\fn_create.sqf);

MODULE(THIS_MODULE) = true;

0 comments on commit 9527bc1

Please sign in to comment.