From 00c869e483653db2e50153a798f0a1903d47445c Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Tue, 3 Sep 2019 21:43:58 +0200 Subject: [PATCH 1/5] Sector deactivation delay parameter After 5th minute from sector activation time the time required to deactivate will increase for one minute after every minute. Up to the selected limit (5 mins by default). --- .../server/sector/manage_one_sector.sqf | 27 ++++++++++++++++--- .../scripts/shared/fetch_params.sqf | 1 + Missionframework/stringtable.xml | 3 +++ Missionframework/ui/mission_params.hpp | 6 +++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Missionframework/scripts/server/sector/manage_one_sector.sqf b/Missionframework/scripts/server/sector/manage_one_sector.sqf index 09532d0e..485264c2 100644 --- a/Missionframework/scripts/server/sector/manage_one_sector.sqf +++ b/Missionframework/scripts/server/sector/manage_one_sector.sqf @@ -1,3 +1,11 @@ +// base amount of sector lifetime tickets +// if there are no enemies one ticket is removed every SECTOR_TICK_TIME seconds +// 12 * 5 = 60s by default +#define BASE_TICKETS 12 +#define SECTOR_TICK_TIME 5 +// delay in minutes from which addional time will be added +#define ADDITIONAL_TICKETS_DELAY 5 + params ["_sector"]; waitUntil {!isNil "combat_readiness"}; @@ -19,7 +27,8 @@ private _squad2 = []; private _squad3 = []; private _squad4 = []; private _minimum_building_positions = 5; -private _sector_despawn_tickets = 12; +private _sector_despawn_tickets = BASE_TICKETS; +private _maximum_additional_tickets = (KP_liberation_delayDespawnMax * 60 / SECTOR_TICK_TIME) private _popfactor = 1; private _guerilla = false; @@ -162,7 +171,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal _building_ai_max = 0; }; - _vehtospawn = _vehtospawn select {!(isNil "_x")}; + _vehtospawn = _vehtospawn select {!(isNil "_x")}; if (KP_liberation_sectorspawn_debug > 0) then {private _text = format ["[KP LIBERATION] [SECTORSPAWN] Sector %1 (%2) - manage_one_sector calculated -> _infsquad: %3 - _squad1: %4 - _squad2: %5 - _squad3: %6 - _squad4: %7 - _vehtospawn: %8 - _building_ai_max: %9", (markerText _sector), _sector, _infsquad, (count _squad1), (count _squad2), (count _squad3), (count _squad4), (count _vehtospawn), _building_ai_max];_text remoteExec ["diag_log",2];}; @@ -235,7 +244,10 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal if (KP_liberation_sectorspawn_debug > 0) then {private _text = format ["[KP LIBERATION] [SECTORSPAWN] Sector %1 (%2) - populating done at %3", (markerText _sector), _sector, time];_text remoteExec ["diag_log",2];}; + private _activationTime = time; + // sector lifetime loop while {!_stopit} do { + // sector was captured if (([_sectorpos, _local_capture_size] call F_sectorOwnership == GRLIB_side_friendly) && (GRLIB_endgame == 0)) then { if (isServer) then { [_sector] spawn sector_liberated_remote_call; @@ -266,7 +278,14 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal if (([_sectorpos, (([_opforcount] call F_getCorrectedSectorRange) + 300), GRLIB_side_friendly] call F_getUnitsCount) == 0) then { _sector_despawn_tickets = _sector_despawn_tickets - 1; } else { - _sector_despawn_tickets = 12; + // start counting running minutes after ADDITIONAL_TICKETS_DELAY + private _runningMinutes = (floor ((time - _activationTime) / 60)) - ADDITIONAL_TICKETS_DELAY; + private _additionalTickets = (_runningMinutes * BASE_TICKETS); + + // clamp from 0 to "_maximum_additional_tickets" + _additionalTickets = (_additionalTickets max 0) min _maximum_additional_tickets + + _sector_despawn_tickets = BASE_TICKETS + _additionalTickets; }; if (_sector_despawn_tickets <= 0) then { @@ -282,7 +301,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal active_sectors = active_sectors - [_sector]; publicVariable "active_sectors"; }; }; - sleep 5; + sleep SECTOR_TICK_TIME; }; } else { sleep 40; diff --git a/Missionframework/scripts/shared/fetch_params.sqf b/Missionframework/scripts/shared/fetch_params.sqf index 055d49e1..1e6b3737 100644 --- a/Missionframework/scripts/shared/fetch_params.sqf +++ b/Missionframework/scripts/shared/fetch_params.sqf @@ -50,6 +50,7 @@ if(isServer) then { GET_PARAM(KP_liberation_restart, "ServerRestart", 0); GET_PARAM(KP_liberation_respawn_cooldown, "RespawnCooldown", 900); GET_PARAM(KP_liberation_victoryCondition, "VictoryCondition", 0); + GET_PARAM(KP_liberation_delayDespawnMax, "DelayDespawnMax", 5); GET_PARAM_BOOL(KP_liberation_cr_param_buildings, "CR_Building", 0); GET_PARAM_BOOL(KP_liberation_ailogistics, "AiLogistics", 1); diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml index 0996c3a9..f0e144af 100644 --- a/Missionframework/stringtable.xml +++ b/Missionframework/stringtable.xml @@ -2422,6 +2422,9 @@ Remover carga do veículo requisitado 移除載具上的物品 + + Maximum sector deactivation delay (starts increasing after 5th activation minute) + Deployment in progress... Déploiement en cours... diff --git a/Missionframework/ui/mission_params.hpp b/Missionframework/ui/mission_params.hpp index 5e63077d..58b06f3a 100644 --- a/Missionframework/ui/mission_params.hpp +++ b/Missionframework/ui/mission_params.hpp @@ -264,6 +264,12 @@ class Params texts[] = { $STR_PARAMS_ENABLED, $STR_PARAMS_DISABLED }; default = 1; }; + class DelayDespawnMax { + title = $STR_PARAM_DELAY_DESPAWN_MAX; + values[] = {0,5,10,15,30}; + texts[] = {$STR_PARAMS_DISABLED,"5","10", "15","30"}; + default = 5; + }; class Spacer3 { title = ""; values[] = { "" }; From 111e815235c4d69558c122e1e46d13ddc277b849 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Tue, 3 Sep 2019 21:50:18 +0200 Subject: [PATCH 2/5] Add despawn scaling changelog entry --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ede9df14..9bc11cce 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ class Missions * Added: [Swedish Forces Pack](https://steamcommunity.com/sharedfiles/filedetails/?id=826911897) transport configs. Thanks to [Dahlgren](https://github.com/Dahlgren) * Added: Parameter to enable/disable the vanilla A3 dynamic fog behavior. Default enabled, so `fucking_set_fog.sqf` isn't running by default. * Added: Parameter to decide to start the campaign with a FOB container (default, like before) or a FOB truck. +* Added: Sector despawn scaling. The longer sector is activated the longer it de-activates. Configurable as parameter, 5min additional delay max by default. * Updated: Russian localization. Thanks to [DjHaski](https://github.com/DjHaski) * Tweaked: Initial FOB box doesn't have equipment in the inventory anmore. * Tweaked: Height check for mobile respawn now relies on `isTouchingGround` instead of z value of position. From fdaed458bc529c9f3bfaa0e6901fca5c590a2905 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 5 Sep 2019 16:59:56 +0200 Subject: [PATCH 3/5] Apply suggestions from code review Co-Authored-By: Christian --- Missionframework/stringtable.xml | 1 + Missionframework/ui/mission_params.hpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml index f0e144af..e0bbdcca 100644 --- a/Missionframework/stringtable.xml +++ b/Missionframework/stringtable.xml @@ -2424,6 +2424,7 @@ Maximum sector deactivation delay (starts increasing after 5th activation minute) + Maximale Verzögerung zur Sektor Deaktivierung (Beginnt nach 5 Minuten seit Aktivierung) Deployment in progress... diff --git a/Missionframework/ui/mission_params.hpp b/Missionframework/ui/mission_params.hpp index 58b06f3a..697bab84 100644 --- a/Missionframework/ui/mission_params.hpp +++ b/Missionframework/ui/mission_params.hpp @@ -266,8 +266,8 @@ class Params }; class DelayDespawnMax { title = $STR_PARAM_DELAY_DESPAWN_MAX; - values[] = {0,5,10,15,30}; - texts[] = {$STR_PARAMS_DISABLED,"5","10", "15","30"}; + values[] = {0,5,10,15,20,25,30}; + texts[] = {$STR_PARAMS_DISABLED, "5", "10", "15", "20", "25", "30"}; default = 5; }; class Spacer3 { From b3a1a324734d5464ebe17d3d31d4a148b0836cfe Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 6 Sep 2019 12:51:40 +0200 Subject: [PATCH 4/5] Fix missing comma in sector manager --- Missionframework/scripts/server/sector/manage_one_sector.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Missionframework/scripts/server/sector/manage_one_sector.sqf b/Missionframework/scripts/server/sector/manage_one_sector.sqf index 485264c2..8b3bac3f 100644 --- a/Missionframework/scripts/server/sector/manage_one_sector.sqf +++ b/Missionframework/scripts/server/sector/manage_one_sector.sqf @@ -28,7 +28,7 @@ private _squad3 = []; private _squad4 = []; private _minimum_building_positions = 5; private _sector_despawn_tickets = BASE_TICKETS; -private _maximum_additional_tickets = (KP_liberation_delayDespawnMax * 60 / SECTOR_TICK_TIME) +private _maximum_additional_tickets = (KP_liberation_delayDespawnMax * 60 / SECTOR_TICK_TIME); private _popfactor = 1; private _guerilla = false; From 42d733a7822bfa67b3edd59bee703d942a5dd3d6 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 6 Sep 2019 12:55:07 +0200 Subject: [PATCH 5/5] Fix another missing comma in sector manager -_- --- Missionframework/scripts/server/sector/manage_one_sector.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Missionframework/scripts/server/sector/manage_one_sector.sqf b/Missionframework/scripts/server/sector/manage_one_sector.sqf index 8b3bac3f..7fcd3355 100644 --- a/Missionframework/scripts/server/sector/manage_one_sector.sqf +++ b/Missionframework/scripts/server/sector/manage_one_sector.sqf @@ -283,7 +283,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal private _additionalTickets = (_runningMinutes * BASE_TICKETS); // clamp from 0 to "_maximum_additional_tickets" - _additionalTickets = (_additionalTickets max 0) min _maximum_additional_tickets + _additionalTickets = (_additionalTickets max 0) min _maximum_additional_tickets; _sector_despawn_tickets = BASE_TICKETS + _additionalTickets; };