mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
7c65f8503d
* Add enable setting * Exclude man class init * Fix multiplayer terrain pump fuel sync * Add terrain pumps positions * Add vanilla fuel cargo restoring before destroying * Add Livonia positions by bux * Fix terrain pumps destruction * Improve settings init * Fix double settings category * Check enabled var in public functions * Fix fnc_makeSource * Handle recent CUP Terrains changes * Update includes * Fix issues introduced in #9133 * Change warning Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Optimisations and cleanup - Use hashmaps wherever possible - Reduced pump search radius by ~30% - Sorted pumps alphabetically and sorted positions by "smallest" first, for consistency * Add init debug trace * compileScript in dev * yoda conditions & DFUNC macro * Wait until CBA settings are ready * Update Chernarus 2020 and add more maps configs * Remove vanilla fuel cargo restoring before destroying --------- Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
85 lines
2.7 KiB
Plaintext
85 lines
2.7 KiB
Plaintext
// call compileScript ["z\ace\addons\refuel\dev\exportTerrainRefuelPositions.sqf"]
|
|
// can be run in Eden Editor console
|
|
|
|
#include "\z\ace\addons\refuel\script_component.hpp"
|
|
|
|
private _basePumps = [];
|
|
private _totalCount = 0;
|
|
private _posCount = 0;
|
|
private _message = "";
|
|
private _halfWorldSize = worldSize / 2;
|
|
private _worldCenter = [_halfWorldSize, _halfWorldSize];
|
|
_halfWorldSize = _halfWorldSize * sqrt 2;
|
|
|
|
private _baseStaticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseStatic));
|
|
private _class = "";
|
|
private _objects = [];
|
|
private _positions = [];
|
|
private _object = objNull;
|
|
private _pos = [];
|
|
|
|
{
|
|
_class = _x;
|
|
_objects = _worldCenter nearObjects [_class, _halfWorldSize];
|
|
if (_objects isEqualTo []) then {
|
|
continue;
|
|
};
|
|
ADD(_totalCount,count _objects);
|
|
_positions = [];
|
|
{
|
|
_object = _x;
|
|
_pos = ASLToAGL getPosASL _object;
|
|
if (-1 < _positions findIf {60 > _x distance _pos && {20 < _x distance _pos}}) then {
|
|
_message = "INCREASE DISTANCE " + str _pos;
|
|
};
|
|
if (-1 == _positions findIf {20 > _x distance _pos}) then {
|
|
_positions pushBack (_pos apply {round _x});
|
|
INC(_posCount);
|
|
};
|
|
} forEach _objects;
|
|
_positions sort true; // sort positions by smallest first
|
|
_basePumps pushBack [_class, _positions];
|
|
} forEach _baseStaticClasses;
|
|
|
|
_basePumps sort true; // sort pump classes alphabetically
|
|
|
|
// check final array as it's calculated in postInit
|
|
private _checkCount = 0;
|
|
{
|
|
_x params ["_class", "_positions"];
|
|
{
|
|
_checkCount = _checkCount + count (_x nearObjects [_class, 30]);
|
|
} forEach _positions;
|
|
} forEach _basePumps;
|
|
if (_checkCount != _totalCount) then {
|
|
_message = "WRONG COUNT " + str _checkCount;
|
|
};
|
|
|
|
// export text
|
|
private _nl = toString [10];
|
|
private _multipleBasePumps = 1 < count _basePumps;
|
|
private _output = [format [" %1[] = { /* %2 */", worldName, getText (configfile >> "CfgWorlds" >> worldName >> "description")]];
|
|
{
|
|
if (_forEachIndex > 0) then {_output pushBack ","};
|
|
_x params ["_class", "_positions"];
|
|
if (_multipleBasePumps) then {
|
|
_output pushBack (_nl + " ");
|
|
} else {
|
|
_output pushBack " ";
|
|
};
|
|
_output pushBack format ["{""%1"", {", _class];
|
|
{
|
|
if (_forEachIndex > 0) then {_output pushBack ","};
|
|
_output pushBack format ["{%1,%2,%3}", _x#0, _x#1, _x#2];
|
|
} forEach _positions;
|
|
_output pushBack "}}";
|
|
} forEach _basePumps;
|
|
if (_multipleBasePumps) then {_output pushBack (_nl + " ")};
|
|
if (_basePumps isEqualTo []) then {_output pushBack " "};
|
|
_output pushBack ("};" + _nl);
|
|
|
|
_output = _output joinString "";
|
|
|
|
copyToClipboard _output;
|
|
[_totalCount, _posCount, _message, _output]
|