mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Optimize: nearestObjects use object instead of pos
This commit is contained in:
parent
8c28ebc1a9
commit
52e02b954c
@ -13,10 +13,10 @@
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_SpawnTraderMiltia.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_allpositions","_grp","_nrBuilds","_rndHouse","_startPos","_trgt","_unit"];
|
||||
private ["_allpositions","_grp","_nrBuilds","_rndHouse","_startPos","_unit"];
|
||||
//[[[end]]]
|
||||
_trgt = player;
|
||||
_nrBuilds = nearestObjects [getPosATL _trgt,["house"],50];
|
||||
|
||||
_nrBuilds = nearestObjects [player,["house"],50];
|
||||
|
||||
_grp = createGroup [RESISTANCE, true];
|
||||
for "_i" from 1 to 3 step 1 do
|
||||
|
@ -35,7 +35,7 @@ for "_i" from 1 to _count do
|
||||
} else {
|
||||
_wH = objNull;
|
||||
if (isNil "_nearByHolder") then {
|
||||
_nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3];
|
||||
_nearByHolder = nearestObjects [player,["groundWeaponHolder"],3];
|
||||
};
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = player modelToWorld [0,1,0];
|
||||
|
@ -55,7 +55,7 @@ _fnc_dropItem = {
|
||||
{
|
||||
_wH = objNull;
|
||||
if (isNil "_nearByHolder") then {
|
||||
_nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3];
|
||||
_nearByHolder = nearestObjects [player,["groundWeaponHolder"],3];
|
||||
};
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = player modelToWorld [0,1,0];
|
||||
|
@ -18,7 +18,7 @@ if (!isNull cursorTarget) then {
|
||||
};
|
||||
};
|
||||
if (isNull _target) then {
|
||||
_targets = nearestObjects [getPosATL player, ["WeaponHolder", "WeaponHolderSimulated"], 3];
|
||||
_targets = nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 3];
|
||||
if !(_targets isEqualTo []) then {
|
||||
_target = _targets select 0;
|
||||
_forceGear = true;
|
||||
|
@ -17,7 +17,7 @@ private ["_cN","_cP","_near","_nearObjects","_out","_player","_recipe"];
|
||||
//[[[end]]]
|
||||
params ["_recipes"];
|
||||
|
||||
_nearObjects = nearestObjects [position player,["WeaponHolder","LandVehicle","Air"],10];
|
||||
_nearObjects = nearestObjects [player,["WeaponHolder","LandVehicle","Air"],10];
|
||||
|
||||
_near = []; _out = [];
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ if !(false call EPOCH_crafting_checkResources) exitWith {};
|
||||
};
|
||||
} forEach _itemRecipeItems;
|
||||
|
||||
_nearByBench = nearestObjects [position player,["WorkBench_EPOCH"],3];
|
||||
_nearByBench = nearestObjects [player,["WorkBench_EPOCH"],3];
|
||||
|
||||
if (!(_nearByBench isEqualTo []) && (_needBench > 0)) then { //adds item on top of bench if bench was required
|
||||
(_nearByBench select 0) addItemCargoGlobal [_item,1];
|
||||
|
@ -20,7 +20,7 @@ params ["_item","_player",["_token","",[""]] ];
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
if (_item isKindOf "Bag_Base") then {
|
||||
_wH = objNull;
|
||||
_nearByHolder = nearestObjects [position _player,["groundWeaponHolder"],3];
|
||||
_nearByHolder = nearestObjects [_player,["groundWeaponHolder"],3];
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = _player modelToWorld [0,1,0];
|
||||
if (surfaceIsWater _wHPos) then {
|
||||
|
@ -172,9 +172,9 @@ if (_slot != -1) then {
|
||||
if !(EPOCH_VehicleSlots isEqualTo[]) then {
|
||||
_position = getPosATL _player;
|
||||
|
||||
_helipad = nearestObjects[_position, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100];
|
||||
_helipad = nearestObjects[_player, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100];
|
||||
_helipads = [];
|
||||
_smoke = nearestObject[_position, "SmokeShell"];
|
||||
_smoke = nearestObject[_player, "SmokeShell"];
|
||||
if (!isNull _smoke) then {
|
||||
_helipad pushBack _smoke;
|
||||
};
|
||||
@ -276,7 +276,7 @@ if (_slot != -1) then {
|
||||
|
||||
if (_item isKindOf "Bag_Base") then {
|
||||
_wH = objNull;
|
||||
_nearByHolder = nearestObjects [position _player,["groundWeaponHolder"],3];
|
||||
_nearByHolder = nearestObjects [_player,["groundWeaponHolder"],3];
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = _player modelToWorld [0,1,0];
|
||||
if (surfaceIsWater _wHPos) then {
|
||||
|
@ -38,9 +38,9 @@ for "_i" from 1 to _maxStorageLimit do {
|
||||
|
||||
// legacy change class
|
||||
_class = switch (_class_raw) do {
|
||||
case "LockBoxProxy_EPOCH": { "LockBox_EPOCH" };
|
||||
case "SafeProxy_EPOCH": { "Safe_EPOCH" };
|
||||
default { _class_raw };
|
||||
case "LockBoxProxy_EPOCH": { "LockBox_EPOCH" };
|
||||
case "SafeProxy_EPOCH": { "Safe_EPOCH" };
|
||||
default { _class_raw };
|
||||
};
|
||||
|
||||
if !(_inventory isEqualType []) then { _inventory = []; };
|
||||
|
@ -391,7 +391,7 @@ for "_i" from 1 to 3 do {
|
||||
};
|
||||
if ("MAP-LOOT" in _case) then {
|
||||
_temp = _temp + "
|
||||
,[' Loot Marker', [], {"+_skn_tg_map_loot+" = !"+_skn_tg_map_loot+"; if ("+_skn_tg_map_loot+") then {waitUntil {"+_skn_mapLootArray+" = nearestObjects[getPos player, ['WH_Loot', 'Animated_Loot'], 10000];uiSleep 10;!"+_skn_tg_map_loot+"};"+_skn_mapLootArray+" = []};['Loot MARKER',if ("+_skn_tg_map_loot+") then [{2},{1}]] call "+_skn_adminLog_PVC+"}, '2', []]
|
||||
,[' Loot Marker', [], {"+_skn_tg_map_loot+" = !"+_skn_tg_map_loot+"; if ("+_skn_tg_map_loot+") then {waitUntil {"+_skn_mapLootArray+" = nearestObjects[player, ['WH_Loot', 'Animated_Loot'], 10000];uiSleep 10;!"+_skn_tg_map_loot+"};"+_skn_mapLootArray+" = []};['Loot MARKER',if ("+_skn_tg_map_loot+") then [{2},{1}]] call "+_skn_adminLog_PVC+"}, '2', []]
|
||||
";
|
||||
};
|
||||
if ("MAP-VEHICLE" in _case) then {
|
||||
|
Loading…
Reference in New Issue
Block a user