mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Update fn_getModelName to be much faster
Made by @Victor-the-Cleaner
This commit is contained in:
@@ -1,25 +1,18 @@
|
||||
private ["_i","_k","_lenInfo","_objInfo","_objName"];
|
||||
local _model = "";
|
||||
|
||||
_objInfo = toArray(str(_this));
|
||||
_lenInfo = count _objInfo - 1;
|
||||
_objName = [];
|
||||
_i = 0;
|
||||
// determine where the object name starts
|
||||
{
|
||||
if (58 == _objInfo select _i) exitWith {};
|
||||
_i = _i + 1;
|
||||
} count _objInfo;
|
||||
if (!isNull _this) then {
|
||||
|
||||
_i = _i + 2; // skip the ": " part
|
||||
local _array = toArray (str _this);
|
||||
local _begin = (_array find 58) + 2; // ": "
|
||||
local _array2 = [];
|
||||
|
||||
for "_k" from _i to _lenInfo do {
|
||||
_objName set [(count _objName), (_objInfo select _k)];
|
||||
for "_i" from _begin to ((count _array) - 1) do {
|
||||
_array2 = _array2 + [_array select _i];
|
||||
};
|
||||
if (!local _this) then {
|
||||
_array2 resize ((count _array2) - 7); // " REMOTE"
|
||||
};
|
||||
|
||||
_model = toLower (toString _array2);
|
||||
};
|
||||
|
||||
if (!local _this) then {
|
||||
//Strip " remote" from the end to return the same name for local and remote objects
|
||||
_objName resize ((count _objName) - 7);
|
||||
};
|
||||
|
||||
_objName = toLower(toString(_objName));
|
||||
_objName
|
||||
_model
|
||||
Reference in New Issue
Block a user