|
2 | 2 | File: fn_sectorObjectBlacklist.sqf
|
3 | 3 | Author: PiG13BR - https://github.com/PiG13BR
|
4 | 4 | Date: 2024-11-23
|
5 |
| - Last Update: 2024-12-01 |
| 5 | + Last Update: 2024-12-16 |
6 | 6 | License: MIT License - http://www.opensource.org/licenses/MIT
|
7 | 7 |
|
8 | 8 | Description:
|
9 | 9 | This is where the object have the option to remain in the map and not be spawned/despawned in designated sector.
|
10 | 10 | 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.
|
11 | 11 | 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: |
13 | 13 | [this] call KPLIB_fnc_sectorObjectBlacklist - object blacklisted, static weapons can spawn in garrison buildings as default
|
14 | 14 | [this, false, false] call KPLIB_fnc_sectorObjectBlacklist - object not blacklisted and static weapon spawn disabled
|
15 | 15 | [this, true, false] call KPLIB_fnc_sectorObjectBlacklist - object blacklisted and static weapon spawn disabled
|
16 | 16 | [this, false, true] call KPLIB_fnc_sectorObjectBlacklist - Normal behaviour without calling this function
|
17 | 17 | 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)
|
18 | 18 |
|
| 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 | +
|
19 | 23 | Parameter(s):
|
20 | 24 | _object - structure that will be registered [OBJECT]
|
21 | 25 | _blacklisted - true for blacklisting the object [BOOL, defaults as true]
|
@@ -50,12 +54,15 @@ if (isNil "KPLIB_GarrisonsBlacklist_HashMap") then {
|
50 | 54 | KPLIB_GarrisonsBlacklist_HashMap = createHashMap;
|
51 | 55 | };
|
52 | 56 |
|
| 57 | +private _radius = KPLIB_range_sectorCapture; |
| 58 | + |
53 | 59 | if (!_canGarrison) then {
|
54 | 60 | [{!isNil "KPLIB_sectors_all"}, {
|
55 | 61 | _this params ["_object", "_canGarrison"];
|
56 | 62 | // 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)]; |
58 | 64 | private _sector = [_radius, getPos _object] call KPLIB_fnc_getNearestSector;
|
| 65 | + //private _objectPos = _object worldToModel (markerPos _sector); |
59 | 66 |
|
60 | 67 | if !(_sector in KPLIB_GarrisonsBlacklist_HashMap) then {
|
61 | 68 | // Create a new key with a value
|
|
0 commit comments