Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d74b0d1
Update CfgFunctions.hpp
PiG13BR Nov 23, 2024
e98dcbf
Add files via upload
PiG13BR Nov 23, 2024
b0c4f0e
Update custom.sqf
PiG13BR Nov 23, 2024
043fd03
Update init_presets.sqf
PiG13BR Nov 23, 2024
b12d246
Update manage_one_sector.sqf
PiG13BR Nov 23, 2024
f64fec0
Add files via upload
PiG13BR Nov 23, 2024
77076d6
Update init_presets.sqf
PiG13BR Nov 23, 2024
aede76e
Update fn_createStaticWeapons.sqf
PiG13BR Nov 23, 2024
a89bb42
Update KPLIB_staticsConfigs.sqf
PiG13BR Nov 24, 2024
f6b09e7
Update and rename fn_createGarrisons.sqf to fn_createSectorObjects.sqf
PiG13BR Nov 24, 2024
e1b9e71
Update and rename fn_registerGarrison.sqf to fn_registerSectorObjects…
PiG13BR Nov 24, 2024
0c90920
Update fn_createStaticWeapons.sqf
PiG13BR Nov 24, 2024
922e7ae
Add files via upload
PiG13BR Nov 24, 2024
dc06255
Update fn_sectorObjectBlacklist.sqf
PiG13BR Nov 24, 2024
1eeb989
Update CfgFunctions.hpp
PiG13BR Nov 24, 2024
bd29bee
Update manage_one_sector.sqf
PiG13BR Nov 24, 2024
19801c3
Update fn_createStaticWeapons.sqf
PiG13BR Nov 24, 2024
924e41b
Update KPLIB_staticsConfigs.sqf
PiG13BR Nov 24, 2024
75edc60
Update fn_createStaticWeapons.sqf
PiG13BR Nov 24, 2024
ebde174
Update KPLIB_staticsConfigs.sqf
PiG13BR Nov 24, 2024
06ca9a8
Update manage_one_sector.sqf
PiG13BR Nov 24, 2024
7699254
Update CfgFunctions.hpp
PiG13BR Nov 24, 2024
073fb3b
Update fn_registerSectorObjects.sqf
PiG13BR Nov 24, 2024
aa5f636
Update fn_sectorObjectBlacklist.sqf
PiG13BR Nov 24, 2024
69e1d72
Update fn_createSectorObjects.sqf
PiG13BR Nov 24, 2024
3452709
Update fn_createStaticWeapons.sqf
PiG13BR Nov 24, 2024
e3b0e6a
Update KPLIB_staticsConfigs.sqf
PiG13BR Nov 24, 2024
036b11a
Update KPLIB_staticsConfigs.sqf with new types
PiG13BR Nov 30, 2024
c2044e5
Update custom.sqf with new variables
PiG13BR Nov 30, 2024
0be7a7f
Update init_presets.sqf
PiG13BR Nov 30, 2024
1356425
Update hashmap variable for sector objects
PiG13BR Nov 30, 2024
cf584c1
Update fn_createSectorObjects.sqf
PiG13BR Nov 30, 2024
55d0091
Update fn_createStaticWeapons.sqf
PiG13BR Nov 30, 2024
837a7e5
Update fn_createStaticWeapons.sqf
PiG13BR Nov 30, 2024
5e2c4ed
Update fn_createStaticWeapons.sqf
PiG13BR Nov 30, 2024
fae93cc
Update fn_sectorObjectBlacklist.sqf
PiG13BR Dec 1, 2024
8461570
Update fn_sectorObjectBlacklist.sqf
PiG13BR Dec 1, 2024
fafa672
Update fn_sectorObjectBlacklist.sqf
PiG13BR Dec 2, 2024
4ee880d
Update fn_registerSectorObjects.sqf
PiG13BR Dec 4, 2024
50ebb70
Update init_server.sqf
PiG13BR Dec 4, 2024
9fd4bf1
Update fn_spawnStaticWeapon.sqf
PiG13BR Dec 10, 2024
bb3efd9
Update init.sqf
PiG13BR Dec 15, 2024
371b6e4
Update fn_registerSectorObjects.sqf
PiG13BR Dec 16, 2024
fccde8b
fn_registerSectorObjects.sqf Rethink
PiG13BR Dec 16, 2024
f6f2fb0
fn_sectorObjectBlacklist.sqf Rethink
PiG13BR Dec 16, 2024
9f9a6a8
Update fn_createStaticWeapons.sqf
PiG13BR Dec 18, 2024
b81981a
Update fn_spawnStaticWeapon.sqf
PiG13BR Dec 18, 2024
d33a87e
Update CfgFunctions.hpp
PiG13BR Apr 9, 2025
01a6c4b
Add files via upload
PiG13BR Apr 9, 2025
f3e2fc9
Update init_server.sqf
PiG13BR Apr 9, 2025
f2a4c4f
Update fn_createSectorObjects.sqf
PiG13BR Apr 9, 2025
2e9f01b
Major changes in fn_createStaticWeapons.sqf
PiG13BR Apr 9, 2025
2cc56df
Update fn_createSectorObjects.sqf
PiG13BR Apr 9, 2025
cf572cd
Update fn_spawnStaticWeapon.sqf
PiG13BR Apr 9, 2025
8230496
Update manage_one_sector.sqf
PiG13BR Apr 9, 2025
de8df49
Delete Missionframework/functions/fn_registerSectorObjects.sqf
PiG13BR Apr 9, 2025
8cda2cf
Delete Missionframework/functions/fn_sectorObjectBlacklist.sqf
PiG13BR Apr 9, 2025
37eb904
Update KPLIB_config.sqf
PiG13BR Apr 10, 2025
cd235cf
Merge branch 'v0.96.8' into v0.96.8-static_weapons
PiG13BR Jun 19, 2025
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
4 changes: 4 additions & 0 deletions Missionframework/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class KPLIB {
class createClearanceConfirm {};
class createCrate {};
class createManagedUnit {};
class createSectorObjects {};
class createStaticWeapons {};
class crGetMulti {};
class crGlobalMsg {};
class doSave {};
Expand Down Expand Up @@ -69,6 +71,7 @@ class KPLIB {
class log {};
class potatoScan {};
class protectObject {};
class registerSectorObject {};
class secondsToTimer {};
class setDiscordState {};
class setFobMass {};
Expand All @@ -83,6 +86,7 @@ class KPLIB {
class spawnMilitaryPostSquad {};
class spawnMilitiaCrew {};
class spawnRegularSquad {};
class spawnStaticWeapon {};
class spawnVehicle {};
class swapInventory {};
};
Expand Down
3 changes: 3 additions & 0 deletions Missionframework/KPLIB_config.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,6 @@ KPLIB_cleanup_delay = 1200;

// Fill magazines on loading loadout?
KP_liberation_fill_mags = true;

// Max radius from an object to register to find the nearest sector
KPLIB_objectsGrabber_radius = 250;
46 changes: 46 additions & 0 deletions Missionframework/KPLIB_staticsConfigs.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
- Place here the structures that you want the enemy static weapons to spawn. For that, you need:
The classname of the building [STRING], followed by an bigger array;
The type of the static weapon ("RAISED-HMG", "LOWERED-HMG", "RAISED-GMG", "LOWERED-GMG", "AT", "AA") [ARRAY], related to ones in the presets. Can be more than one. Recommended: one type per position;
The PositionRelative coordinates [ARRAY] where the static weapon will spawn, relative to the structure;
The direction of the weapon [NUMBER] (it will be relative to the object).
- Example:
- [STRING, [[[STRING], ARRAY, NUMBER]]]
- ["building_classname", [[["type"], [relative position], relative direction], [["RAISED-HMG", "AT", "AA"], [x,y,z], (+/- dir)], [["RAISED-HMG"], [-1.14307,-1.2998,-0.55952], (180)]]]
- To get positionRelative, stand your character where you want to static weapon to spawn and run the code below in debug, it will return a [x,y,z] array.
(varNameOfTheObject or cursorObject) worldToModel ASLToAGL getPosASL player
- Using modded static weapons may require small adjustments in relative positions.
- To open the possibility of spawning static weapons, it requires more editing by placing those buildings classnames referenced below in the map. Some building classes may be already in the map.
- The static weapons will only spawn near sectors, so place the garrisons buildings near them.
- Don't duplicate classnames.
- Be careful when making a new array. Copy an example and change the values, and then check for missing or additional commas.
*/

KPLIB_staticsConfigs = [
// Vanilla
["Land_Cargo_Patrol_V1_F", [[["RAISED-HMG"], [-1.14307,-1.2998,-0.55952], (180)]]],
["Land_Cargo_Patrol_V2_F", [[["RAISED-HMG"], [-1,-1.3,-0.5], (180)]]],
["Land_Cargo_Patrol_V3_F", [[["RAISED-HMG"], [-1,-1.3,-0.5], (180)]]],
["Land_Cargo_HQ_V1_F", [[["AA"], [1.54492,0.740723,-0.747444], (0)], [["RAISED-HMG"], [-1.57813,-4.04639,-0.747444], (180)], [["RAISED-HMG"], [-2.64551,3.2,-0.747444], (- 45)], [["RAISED-HMG"], [5.88232,1.84473,-0.747444], (- 45)]]],
["Land_Cargo_HQ_V2_F", [[["AA"], [1.54492,0.740723,-0.747444], (0)], [["RAISED-HMG"], [-1.57813,-4.04639,-0.747444], (180)], [["RAISED-HMG"], [-2.64551,3.2,-0.747444], (- 45)], [["RAISED-HMG"], [5.88232,1.84473,-0.747444], (- 45)]]],
["Land_Cargo_HQ_V3_F", [[["AA"], [1.54492,0.740723,-0.747444], (0)], [["RAISED-HMG"], [-1.57813,-4.04639,-0.747444], (180)], [["RAISED-HMG"], [-2.64551,3.2,-0.747444], (- 45)], [["RAISED-HMG"], [5.88232,1.84473,-0.747444], (- 45)]]],
["Land_Cargo_Tower_V1_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V2_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V3_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No1_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No2_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No3_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No4_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No5_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No6_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_Cargo_Tower_V1_No7_F", [[["RAISED-HMG"], [4.61279,3.98389,5.00471], (45)], [["RAISED-HMG"], [4.8584,-2.90234,5.00471], (140)], [["RAISED-HMG"], [-4.18359,-3.16211,5.00471], (- 90)], [["RAISED-HMG"], [-3.07178,4.40283,5.00471], (0)]]],
["Land_BagFence_Round_F", [[["AT"], [0,1.5,0], (180)]]],
["Land_BagFence_Long_F", [[["AA"], [0,1.5,0], (180)]]],
["Land_HBarrierTower_F", [[["RAISED-HMG"], [0,-1.2793,0.0967188], (180)]]],
["Land_BagBunker_Small_F", [[["RAISED-HMG"], [0,0,-0.9], (180)]]],
["Land_BagBunker_Large_F", [[["RAISED-HMG"], [0.0717773,-3.24316,-0.709913], (180)], [["RAISED-HMG"], [2.7627,-1.0293,-0.709913], (90)]]],
["Land_BagBunker_Tower_F", [[["AA", "AT"], [0.163086,1.16992,0.571415], (0)], [["RAISED-HMG", "RAISED-GMG"], [-0.599121,-1.44092,0.571415], (180)]]],
["Land_ClutterCutter_medium_F", [[["LOWERED-HMG", "LOWERED-GMG"], [0,0,0], (0)]]]
];

KPLIB_staticConfigs_classes = KPLIB_staticsConfigs apply { _x select 0 };
46 changes: 46 additions & 0 deletions Missionframework/functions/fn_createSectorObjects.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
File: fn_createSectorObjects.sqf
Author: PiG13BR - https://github.com/PiG13BR
Date: 2024-11-22
Last Update: 2024-12-16
License: MIT License - http://www.opensource.org/licenses/MIT

Description:
Create registered objects in the designated sector

Parameter(s):
_sector - sector where the objects will be created [STRING]

Returns:
All objects created in this sector [ARRAY]
*/

if (!isServer) exitWith {};

params ["_sector"];

private _allGarrisons = [];

private _structures = KPLIB_sectorObjects_hashMap get _sector;
if ((isNil "_structures") || {count _structures < 1}) exitWith {_allGarrisons};

{
_class = _x # 0;
_pos = ((_x # 1) # 0);
_dir = ((_x # 1) # 1);

_object = createVehicle [_class, _pos, [], 0, "CAN_COLLIDE"];
_object setPosATL _pos;
_object setDir _dir;

// Vehicles
if (_object isKindOf "Allvehicles") then {
[_object, 0] remoteExec ["setFuel"];
[_object, "LOCKEDPLAYER"] remoteExec ["setVehicleLock"];
_object lockDriver true;
};

_allGarrisons pushBack _object;
}forEach _structures;

_allGarrisons
99 changes: 99 additions & 0 deletions Missionframework/functions/fn_createStaticWeapons.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
File: fn_createStaticWeapons.sqf
Author: PiG13BR - https://github.com/PiG13BR
Date: 2024-11-22
Last Update: 2025-04-09
License: MIT License - http://www.opensource.org/licenses/MIT

Description:
Create static weapons on available structures in the sector, provided the structures are defined in KPLIB_staticsConfig.sqf file

Parameter(s):
_sector - sector to search for buildings to spawn static weapons [STRING, defaults to ""]
_objects - sector objects [ARRAY, defaults to []]

Returns:
All static weapons created [ARRAY]
*/

if (!isServer) exitWith {};

params[
["_sector", "", [""]],
["_objects", [], [[]]]
];

private _allStaticWeapons = [];
if (_sector isEqualTo "") exitWith {["No sector provided in fn_createStaticWeapons", "WARNING"] call KPLIB_fnc_log; _allStaticWeapons};
if (_objects isEqualTo []) exitWith {["No objects in the sector found", "SECTOR"] call KPLIB_fnc_log; _allStaticWeapons};

// Find garrisons objects for static weapons in the activated sector
private _allGarrisons = _objects select {(typeOf _x) in KPLIB_staticConfigs_classes};

// Create a group for the static weapons for the sector
private _staticGroup = createGroup KPLIB_side_enemy;

if (count _allGarrisons > 0) then {
// Loop the garrison objects found
{
private _garrison = _x;

// Loop statics configuration provided in KPLIB_staticsConfigs.sqf
{
// Check if the object type matches one of the configuration
if (_x # 0 == typeOf _garrison) then {
// Count how many positions are available for static weapons by counting the second element of the main array
private _positions = count (_x # 1);
if (_positions > 0) then {
for "_index" from 0 to (_positions - 1) do {
// The provided _index number in this loop will select each array that contains the necessary values to spawn correctly the static weapon for each relative position provided in the configuration
private _type = (((_x # 1) # _index) # 0); // Get the types
private _relPos = (((_x # 1) # _index) # 1); // Get the relativePosition
private _relDir = (((_x # 1) # _index) # 2); // Get the rotation

private _typeSel = "";
// It will select randomly the type if more than one is provided.
if (count _type > 1) then {
_typeSel = selectRandom _type;
} else {
_typeSel = _type # 0;
};

// For the selected type, it will check the static weapons presets
private _staticClass = "";
switch _typeSel do {
case "RAISED-HMG" : {
_staticClass = selectRandom KPLIB_o_statics_raisedHMG;
};
case "LOWERED-HMG" : {
_staticClass = selectRandom KPLIB_o_statics_loweredHMG;
};
case "RAISED-GMG" : {
_staticClass = selectRandom KPLIB_o_statics_raisedGMG;
};
case "LOWERED-GMG" : {
_staticClass = selectRandom KPLIB_o_statics_loweredGMG;
};
case "AT" : {
_staticClass = selectRandom KPLIB_o_statics_AT;
};
case "AA" : {
_staticClass = selectRandom KPLIB_o_statics_AA;
}
};

if (_staticClass isEqualTo "") then {[format ["No static weapon classname found in type %1", _typeSel], "WARNING"] call KPLIB_fnc_log; continue};

// Create the static weapon and it's crew
_weapon = [(_garrison modelToWorld _relPos), _staticClass, (getDir _garrison + (_relDir))] call KPLIB_fnc_spawnStaticWeapon;
if (!isNil "_weapon") then {
_allStaticWeapons pushBack _weapon;
};
};
};
}
}forEach KPLIB_staticsConfigs;
}forEach _allGarrisons;
};

_allStaticWeapons
111 changes: 111 additions & 0 deletions Missionframework/functions/fn_registerSectorObject.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
File: fn_registerSectorObject.sqf
Author: PiG13BR - https://github.com/PiG13BR
Date: 2025-12-20
Last Update: 2025-02-17
License: MIT License - http://www.opensource.org/licenses/MIT

Description:
Register object near a sector into a hashmap and deletes them from the map, to later spawn it again when the sector is activated
Can be any object. Static weapons will spawn only in registered objects.
Put this code in the object's init to register as a sector object:
[this] call KPLIB_fnc_registerSectorObject
Only object close enough to sectors will be registered (KPLIB_objectsGrabber_radius). If the object isn't near any sectors, it will not be registered and it will be deleted from the map.
Objects classnames under KPLIB_staticsConfigs.sqf have an option to disable static weapons from spawning it
[this, false] call KPLIB_fnc_registerSectorObject
The registered object can be delete or not in the beginning of the mission. In this case a different variable will manage those objects.
This is crucial to be able to spawn static weapon in those buildings once the sectors activates
For default, map objects classnames that matches those in KPLIB_staticsConfigs.sqf will NOT spawn any static weapon.
To enable MAP objects classnames that are under KPLIB_staticsConfigs.sqf to spawn static weapons, you can do it indirectly by placing a logic near of the object and in its init field:
_objects = nearestObjects [getPos this, ["classname_of_object"], 75, false];
{[this] call KPLIB_fnc_registerSectorObject}forEach _objects;

Parameter(s):
_object - object that will be registered [OBJECT, defaults to objNull]
_canGarrison - Spawning of static weapons is enabled for this object? (provided if the object classname is refered in KPLIB_staticsConfigs.sqf) [BOOL, defaults to true]

Returns:
-
*/

if (!isServer) exitWith {};

params [
["_object", objNull, [ObjNull]],
["_canGarrison", true, [false]], // Only works for buildings or structures under KPLIB_staticsConfigs
["_initDelete", true, [false]] // This will NOT work for map objects if it's TRUE
];

[{(!isNil "KPLIB_sectors_all")}, {
_this params ["_object", "_canGarrison", "_initDelete"];

// Find the nearest sector
private _sector = [KPLIB_objectsGrabber_radius, getPos _object] call KPLIB_fnc_getNearestSector;
if (_sector isEqualTo "") exitWith {[format ["%1 in position %2 is too far away from any sectors. Deleting the object.", (typeOf _object), (getPos _object)], "REGISTERING OBJECT FAILED"] call KPLIB_fnc_log; deleteVehicle _x;};

if (isNil "KPLIB_sectorObjects_hashMap") then {
// Creates the hashmap
KPLIB_sectorObjects_hashMap = createHashMap;
};

// Check if the key (sector) is already in the hashmap
if !(_sector in KPLIB_sectorObjects_hashMap) then {
// Create a new key with a value
KPLIB_sectorObjects_hashMap set [_sector, [[typeOf _object, [getPosATL _object, getDir _object]]]];
} else {
// Update key values if key already exists
private _mapValue = KPLIB_sectorObjects_hashMap get _sector;
private _mapNewValues = _mapValue + [[typeOf _object, [getPosATL _object, getDir _object]]];
KPLIB_sectorObjects_hashMap set [_sector, _mapNewValues];
};



if (isNil "KPLIB_sectorMapObject_hashMap") then {
// Creates the hashmap
KPLIB_sectorMapObject_hashMap = createHashMap;
};

// This object will not be deleted from start (or it's a map object itself)
if !(_initDelete) then {

// Check if the key (sector) is already in the hashmap
if !(_sector in KPLIB_sectorMapObject_hashMap) then {
// Create a new key with a value
KPLIB_sectorMapObject_hashMap set [_sector, [_object]];
} else {
// Update key values if key already exists
private _mapValue = KPLIB_sectorMapObject_hashMap get _sector;
private _mapNewValues = _mapValue + [_object];
KPLIB_sectorMapObject_hashMap set [_sector, _mapNewValues];
};
};

if (isNil "KPLIB_GarrisonsBlacklist_HashMap") then {
// Creates the hashmap
KPLIB_GarrisonsBlacklist_HashMap = createHashMap;
};

if (!_canGarrison) then {
if !(typeOf _object in KPLIB_allGarrionsConfigs_classe) exitWith {};
// Because a deleted object will give a <NULL-OBJECT> in the garrison array, save the position of the object instead to find a match later.
private _objectPos = [round parseNumber (((getPosATL _object) # 0) toFixed 2), round parseNumber (((getPosATL _object) # 1) toFixed 2), round parseNumber (((getPosATL _object) # 2) toFixed 2)];
private _sector = [_radius, getPos _object] call KPLIB_fnc_getNearestSector;

if !(_sector in KPLIB_GarrisonsBlacklist_HashMap) then {
// Create a new key with a value
KPLIB_GarrisonsBlacklist_HashMap set [_sector, [_objectPos]];
} else {
// Update key values if key already exists
private _mapValue = KPLIB_GarrisonsBlacklist_HashMap get _sector;
private _mapNewValues = _mapValue + [_objectPos];
KPLIB_GarrisonsBlacklist_HashMap set [_sector, _mapNewValues];
};
};

// Delete the object to spawn it later when the sector is activated
if (_initDelete) then {
deleteVehicle _object;
};

}, [_object, _canGarrison, _initDelete]] call CBA_fnc_waitUntilAndExecute;
Loading