initial files
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
params [ "_thispos" ];
|
||||
private [ "_attacktime", "_ownership", "_grp" ];
|
||||
|
||||
sleep 5;
|
||||
|
||||
_ownership = [ _thispos ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership != GRLIB_side_enemy ) exitWith {};
|
||||
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
_grp = creategroup [GRLIB_side_friendly, true];
|
||||
{
|
||||
[_x, _thispos, _grp] call KPLIB_fnc_createManagedUnit;
|
||||
} foreach blufor_squad_inf;
|
||||
sleep 3;
|
||||
_grp setBehaviour "COMBAT";
|
||||
};
|
||||
|
||||
sleep 60;
|
||||
|
||||
KPLIB_sectorsUnderAttack pushBack _thispos;
|
||||
publicVariable "KPLIB_sectorsUnderAttack";
|
||||
|
||||
_ownership = [ _thispos ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership == GRLIB_side_friendly ) exitWith {
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
{
|
||||
if ( alive _x ) then { deleteVehicle _x };
|
||||
} foreach units _grp;
|
||||
};
|
||||
};
|
||||
|
||||
[_thispos, 1] remoteExec ["remote_call_fob"];
|
||||
_attacktime = GRLIB_vulnerability_timer;
|
||||
|
||||
while { _attacktime > 0 && ( _ownership == GRLIB_side_enemy || _ownership == GRLIB_side_resistance ) } do {
|
||||
_ownership = [ _thispos ] call KPLIB_fnc_getSectorOwnership;
|
||||
_attacktime = _attacktime - 1;
|
||||
sleep 1;
|
||||
};
|
||||
|
||||
waitUntil {
|
||||
sleep 1;
|
||||
[ _thispos ] call KPLIB_fnc_getSectorOwnership != GRLIB_side_resistance;
|
||||
};
|
||||
|
||||
if ( GRLIB_endgame == 0 ) then {
|
||||
if ( _attacktime <= 1 && ( [ _thispos ] call KPLIB_fnc_getSectorOwnership == GRLIB_side_enemy ) ) then {
|
||||
[_thispos, 2] remoteExec ["remote_call_fob"];
|
||||
sleep 3;
|
||||
GRLIB_all_fobs = GRLIB_all_fobs - [_thispos];
|
||||
publicVariable "GRLIB_all_fobs";
|
||||
reset_battlegroups_ai = true;
|
||||
[_thispos] call KPLIB_fnc_destroyFob;
|
||||
[] spawn KPLIB_fnc_doSave;
|
||||
stats_fobs_lost = stats_fobs_lost + 1;
|
||||
} else {
|
||||
[_thispos, 3] remoteExec ["remote_call_fob"];
|
||||
{[_x] spawn prisonner_ai;} foreach ((_thispos nearEntities ["Man", GRLIB_capture_size * 0.8]) select {side group _x == GRLIB_side_enemy});
|
||||
};
|
||||
};
|
||||
|
||||
KPLIB_sectorsUnderAttack = KPLIB_sectorsUnderAttack - [_thispos];
|
||||
publicVariable "KPLIB_sectorsUnderAttack";
|
||||
|
||||
sleep 60;
|
||||
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
{
|
||||
if ( alive _x ) then { deleteVehicle _x };
|
||||
} foreach units _grp;
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
params [ "_sector" ];
|
||||
private [ "_attacktime", "_ownership", "_grp", "_squad_type" ];
|
||||
|
||||
sleep 5;
|
||||
|
||||
_ownership = [ markerpos _sector ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership != GRLIB_side_enemy ) exitWith {};
|
||||
|
||||
_squad_type = blufor_squad_inf_light;
|
||||
if ( _sector in sectors_military ) then {
|
||||
_squad_type = blufor_squad_inf;
|
||||
};
|
||||
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
_grp = creategroup [GRLIB_side_friendly, true];
|
||||
{
|
||||
[_x, markerPos _sector, _grp] call KPLIB_fnc_createManagedUnit;
|
||||
} foreach _squad_type;
|
||||
sleep 3;
|
||||
_grp setBehaviour "COMBAT";
|
||||
};
|
||||
|
||||
sleep 60;
|
||||
|
||||
_ownership = [ markerpos _sector ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership == GRLIB_side_friendly ) exitWith {
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
{
|
||||
if ( alive _x ) then { deleteVehicle _x };
|
||||
} foreach units _grp;
|
||||
};
|
||||
};
|
||||
|
||||
[_sector, 1] remoteExec ["remote_call_sector"];
|
||||
_attacktime = GRLIB_vulnerability_timer;
|
||||
|
||||
while { _attacktime > 0 && ( _ownership == GRLIB_side_enemy || _ownership == GRLIB_side_resistance ) } do {
|
||||
_ownership = [markerpos _sector] call KPLIB_fnc_getSectorOwnership;
|
||||
_attacktime = _attacktime - 1;
|
||||
sleep 1;
|
||||
};
|
||||
|
||||
waitUntil {
|
||||
sleep 1;
|
||||
[markerpos _sector] call KPLIB_fnc_getSectorOwnership != GRLIB_side_resistance;
|
||||
};
|
||||
|
||||
if ( GRLIB_endgame == 0 ) then {
|
||||
if ( _attacktime <= 1 && ( [markerpos _sector] call KPLIB_fnc_getSectorOwnership == GRLIB_side_enemy ) ) then {
|
||||
blufor_sectors = blufor_sectors - [ _sector ];
|
||||
publicVariable "blufor_sectors";
|
||||
[_sector, 2] remoteExec ["remote_call_sector"];
|
||||
reset_battlegroups_ai = true;
|
||||
[] spawn KPLIB_fnc_doSave;
|
||||
stats_sectors_lost = stats_sectors_lost + 1;
|
||||
{
|
||||
if (_sector in _x) exitWith {
|
||||
if ((count (_x select 3)) == 3) then {
|
||||
{
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
} forEach (attachedObjects ((nearestObjects [((_x select 3) select 0), [KP_liberation_small_storage_building], 10]) select 0));
|
||||
|
||||
deleteVehicle ((nearestObjects [((_x select 3) select 0), [KP_liberation_small_storage_building], 10]) select 0);
|
||||
};
|
||||
KP_liberation_production = KP_liberation_production - [_x];
|
||||
};
|
||||
} forEach KP_liberation_production;
|
||||
} else {
|
||||
[_sector, 3] remoteExec ["remote_call_sector"];
|
||||
{[_x] spawn prisonner_ai;} foreach (((markerpos _sector) nearEntities ["Man", GRLIB_capture_size * 0.8]) select {side group _x == GRLIB_side_enemy});
|
||||
};
|
||||
};
|
||||
|
||||
sleep 60;
|
||||
|
||||
if ( GRLIB_blufor_defenders ) then {
|
||||
{
|
||||
if ( alive _x ) then { deleteVehicle _x };
|
||||
} foreach units _grp;
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
File: fn_destroyFob.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2020-04-28
|
||||
Last Update: 2020-04-29
|
||||
License: MIT License - http://www.opensource.org/licenses/MIT
|
||||
|
||||
Description:
|
||||
Removes all player built buildings (from build list) inside the FOB radius of given position.
|
||||
Also removes possible clearances from given position.
|
||||
|
||||
Parameter(s):
|
||||
_fobPos - Center position [ARRAY, defaults to []]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_fobPos", [], [[]]]
|
||||
];
|
||||
|
||||
private _buildings = [toLower FOB_typename];
|
||||
_buildings append KPLIB_b_buildings_classes;
|
||||
|
||||
{
|
||||
if ((toLower (typeOf _x)) in _buildings) then {
|
||||
_x spawn {
|
||||
sleep ((random 4) + (random 4));
|
||||
_this setDamage 1;
|
||||
};
|
||||
};
|
||||
} forEach ((_fobPos nearObjects (GRLIB_fob_range * 1.2)) select {getObjectType _x >= 8});
|
||||
|
||||
KP_liberation_clearances deleteAt (KP_liberation_clearances findIf {(_x select 0) isEqualTo _fobPos});
|
||||
publicVariable "KP_liberation_clearances";
|
||||
|
||||
true
|
||||
@@ -0,0 +1,371 @@
|
||||
/*%FSM<COMPILE "C:\Games\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, KPLIB Sector Monitor">*/
|
||||
/*%FSM<HEAD>*/
|
||||
/*
|
||||
item0[] = {"Author__KPLIB_Dev",0,250,0.000000,0.000000,100.000000,50.000000,0.000000,"Author:" \n "KPLIB Dev Team"};
|
||||
item1[] = {"save_loaded_",4,218,0.000000,75.000000,100.000000,125.000000,0.000000,"save loaded?"};
|
||||
item2[] = {"Init",2,250,0.000000,150.000000,100.000000,200.000000,0.000000,"Init"};
|
||||
item3[] = {"not_server_",4,218,125.000000,0.000000,225.000000,50.000000,1.000000,"not server?"};
|
||||
item4[] = {"Exit",1,250,250.000000,0.000000,350.000000,50.000000,0.000000,"Exit"};
|
||||
item5[] = {"_",8,218,0.000000,225.000000,100.000000,275.000000,0.000000,""};
|
||||
item6[] = {"Start_new_monitoring",2,250,0.000000,300.000000,100.000000,350.000000,0.000000,"Start new" \n "monitoring run"};
|
||||
item7[] = {"_",8,218,0.000000,375.000000,100.000000,425.000000,0.000000,""};
|
||||
item8[] = {"Get_next_sector",2,250,0.000000,450.000000,100.000000,500.000000,0.000000,"Get next sector" \n "to check"};
|
||||
item9[] = {"cap_not_reached",4,218,0.000000,525.000000,100.000000,575.000000,0.000000,"cap not" \n "reached?"};
|
||||
item10[] = {"Get_adjusted_sector",2,250,0.000000,600.000000,100.000000,650.000000,0.000000,"Get adjusted" \n "sector range"};
|
||||
item11[] = {"blufor_near_",4,218,0.000000,675.000000,100.000000,725.000000,1.000000,"blufor near?"};
|
||||
item12[] = {"_",8,218,125.000000,600.000000,225.000000,650.000000,0.000000,""};
|
||||
item13[] = {"Sector_checked",2,250,250.000000,450.000000,350.000000,500.000000,0.000000,"Sector" \n "checked"};
|
||||
item14[] = {"Activate_sector",2,250,0.000000,750.000000,100.000000,800.000000,0.000000,"Activate sector"};
|
||||
item15[] = {"",7,210,296.000000,621.000000,304.000000,629.000000,0.000000,""};
|
||||
item16[] = {"_",8,218,125.000000,450.000000,225.000000,500.000000,0.000000,""};
|
||||
item17[] = {"run_finished_",4,218,250.000000,375.000000,350.000000,425.000000,1.000000,"run finished?"};
|
||||
item18[] = {"Log_overview_of",2,250,250.000000,300.000000,350.000000,350.000000,0.000000,"Log overview" \n "of active" \n "sectors"};
|
||||
item19[] = {"_",8,218,125.000000,300.000000,225.000000,350.000000,0.000000,""};
|
||||
item20[] = {"_",8,218,125.000000,750.000000,225.000000,800.000000,0.000000,""};
|
||||
item21[] = {"",7,210,296.000000,771.000000,304.000000,779.000000,0.000000,""};
|
||||
item22[] = {"campaign_finished",4,218,375.000000,450.000000,475.000000,500.000000,2.000000,"campaign" \n "finished?"};
|
||||
item23[] = {"Exit_1",1,250,500.000000,450.000000,600.000000,500.000000,0.000000,"Exit"};
|
||||
link0[] = {0,1};
|
||||
link1[] = {0,3};
|
||||
link2[] = {1,2};
|
||||
link3[] = {2,5};
|
||||
link4[] = {3,4};
|
||||
link5[] = {5,6};
|
||||
link6[] = {6,7};
|
||||
link7[] = {7,8};
|
||||
link8[] = {8,9};
|
||||
link9[] = {9,10};
|
||||
link10[] = {10,11};
|
||||
link11[] = {10,12};
|
||||
link12[] = {11,14};
|
||||
link13[] = {12,15};
|
||||
link14[] = {13,16};
|
||||
link15[] = {13,17};
|
||||
link16[] = {13,22};
|
||||
link17[] = {14,20};
|
||||
link18[] = {15,13};
|
||||
link19[] = {16,8};
|
||||
link20[] = {17,18};
|
||||
link21[] = {18,19};
|
||||
link22[] = {19,6};
|
||||
link23[] = {20,21};
|
||||
link24[] = {21,15};
|
||||
link25[] = {22,23};
|
||||
globals[] = {0.000000,0,0,0,0,640,480,1,27,6316128,1,-462.464111,712.458435,919.987671,76.941620,1232,884,1};
|
||||
window[] = {2,-1,-1,-1,-1,863,104,1544,104,3,1250};
|
||||
*//*%FSM</HEAD>*/
|
||||
class FSM
|
||||
{
|
||||
fsmName = "KPLIB Sector Monitor";
|
||||
class States
|
||||
{
|
||||
/*%FSM<STATE "Author__KPLIB_Dev">*/
|
||||
class Author__KPLIB_Dev
|
||||
{
|
||||
name = "Author__KPLIB_Dev";
|
||||
itemno = 0;
|
||||
init = /*%FSM<STATEINIT""">*/"// This FSM is part of KP Liberation" \n
|
||||
"// https://github.com/KillahPotatoes/KP-Liberation" \n
|
||||
"// MIT License - http://www.opensource.org/licenses/MIT"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "not_server_">*/
|
||||
class not_server_
|
||||
{
|
||||
itemno = 3;
|
||||
priority = 1.000000;
|
||||
to="Exit";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"!isServer"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "save_loaded_">*/
|
||||
class save_loaded_
|
||||
{
|
||||
itemno = 1;
|
||||
priority = 0.000000;
|
||||
to="Init";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"!isNil ""save_is_loaded"" && {save_is_loaded}"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Init">*/
|
||||
class Init
|
||||
{
|
||||
name = "Init";
|
||||
itemno = 2;
|
||||
init = /*%FSM<STATEINIT""">*/"[""Sector Monitor started"", ""SECTORMONITOR""] call KPLIB_fnc_log;" \n
|
||||
"" \n
|
||||
"private _allSectors = [];" \n
|
||||
"private _sector = """";" \n
|
||||
"private _opforCount = 0;" \n
|
||||
"private _range = 0;" \n
|
||||
"private _hc = objNull;" \n
|
||||
"private _logDelay = 300;" \n
|
||||
"private _logTime = diag_tickTime + _logDelay;"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 5;
|
||||
priority = 0.000000;
|
||||
to="Start_new_monitoring";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Exit">*/
|
||||
class Exit
|
||||
{
|
||||
name = "Exit";
|
||||
itemno = 4;
|
||||
init = /*%FSM<STATEINIT""">*/"[" \n
|
||||
" format [""Sector Monitor was started on %1"", debug_source]," \n
|
||||
" ""FSM ABORT""" \n
|
||||
"] remoteExecCall [""KPLIB_fnc_log"", 2];"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Start_new_monitoring">*/
|
||||
class Start_new_monitoring
|
||||
{
|
||||
name = "Start_new_monitoring";
|
||||
itemno = 6;
|
||||
init = /*%FSM<STATEINIT""">*/"_allSectors = sectors_allSectors - blufor_sectors;" \n
|
||||
"_allSectors = _allSectors - active_sectors;"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 7;
|
||||
priority = 0.000000;
|
||||
to="Get_next_sector";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Get_next_sector">*/
|
||||
class Get_next_sector
|
||||
{
|
||||
name = "Get_next_sector";
|
||||
itemno = 8;
|
||||
init = /*%FSM<STATEINIT""">*/"_sector = _allSectors deleteAt (floor random (count _allSectors));"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "cap_not_reached">*/
|
||||
class cap_not_reached
|
||||
{
|
||||
itemno = 9;
|
||||
priority = 0.000000;
|
||||
to="Get_adjusted_sector";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"_opforCount = [] call KPLIB_fnc_getOpforCap;" \n
|
||||
"_opforCount < GRLIB_sector_cap"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Get_adjusted_sector">*/
|
||||
class Get_adjusted_sector
|
||||
{
|
||||
name = "Get_adjusted_sector";
|
||||
itemno = 10;
|
||||
init = /*%FSM<STATEINIT""">*/"_range = [_opforCount] call KPLIB_fnc_getSectorRange;"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "blufor_near_">*/
|
||||
class blufor_near_
|
||||
{
|
||||
itemno = 11;
|
||||
priority = 1.000000;
|
||||
to="Activate_sector";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"([markerPos _sector, _range, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount) > 0"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 12;
|
||||
priority = 0.000000;
|
||||
to="Sector_checked";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Sector_checked">*/
|
||||
class Sector_checked
|
||||
{
|
||||
name = "Sector_checked";
|
||||
itemno = 13;
|
||||
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "campaign_finished">*/
|
||||
class campaign_finished
|
||||
{
|
||||
itemno = 22;
|
||||
priority = 2.000000;
|
||||
to="Exit_1";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"GRLIB_endgame > 0"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "run_finished_">*/
|
||||
class run_finished_
|
||||
{
|
||||
itemno = 17;
|
||||
priority = 1.000000;
|
||||
to="Log_overview_of";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"_allSectors isEqualTo []"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 16;
|
||||
priority = 0.000000;
|
||||
to="Get_next_sector";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Activate_sector">*/
|
||||
class Activate_sector
|
||||
{
|
||||
name = "Activate_sector";
|
||||
itemno = 14;
|
||||
init = /*%FSM<STATEINIT""">*/"// Get possible HC" \n
|
||||
"_hc = [] call KPLIB_fnc_getLessLoadedHC;" \n
|
||||
"" \n
|
||||
"// Start sector manager on HC or server" \n
|
||||
"if (isNull _hc) then {" \n
|
||||
" [_sector] spawn manage_one_sector;" \n
|
||||
"} else {" \n
|
||||
" [_sector] remoteExec [""manage_one_sector"", _hc];" \n
|
||||
"};" \n
|
||||
"" \n
|
||||
"// Spawn resource crates" \n
|
||||
"if (_sector in sectors_factory || _sector in sectors_capture) then {" \n
|
||||
" [_sector] call KPLIB_fnc_spawnSectorCrates;" \n
|
||||
"};" \n
|
||||
"" \n
|
||||
"// Spawn intel items" \n
|
||||
"if (_sector in sectors_military) then {" \n
|
||||
" [_sector] call KPLIB_fnc_spawnSectorIntel;" \n
|
||||
"};"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 20;
|
||||
priority = 0.000000;
|
||||
to="Sector_checked";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Log_overview_of">*/
|
||||
class Log_overview_of
|
||||
{
|
||||
name = "Log_overview_of";
|
||||
itemno = 18;
|
||||
init = /*%FSM<STATEINIT""">*/"if (diag_tickTime > _logTime) then {" \n
|
||||
" [" \n
|
||||
" format [" \n
|
||||
" ""Active sectors: %1""," \n
|
||||
" if (active_sectors isEqualTo []) then {" \n
|
||||
" ""None""" \n
|
||||
" } else {" \n
|
||||
" active_sectors apply {markerText _x} joinString "", """ \n
|
||||
" }" \n
|
||||
" ]," \n
|
||||
" ""SECTORMONITOR""" \n
|
||||
" ] call KPLIB_fnc_log;" \n
|
||||
" _logTime = diag_tickTime + _logDelay;" \n
|
||||
"};"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "_">*/
|
||||
class _
|
||||
{
|
||||
itemno = 19;
|
||||
priority = 0.000000;
|
||||
to="Start_new_monitoring";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "Exit_1">*/
|
||||
class Exit_1
|
||||
{
|
||||
name = "Exit_1";
|
||||
itemno = 23;
|
||||
init = /*%FSM<STATEINIT""">*/"[" \n
|
||||
" ""Sector Monitor exited due to finished campaign""," \n
|
||||
" ""SECTORMONITOR""" \n
|
||||
"] call KPLIB_fnc_log;"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
};
|
||||
initState="Author__KPLIB_Dev";
|
||||
finalStates[] =
|
||||
{
|
||||
"Exit",
|
||||
"Exit_1",
|
||||
};
|
||||
};
|
||||
/*%FSM</COMPILE>*/
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
File: fn_spawnSectorCrates.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2020-04-28
|
||||
Last Update: 2020-05-07
|
||||
License: MIT License - http://www.opensource.org/licenses/MIT
|
||||
|
||||
Description:
|
||||
Spawns random amount of random resource crates at given sector,
|
||||
if not already given during this session.
|
||||
Amount of crates is depending on resources multiplier.
|
||||
|
||||
Parameter(s):
|
||||
_sector - Sector marker string [STRING, defaults to ""]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_sector", "", [""]]
|
||||
];
|
||||
|
||||
if (_sector isEqualTo "") exitWith {["Empty string given"] call BIS_fnc_error; false};
|
||||
if (isNil "KPLIB_sectorCratesSpawned") then {KPLIB_sectorCratesSpawned = [];};
|
||||
|
||||
if !(_sector in KPLIB_sectorCratesSpawned) then {
|
||||
KPLIB_sectorCratesSpawned pushBack _sector;
|
||||
|
||||
private _amount = (ceil (random 3)) * GRLIB_resources_multiplier;
|
||||
private _spawnPos = [];
|
||||
private _j = 0;
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
while {_spawnPos isEqualTo []} do {
|
||||
_j = _j + 1;
|
||||
_spawnPos = ((markerPos _sector) getPos [random 50, random 360]) findEmptyPosition [10, 40, KP_liberation_ammo_crate];
|
||||
if (_j isEqualTo 10) exitWith {};
|
||||
};
|
||||
if !(_spawnPos isEqualTo []) then {
|
||||
[selectRandom KPLIB_crates, 100, _spawnpos] call KPLIB_fnc_createCrate;
|
||||
_spawnPos = [];
|
||||
} else {
|
||||
["No suitable spawn position found."] call BIS_fnc_error;
|
||||
[format ["Couldn't find spawn position for resource crate for sector %1", _sector], "WARNING"] call KPLIB_fnc_log;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
true
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
File: fn_spawnSectorIntel.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2020-05-01
|
||||
Last Update: 2020-05-06
|
||||
License: MIT License - http://www.opensource.org/licenses/MIT
|
||||
|
||||
Description:
|
||||
Spawns intel objects in valid buildings at given sector.
|
||||
|
||||
Parameter(s):
|
||||
_sector - Sector to spawn intel for [STRING, defaults to ""]
|
||||
_range - Range from the sector center to look for valid buildings [NUMBER, defaults to 150]
|
||||
_amount - Amount of intel objects to spawn at the sector [NUMBER, defaults to 2 + (floor (random 3))]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_sector", "", [""]],
|
||||
["_range", 150, [0]],
|
||||
["_amount", 2 + (floor (random 3)), [0]]
|
||||
];
|
||||
|
||||
if (_sector isEqualTo "") exitWith {["Empty string given"] call BIS_fnc_error; false};
|
||||
if (isNil "KPLIB_sectorIntelSpawned") then {KPLIB_sectorIntelSpawned = []};
|
||||
|
||||
if !(_sector in KPLIB_sectorIntelSpawned) then {
|
||||
KPLIB_sectorIntelSpawned pushBack _sector;
|
||||
private _buildings = (nearestObjects [markerPos _sector, KPLIB_intelBuildingClasses, _range]) select {alive _x};
|
||||
|
||||
if !(_buildings isEqualTo []) then {
|
||||
private _positions = [];
|
||||
{_positions append _x;} forEach (_buildings apply {[_x] call BIS_fnc_buildingPositions});
|
||||
|
||||
if ((count _positions) >= (_amount * 4)) then {
|
||||
private _spawnPos = [];
|
||||
private _obj = objNull;
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
_spawnPos = _positions deleteAt (floor random (count _positions));
|
||||
_obj = (selectRandom KPLIB_intelObjectClasses) createVehicle _spawnPos;
|
||||
_obj setdir (random 360);
|
||||
_obj setPosATL _spawnPos;
|
||||
_obj allowDamage false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
true
|
||||
@@ -0,0 +1,62 @@
|
||||
params ["_sector", "_radius", "_number"];
|
||||
|
||||
if (_number <= 0) exitWith {};
|
||||
|
||||
if (KP_liberation_asymmetric_debug > 0) then {[format ["ied_manager.sqf for %1 spawned on: %2", markerText _sector, debug_source], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
_number = round _number;
|
||||
|
||||
private _activation_radius_infantry = 6.66;
|
||||
private _activation_radius_vehicles = 10;
|
||||
|
||||
private _spread = 7;
|
||||
private _infantry_trigger = 1 + (ceil (random 2));
|
||||
private _ultra_strong = false;
|
||||
if (random 100 < 12) then {
|
||||
_ultra_strong = true;
|
||||
};
|
||||
private _vehicle_trigger = 1;
|
||||
private _ied_type = selectRandom ["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
|
||||
private _ied_obj = objNull;
|
||||
private _roadobj = [(markerPos _sector) getPos [random _radius, random 360], _radius, []] call BIS_fnc_nearestRoad;
|
||||
private _goes_boom = false;
|
||||
private _ied_marker = "";
|
||||
|
||||
if (KP_liberation_asymmetric_debug > 0) then {[format ["ied_manager.sqf -> spawning IED %1 at %2", _number, markerText _sector], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
if (_number > 0) then {
|
||||
[_sector, _radius, _number - 1] spawn ied_manager;
|
||||
};
|
||||
|
||||
if (!(isnull _roadobj)) then {
|
||||
|
||||
_roadpos = getpos _roadobj;
|
||||
_ied_obj = createMine [_ied_type, _roadpos getPos [_spread, random 360], [], 0];
|
||||
_ied_obj setdir (random 360);
|
||||
|
||||
if (KP_liberation_asymmetric_debug > 0) then {[format ["ied_manager.sqf -> IED %1 spawned at %2", _number, markerText _sector], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
while {_sector in active_sectors && mineActive _ied_obj && !_goes_boom} do {
|
||||
_nearinfantry = ((getpos _ied_obj) nearEntities ["Man", _activation_radius_infantry]) select {side _x == GRLIB_side_friendly};
|
||||
_nearvehicles = ((getpos _ied_obj) nearEntities [["Car", "Tank", "Air"], _activation_radius_vehicles]) select {side _x == GRLIB_side_friendly};
|
||||
if (count _nearinfantry >= _infantry_trigger || count _nearvehicles >= _vehicle_trigger) then {
|
||||
if (_ultra_strong) then {
|
||||
"Bomb_04_F" createVehicle (getpos _ied_obj);
|
||||
deleteVehicle _ied_obj;
|
||||
} else {
|
||||
_ied_obj setDamage 1;
|
||||
};
|
||||
stats_ieds_detonated = stats_ieds_detonated + 1; publicVariable "stats_ieds_detonated";
|
||||
_goes_boom = true;
|
||||
};
|
||||
sleep 1;
|
||||
};
|
||||
} else {
|
||||
if (KP_liberation_asymmetric_debug > 0) then {[format ["ied_manager.sqf -> _roadobj is Null for IED %1 at %2", _number, markerText _sector], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
};
|
||||
|
||||
if ((KP_liberation_asymmetric_debug > 0) && !(isNull _roadobj)) then {[format ["ied_manager.sqf -> exited IED %1 loop at %2", _number, markerText _sector], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
sleep 1800;
|
||||
|
||||
if (!(isNull _ied_obj)) then {deleteVehicle _ied_obj;};
|
||||
@@ -0,0 +1,28 @@
|
||||
waitUntil { !isNil "GRLIB_all_fobs" };
|
||||
waitUntil { !isNil "blufor_sectors" };
|
||||
|
||||
sleep 5;
|
||||
|
||||
attack_in_progress = false;
|
||||
|
||||
while { GRLIB_endgame == 0 } do {
|
||||
|
||||
{
|
||||
_ownership = [ markerpos _x ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership == GRLIB_side_enemy ) then {
|
||||
[ _x ] call attack_in_progress_sector;
|
||||
};
|
||||
sleep 0.5;
|
||||
} foreach blufor_sectors;
|
||||
|
||||
{
|
||||
_ownership = [ _x ] call KPLIB_fnc_getSectorOwnership;
|
||||
if ( _ownership == GRLIB_side_enemy ) then {
|
||||
[ _x ] call attack_in_progress_fob;
|
||||
};
|
||||
sleep 0.5;
|
||||
} foreach GRLIB_all_fobs;
|
||||
|
||||
sleep 1;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,310 @@
|
||||
// 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"};
|
||||
|
||||
[format ["Sector %1 (%2) activated - Managed on: %3", (markerText _sector), _sector, debug_source], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];
|
||||
|
||||
private _sectorpos = markerPos _sector;
|
||||
private _stopit = false;
|
||||
private _spawncivs = false;
|
||||
private _building_ai_max = 0;
|
||||
private _infsquad = "army";
|
||||
private _building_range = 50;
|
||||
private _local_capture_size = GRLIB_capture_size;
|
||||
private _iedcount = 0;
|
||||
private _vehtospawn = [];
|
||||
private _managed_units = [];
|
||||
private _squad1 = [];
|
||||
private _squad2 = [];
|
||||
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 _popfactor = 1;
|
||||
private _guerilla = false;
|
||||
|
||||
if (GRLIB_unitcap < 1) then {_popfactor = GRLIB_unitcap;};
|
||||
|
||||
if (_sector in active_sectors) exitWith {};
|
||||
active_sectors pushback _sector; publicVariable "active_sectors";
|
||||
|
||||
private _opforcount = [] call KPLIB_fnc_getOpforCap;
|
||||
[_sector, _opforcount] call wait_to_spawn_sector;
|
||||
|
||||
if ((!(_sector in blufor_sectors)) && (([markerPos _sector, [_opforcount] call KPLIB_fnc_getSectorRange, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount) > 0)) then {
|
||||
|
||||
if (_sector in sectors_bigtown) then {
|
||||
if (combat_readiness < 30) then {_infsquad = "militia";};
|
||||
|
||||
_squad1 = ([_infsquad] call KPLIB_fnc_getSquadComp);
|
||||
_squad2 = ([_infsquad] call KPLIB_fnc_getSquadComp);
|
||||
if (GRLIB_unitcap >= 1) then {_squad3 = ([_infsquad] call KPLIB_fnc_getSquadComp);};
|
||||
if (GRLIB_unitcap >= 1.5) then {_squad4 = ([_infsquad] call KPLIB_fnc_getSquadComp);};
|
||||
|
||||
_vehtospawn = [(selectRandom militia_vehicles),(selectRandom militia_vehicles)];
|
||||
if ((random 100) > (66 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
|
||||
if ((random 100) > (50 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
|
||||
if (_infsquad == "army") then {
|
||||
_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);
|
||||
_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);
|
||||
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);};
|
||||
};
|
||||
|
||||
_spawncivs = true;
|
||||
|
||||
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call KPLIB_fnc_crGetMulti) > 0)) then {
|
||||
_guerilla = true;
|
||||
};
|
||||
|
||||
_building_ai_max = round (50 * _popfactor);
|
||||
_building_range = 200;
|
||||
_local_capture_size = _local_capture_size * 1.4;
|
||||
|
||||
if (KP_liberation_civ_rep < 0) then {
|
||||
_iedcount = round (2 + (ceil (random 4)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
|
||||
} else {
|
||||
_iedcount = 0;
|
||||
};
|
||||
if (_iedcount > 16) then {_iedcount = 16};
|
||||
};
|
||||
|
||||
if (_sector in sectors_capture) then {
|
||||
if (combat_readiness < 50) then {_infsquad = "militia";};
|
||||
|
||||
_squad1 = ([_infsquad] call KPLIB_fnc_getSquadComp);
|
||||
if (GRLIB_unitcap >= 1.25) then {_squad2 = ([_infsquad] call KPLIB_fnc_getSquadComp);};
|
||||
|
||||
if ((random 100) > (66 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
|
||||
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
|
||||
if (_infsquad == "army") then {
|
||||
_vehtospawn pushback (selectRandom militia_vehicles);
|
||||
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {
|
||||
_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);
|
||||
_squad3 = ([_infsquad] call KPLIB_fnc_getSquadComp);
|
||||
};
|
||||
};
|
||||
|
||||
_spawncivs = true;
|
||||
|
||||
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call KPLIB_fnc_crGetMulti) > 0)) then {
|
||||
_guerilla = true;
|
||||
};
|
||||
|
||||
_building_ai_max = round ((floor (18 + (round (combat_readiness / 10 )))) * _popfactor);
|
||||
_building_range = 120;
|
||||
|
||||
if (KP_liberation_civ_rep < 0) then {
|
||||
_iedcount = round ((ceil (random 4)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
|
||||
} else {
|
||||
_iedcount = 0;
|
||||
};
|
||||
if (_iedcount > 12) then {_iedcount = 12};
|
||||
};
|
||||
|
||||
if (_sector in sectors_military) then {
|
||||
_squad1 = ([] call KPLIB_fnc_getSquadComp);
|
||||
_squad2 = ([] call KPLIB_fnc_getSquadComp);
|
||||
if (GRLIB_unitcap >= 1.5) then {_squad3 = ([] call KPLIB_fnc_getSquadComp);};
|
||||
|
||||
_vehtospawn = [([] call KPLIB_fnc_getAdaptiveVehicle),([] call KPLIB_fnc_getAdaptiveVehicle)];
|
||||
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {
|
||||
_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);
|
||||
_squad4 = ([] call KPLIB_fnc_getSquadComp);
|
||||
};
|
||||
if ((random 100) > (66 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);};
|
||||
|
||||
_spawncivs = false;
|
||||
|
||||
_building_ai_max = round ((floor (18 + (round (combat_readiness / 4 )))) * _popfactor);
|
||||
_building_range = 120;
|
||||
};
|
||||
|
||||
if (_sector in sectors_factory) then {
|
||||
if (combat_readiness < 40) then {_infsquad = "militia";};
|
||||
|
||||
_squad1 = ([_infsquad] call KPLIB_fnc_getSquadComp);
|
||||
if (GRLIB_unitcap >= 1.25) then {_squad2 = ([_infsquad] call KPLIB_fnc_getSquadComp);};
|
||||
|
||||
if ((random 100) > 66) then {_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);};
|
||||
if ((random 100) > 33) then {_vehtospawn pushback (selectRandom militia_vehicles);};
|
||||
|
||||
_spawncivs = false;
|
||||
|
||||
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call KPLIB_fnc_crGetMulti) > 0)) then {
|
||||
_guerilla = true;
|
||||
};
|
||||
|
||||
_building_ai_max = round ((floor (18 + (round (combat_readiness / 10 )))) * _popfactor);
|
||||
_building_range = 120;
|
||||
|
||||
if (KP_liberation_civ_rep < 0) then {
|
||||
_iedcount = round ((ceil (random 3)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
|
||||
} else {
|
||||
_iedcount = 0;
|
||||
};
|
||||
if (_iedcount > 8) then {_iedcount = 8};
|
||||
};
|
||||
|
||||
if (_sector in sectors_tower) then {
|
||||
_squad1 = ([] call KPLIB_fnc_getSquadComp);
|
||||
if (combat_readiness > 30) then {_squad2 = ([] call KPLIB_fnc_getSquadComp);};
|
||||
if (GRLIB_unitcap >= 1.5) then {_squad3 = ([] call KPLIB_fnc_getSquadComp);};
|
||||
|
||||
if((random 100) > 95) then {_vehtospawn pushback ([] call KPLIB_fnc_getAdaptiveVehicle);};
|
||||
|
||||
_spawncivs = false;
|
||||
|
||||
_building_ai_max = 0;
|
||||
};
|
||||
|
||||
_vehtospawn = _vehtospawn select {!(isNil "_x")};
|
||||
|
||||
if (KP_liberation_sectorspawn_debug > 0) then {[format ["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], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
if (_building_ai_max > 0 && GRLIB_adaptive_opfor) then {
|
||||
_building_ai_max = round (_building_ai_max * ([] call KPLIB_fnc_getOpforFactor));
|
||||
};
|
||||
|
||||
{
|
||||
_vehicle = [_sectorpos, _x] call KPLIB_fnc_spawnVehicle;
|
||||
[group ((crew _vehicle) select 0),_sectorpos] spawn add_defense_waypoints;
|
||||
_managed_units pushback _vehicle;
|
||||
{_managed_units pushback _x;} foreach (crew _vehicle);
|
||||
sleep 0.25;
|
||||
} forEach _vehtospawn;
|
||||
|
||||
if (_building_ai_max > 0) then {
|
||||
_allbuildings = (nearestObjects [_sectorpos, ["House"], _building_range]) select {alive _x};
|
||||
_buildingpositions = [];
|
||||
{
|
||||
_buildingpositions = _buildingpositions + ([_x] call BIS_fnc_buildingPositions);
|
||||
} forEach _allbuildings;
|
||||
if (KP_liberation_sectorspawn_debug > 0) then {[format ["Sector %1 (%2) - manage_one_sector found %3 building positions", (markerText _sector), _sector, (count _buildingpositions)], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
if (count _buildingpositions > _minimum_building_positions) then {
|
||||
_managed_units = _managed_units + ([_infsquad, _building_ai_max, _buildingpositions, _sector] call KPLIB_fnc_spawnBuildingSquad);
|
||||
};
|
||||
};
|
||||
|
||||
_managed_units = _managed_units + ([_sectorpos] call KPLIB_fnc_spawnMilitaryPostSquad);
|
||||
|
||||
if (count _squad1 > 0) then {
|
||||
_grp = [_sector, _squad1] call KPLIB_fnc_spawnRegularSquad;
|
||||
[_grp, _sectorpos] spawn add_defense_waypoints;
|
||||
_managed_units = _managed_units + (units _grp);
|
||||
};
|
||||
|
||||
if (count _squad2 > 0) then {
|
||||
_grp = [_sector, _squad2] call KPLIB_fnc_spawnRegularSquad;
|
||||
[_grp, _sectorpos] spawn add_defense_waypoints;
|
||||
_managed_units = _managed_units + (units _grp);
|
||||
};
|
||||
|
||||
if (count _squad3 > 0) then {
|
||||
_grp = [_sector, _squad3] call KPLIB_fnc_spawnRegularSquad;
|
||||
[_grp, _sectorpos] spawn add_defense_waypoints;
|
||||
_managed_units = _managed_units + (units _grp);
|
||||
};
|
||||
|
||||
if (count _squad4 > 0) then {
|
||||
_grp = [_sector, _squad4] call KPLIB_fnc_spawnRegularSquad;
|
||||
[_grp, _sectorpos] spawn add_defense_waypoints;
|
||||
_managed_units = _managed_units + (units _grp);
|
||||
};
|
||||
|
||||
if (_spawncivs && GRLIB_civilian_activity > 0) then {
|
||||
_managed_units = _managed_units + ([_sector] call KPLIB_fnc_spawnCivilians);
|
||||
};
|
||||
|
||||
if (KP_liberation_asymmetric_debug > 0) then {[format ["Sector %1 (%2) - Range: %3 - Count: %4", (markerText _sector), _sector, _building_range, _iedcount], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
[_sector, _building_range, _iedcount] spawn ied_manager;
|
||||
|
||||
if (_guerilla) then {
|
||||
[_sector] spawn sector_guerilla;
|
||||
};
|
||||
|
||||
sleep 10;
|
||||
|
||||
if ((_sector in sectors_factory) || (_sector in sectors_capture) || (_sector in sectors_bigtown) || (_sector in sectors_military)) then {
|
||||
[_sector] remoteExec ["reinforcements_remote_call",2];
|
||||
};
|
||||
|
||||
if (KP_liberation_sectorspawn_debug > 0) then {[format ["Sector %1 (%2) - populating done", (markerText _sector), _sector], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
private _activationTime = time;
|
||||
// sector lifetime loop
|
||||
while {!_stopit} do {
|
||||
// sector was captured
|
||||
if (([_sectorpos, _local_capture_size] call KPLIB_fnc_getSectorOwnership == GRLIB_side_friendly) && (GRLIB_endgame == 0)) then {
|
||||
if (isServer) then {
|
||||
[_sector] spawn sector_liberated_remote_call;
|
||||
} else {
|
||||
[_sector] remoteExec ["sector_liberated_remote_call",2];
|
||||
};
|
||||
|
||||
_stopit = true;
|
||||
|
||||
{[_x] spawn prisonner_ai;} forEach ((markerPos _sector) nearEntities [["Man"], _local_capture_size * 1.2]);
|
||||
|
||||
sleep 60;
|
||||
|
||||
active_sectors = active_sectors - [_sector]; publicVariable "active_sectors";
|
||||
|
||||
sleep 600;
|
||||
|
||||
{
|
||||
if (_x isKindOf "Man") then {
|
||||
if (side group _x != GRLIB_side_friendly) then {
|
||||
deleteVehicle _x;
|
||||
};
|
||||
} else {
|
||||
if (!isNull _x) then {
|
||||
[_x] call KPLIB_fnc_cleanOpforVehicle;
|
||||
};
|
||||
};
|
||||
} forEach _managed_units;
|
||||
} else {
|
||||
if (([_sectorpos, (([_opforcount] call KPLIB_fnc_getSectorRange) + 300), GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount) == 0) then {
|
||||
_sector_despawn_tickets = _sector_despawn_tickets - 1;
|
||||
} else {
|
||||
// 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 {
|
||||
{
|
||||
if (_x isKindOf "Man") then {
|
||||
deleteVehicle _x;
|
||||
} else {
|
||||
if (!isNull _x) then {
|
||||
[_x] call KPLIB_fnc_cleanOpforVehicle;
|
||||
};
|
||||
};
|
||||
} forEach _managed_units;
|
||||
|
||||
_stopit = true;
|
||||
active_sectors = active_sectors - [_sector]; publicVariable "active_sectors";
|
||||
};
|
||||
};
|
||||
sleep SECTOR_TICK_TIME;
|
||||
};
|
||||
} else {
|
||||
sleep 40;
|
||||
active_sectors = active_sectors - [_sector]; publicVariable "active_sectors";
|
||||
};
|
||||
|
||||
[format ["Sector %1 (%2) deactivated - Was managed on: %3", (markerText _sector), _sector, debug_source], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];
|
||||
@@ -0,0 +1,44 @@
|
||||
params ["_sector", "_opforcount"];
|
||||
|
||||
private _start = diag_tickTime;
|
||||
[format ["Sector %1 (%2) - Waiting to spawn sector...", (markerText _sector), _sector], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];
|
||||
|
||||
private _corrected_size = [_opforcount] call KPLIB_fnc_getSectorRange;
|
||||
sleep 0.1;
|
||||
private _unitscount = [markerPos _sector, _corrected_size , GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
|
||||
if (_unitscount > 0 && _unitscount <= 10) then {
|
||||
sleep 5;
|
||||
};
|
||||
sleep 0.1;
|
||||
|
||||
_unitscount = [markerPos _sector, _corrected_size, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
if (_unitscount > 0 && _unitscount <= 6) then {
|
||||
sleep 5;
|
||||
};
|
||||
sleep 0.1;
|
||||
|
||||
_unitscount = [markerPos _sector, _corrected_size, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
if (_unitscount > 0 && _unitscount <= 4) then {
|
||||
sleep 5;
|
||||
};
|
||||
sleep 0.1;
|
||||
|
||||
_unitscount = [markerPos _sector, _corrected_size, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
if (_unitscount > 0 && _unitscount <= 3) then {
|
||||
sleep 5;
|
||||
};
|
||||
sleep 0.1;
|
||||
|
||||
_unitscount = [markerPos _sector, _corrected_size, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
if (_unitscount > 0 && _unitscount <= 2) then {
|
||||
sleep 5;
|
||||
};
|
||||
sleep 0.1;
|
||||
|
||||
_unitscount = [markerPos _sector, _corrected_size, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
if (_unitscount == 1) then {
|
||||
sleep 5;
|
||||
};
|
||||
|
||||
[format ["Sector %1 (%2) - Waiting done - Time needed: %3 seconds", (markerText _sector), _sector, diag_tickTime - _start], "SECTORSPAWN"] remoteExecCall ["KPLIB_fnc_log", 2];
|
||||
Reference in New Issue
Block a user