Skip to content

Commit f6f2fb0

Browse files
authored
fn_sectorObjectBlacklist.sqf Rethink
1 parent fccde8b commit f6f2fb0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Missionframework/functions/fn_sectorObjectBlacklist.sqf

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22
File: fn_sectorObjectBlacklist.sqf
33
Author: PiG13BR - https://github.com/PiG13BR
44
Date: 2024-11-23
5-
Last Update: 2024-12-01
5+
Last Update: 2024-12-16
66
License: MIT License - http://www.opensource.org/licenses/MIT
77
88
Description:
99
This is where the object have the option to remain in the map and not be spawned/despawned in designated sector.
1010
Adds the object in a blacklist. The object in the blacklist will not be deleted in the game start and will retain any attributes from editor. If the object is a simple object, it will be automatic ignored in the fn_registerSectorObjects.sqf file.
1111
Also, if the object classname is in KPLIB_staticsConfigs, the spawning of static weapons for this building object can be disabled (NOT THE ENTIRE CLASS) and it will be managed in a different blacklist.
12-
To add an object in the blacklist, put this code in it's init field. Follow the examples below:
12+
To add an object in the blacklist, put this code in its init field. Follow the examples below:
1313
[this] call KPLIB_fnc_sectorObjectBlacklist - object blacklisted, static weapons can spawn in garrison buildings as default
1414
[this, false, false] call KPLIB_fnc_sectorObjectBlacklist - object not blacklisted and static weapon spawn disabled
1515
[this, true, false] call KPLIB_fnc_sectorObjectBlacklist - object blacklisted and static weapon spawn disabled
1616
[this, false, true] call KPLIB_fnc_sectorObjectBlacklist - Normal behaviour without calling this function
1717
This function must be put in the init field of the objects to run before any liberation script (https://community.bistudio.com/wiki/Initialisation_Order)
1818
19+
If some of those buildings already exists in the map (as terrain) and you want to disable the spawning of static weapons, for example, place a logic near the object and in its init field:
20+
{[_x, true, false] call KPLIB_fnc_sectorObjectBlacklist}forEach (nearestObjects [getPos this, ["classname_object"], 25, false])
21+
Find the correct classname of the object and change the radius of search if needed. Those terrain objects can't be deleted, so leave the second parameter of the function as TRUE.
22+
1923
Parameter(s):
2024
_object - structure that will be registered [OBJECT]
2125
_blacklisted - true for blacklisting the object [BOOL, defaults as true]
@@ -50,12 +54,15 @@ if (isNil "KPLIB_GarrisonsBlacklist_HashMap") then {
5054
KPLIB_GarrisonsBlacklist_HashMap = createHashMap;
5155
};
5256

57+
private _radius = KPLIB_range_sectorCapture;
58+
5359
if (!_canGarrison) then {
5460
[{!isNil "KPLIB_sectors_all"}, {
5561
_this params ["_object", "_canGarrison"];
5662
// 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.
57-
private _objectPos = getPosATL _object;
63+
private _objectPos = [round parseNumber (((getPosATL _object) # 0) toFixed 2), round parseNumber (((getPosATL _object) # 1) toFixed 2), round parseNumber (((getPosATL _object) # 2) toFixed 2)];
5864
private _sector = [_radius, getPos _object] call KPLIB_fnc_getNearestSector;
65+
//private _objectPos = _object worldToModel (markerPos _sector);
5966

6067
if !(_sector in KPLIB_GarrisonsBlacklist_HashMap) then {
6168
// Create a new key with a value

0 commit comments

Comments
 (0)