mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Remove legacy stream_location functions
These are no longer used for anything.
This commit is contained in:
@@ -113,7 +113,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
|
||||
if (_canSpawn) then {
|
||||
_dis = _x distance player;
|
||||
_checkLoot = (count (getArray (_config >> "lootPos"))) > 0;
|
||||
_islocal = _x getVariable ["", false]; // object created locally via TownGenerator. See stream_locationFill.sqf
|
||||
_islocal = _x getVariable ["", false]; // object created locally via TownGenerator.
|
||||
|
||||
//Make sure wrecks always spawn Zeds
|
||||
_isWreck = _x isKindOf "CrashSite";
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
//private ["_location","_distCfg","_configClass","_distAct","_rubbish","_config","_locHdr","_w8","_ahead","_forEachIndex"];
|
||||
_w8 = _this select 0;
|
||||
_rubbish = dayz_Trash == 1;
|
||||
{
|
||||
_location = _x select 0;
|
||||
_distCfg = (_x select 2);
|
||||
_configClass = _x select 1;
|
||||
_distAct = player distance _location;
|
||||
_ahead = (speed player) / 3.6 * 6;
|
||||
|
||||
if (!(_forEachIndex in dayz_locationsActive)) then {
|
||||
if ((_distAct < _distCfg + dayz_spawnArea + _ahead) and _rubbish) then {
|
||||
dayz_locationsActive set [count dayz_locationsActive,_forEachIndex];
|
||||
_config = configFile >> "CfgTownGeneratorChernarus" >> _configClass;
|
||||
_locHdr = configName _config;
|
||||
//if (typeName _locHdr != "STRING") then { _locHdr = str _location; };
|
||||
diag_log format ["%1: creating %2 objects at '%3'", __FILE__, count _config, _locHdr];
|
||||
[_config, _w8] call stream_locationFill; // create wrecks & rubbish as local objects
|
||||
|
||||
};
|
||||
} else {
|
||||
if (_distAct > _distCfg + dayz_canDelete + _ahead) then {
|
||||
_config = configFile >> "CfgTownGeneratorChernarus" >> _configClass;
|
||||
_locHdr = configName _config;
|
||||
//if (typeName _locHdr != "STRING") then { _locHdr = str _location; };
|
||||
diag_log format ["%1: removing %2 objects from '%3'", __FILE__, count _config, _locHdr];
|
||||
[_config, _w8] call stream_locationDel; // delete wrecks & rubbish
|
||||
dayz_locationsActive = dayz_locationsActive - [_forEachIndex];
|
||||
};
|
||||
|
||||
};
|
||||
} forEach dayz_Locations;
|
||||
|
||||
/*
|
||||
_location = 0;
|
||||
_distCfg = 0;
|
||||
_configClass = 0;
|
||||
_distAct = 0;
|
||||
{
|
||||
_location = _x select 0;
|
||||
_distCfg = (_x select 2);
|
||||
_configClass = _x select 1;
|
||||
_distAct = player distance _location;
|
||||
|
||||
if (!(_forEachIndex in dayz_gridsActive)) then {
|
||||
if (_distAct < _distCfg) then {
|
||||
dayz_gridsActive set [count dayz_gridsActive,_forEachIndex];
|
||||
|
||||
PVDZ_gridsActive = [_forEachIndex,_location];
|
||||
publicVariableServer "PVDZ_gridsActive";
|
||||
|
||||
systemChat (str(_configClass));
|
||||
};
|
||||
} else {
|
||||
if (_distAct > _distCfg) then {
|
||||
dayz_gridsActive = dayz_gridsActive - [_forEachIndex];
|
||||
|
||||
PVDZ_gridsRemove = [_forEachIndex,_location];
|
||||
publicVariableServer "PVDZ_gridsRemove";
|
||||
|
||||
diag_log("Out of Range: "+str(_forEachIndex));
|
||||
};
|
||||
};
|
||||
} forEach dayz_GridSystem;
|
||||
*/
|
||||
@@ -1,16 +0,0 @@
|
||||
//private ["_config","_type","_position","_object","_list"];
|
||||
_list = _this select 0;
|
||||
//_w8 = _this select 1;
|
||||
for "_i" from ((count _list) - 1) to 0 step -1 do
|
||||
{
|
||||
_config = (_list select _i);
|
||||
if (isClass(_config)) then {
|
||||
_type = getText (_config >> "ctype");
|
||||
_position = getArray (_config >> "position");
|
||||
_object = nearestObject [_position,_type];
|
||||
deleteVehicle _object;
|
||||
if ((_i % 25) == 0) then { uiSleep 0.01; };
|
||||
};
|
||||
uiSleep 0.001;
|
||||
};
|
||||
//diag_log ("CLEAR: " + str(_this));
|
||||
@@ -1,39 +0,0 @@
|
||||
//private ["_config","_type","_position","_dir","_object","_list","_w8","_dis"];
|
||||
_list = _this select 0;
|
||||
_w8 = _this select 1;
|
||||
for "_i" from ((count _list) - 1) to 0 step -1 do
|
||||
{
|
||||
_config = (_list select _i);
|
||||
if (isClass(_config)) then {
|
||||
_type = getText (_config >> "type");
|
||||
_position = [] + getArray (_config >> "position");
|
||||
_dir = getNumber (_config >> "direction");
|
||||
//_onFire = getNumber (_config >> "onFire");
|
||||
_dis = _position distance player;
|
||||
_inVehicle = (vehicle player != player);
|
||||
|
||||
if (_dis > 2) then {
|
||||
_object = _type createVehicleLocal [_position select 0,_position select 1,-100];
|
||||
_object setDir _dir;
|
||||
_object setPos [_position select 0,_position select 1,0];
|
||||
_object setPosATL _position;
|
||||
_object allowDamage false;
|
||||
_object setVariable ["", true]; // SV used by player_spawnCheck
|
||||
//if (_w8 AND {((_i % 25) == 0)}) then { uiSleep 0.01; };
|
||||
|
||||
} else {
|
||||
if (!_inVehicle) then {
|
||||
_object = _type createVehicleLocal [_position select 0,_position select 1,-100];
|
||||
_object setDir _dir;
|
||||
_object setPos [_position select 0,_position select 1,0];
|
||||
_object setPosATL _position;
|
||||
_object allowDamage false;
|
||||
_object setVariable ["", true]; // SV used by player_spawnCheck
|
||||
if (_w8 AND {((_i % 25) == 0)}) then { uiSleep 0.01; };
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
//uiSleep 0.001;
|
||||
};
|
||||
//diag_log ("FILL: " + str(_list));
|
||||
@@ -43,9 +43,6 @@ if (!isDedicated) then {
|
||||
case "vanilla": {compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_updateGui.sqf";};
|
||||
};
|
||||
player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
|
||||
stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
|
||||
stream_locationDel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationDel.sqf";
|
||||
stream_locationCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationCheck.sqf";
|
||||
player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
|
||||
//player_login = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_login.sqf"; //Used to generate ambient music
|
||||
player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
|
||||
|
||||
@@ -118,29 +118,6 @@ if (isServer) then {
|
||||
(owner _owner) publicVariableClient "PVDZ_receiveUnconscious";
|
||||
};
|
||||
|
||||
"PVDZ_gridsActive" addPublicVariableEventHandler {
|
||||
_gridref = (_this select 1) select 0;
|
||||
_gridloc = (_this select 1) select 1;
|
||||
|
||||
if !(_gridref in dayz_gridsActive) then {
|
||||
dayz_gridsActive set [count dayz_gridsActive,_gridref];
|
||||
dayz_seedloot set [count dayz_seedloot,[_gridloc,_gridref]];
|
||||
};
|
||||
diag_log format ["%1, %2, %3", _gridref, dayz_gridsActive, dayz_seedloot];
|
||||
};
|
||||
|
||||
"PVDZ_gridsRemove" addPublicVariableEventHandler {
|
||||
_gridref = (_this select 1) select 0;
|
||||
_gridloc = (_this select 1) select 1;
|
||||
|
||||
if (_gridref in dayz_gridsActive) then {
|
||||
dayz_gridsActive = dayz_gridsActive - [_gridref];
|
||||
dayz_deseedloot set [count dayz_deseedloot,[_gridloc,_gridref]];
|
||||
};
|
||||
diag_log format ["%1, %2", _gridref, dayz_gridsActive];
|
||||
};
|
||||
|
||||
|
||||
"PVDZ_Server_Simulation" addPublicVariableEventHandler {
|
||||
_agent = (_this select 1) select 0;
|
||||
_control = (_this select 1) select 1;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
disableSerialization;
|
||||
dayz_Trash = 1; // 0=off, 1=on
|
||||
|
||||
//Model Variables
|
||||
Bandit1_DZ = "Bandit1_DZ";
|
||||
@@ -139,10 +138,6 @@ SleepTemperatur = 90 / 100; //First value = Minutes until player reaches the col
|
||||
allowConnection = false;
|
||||
dayz_serverObjectMonitor = [];
|
||||
|
||||
//Streaming Variables (player only)
|
||||
dayz_Locations = [];
|
||||
dayz_locationsActive = [];
|
||||
|
||||
//GUI
|
||||
Dayz_GUI_R = 0.38; // 0.7 .38
|
||||
Dayz_GUI_G = 0.63; // -0.63
|
||||
@@ -368,7 +363,6 @@ dayz_animalDistance = 600;
|
||||
dayz_plantDistance = 600;
|
||||
|
||||
dayz_maxMaxModels = 80; // max quantity of Man models (player or Z, dead or alive) around players. Below this limit we can spawn Z // max quantity of loot piles around players. Below this limit we can spawn some loot
|
||||
dayz_spawnArea = 300; // radius around player where we can spawn loot & Z
|
||||
dayz_cantseeDist = 150; // distance from which we can spawn a Z in front of any player without ray-tracing and angle checks
|
||||
dayz_cantseefov = 70; // half player field-of-view. Visible Z won't be spawned in front of any near players
|
||||
dayz_canDelete = 350; // Z, further than this distance from its "owner", will be deleted
|
||||
@@ -529,8 +523,6 @@ if (isServer) then {
|
||||
DayZ_removableObjects = ["Wire_cat1","Sandbag1_DZ","Hedgehog_DZ","CamoNet_DZ","Trap_Cans","TrapTripwireFlare","TrapBearTrapSmoke","TrapTripwireGrenade","TrapTripwireSmoke","TrapBearTrapFlare"];
|
||||
//[10416.695, 4198.4634],[7982.2563, 1419.8256],[10795.93, 1419.8263],[7966.083, 4088.7463],[9259.7266, 2746.1985],[5200.5234, 3915.3274],[6494.1665, 2572.7798],[5216.6968, 1246.407],[2564.7244, 3915.3296],[3858.3674, 2572.782],[2580.8977, 1246.4092],[13398.995, 4400.5874],[12242.025, 2948.3196],[13551.842, 1832.2257],[14870.512, 3009.5117],[-178.19415, 1062.4478],[1099.2754, 2388.8206],[-194.36755, 3731.3679],[10394.215, 8322.1719],[7959.7759, 5543.5342],[10773.449, 5543.5342],
|
||||
dayz_grid =[[7943.6025, 8212.4551],[9237.2461, 6869.9063],[5178.043, 8039.0361],[6471.686, 6696.4883],[5194.2163, 5370.1152],[2542.2439, 8039.0381],[3835.887, 6696.4902],[2558.4172, 5370.1172],[13376.514, 8524.2969],[12219.544, 7072.0273],[13529.361, 5955.9336],[14848.032, 7133.2197],[-200.67474, 5186.1563],[1076.7949, 6512.5283],[-216.84814, 7855.0771],[10293.751, 12197.736],[7859.312, 9419.0996],[10672.988, 9419.0996],[7843.1387, 12088.021],[9136.7822, 10745.474],[5077.5791, 11914.601],[6371.2222, 10572.052],[5093.7524, 9245.6816],[2441.78, 11914.604],[3735.4231, 10572.055],[2457.9534, 9245.6816],[13276.053, 12399.861],[12119.08, 10947.596],[13428.897, 9831.501],[14747.566, 11008.786],[-301.13867, 9061.7207],[976.33112, 10388.096],[-317.31201, 11730.642],[10271.271, 16321.429],[7836.8315, 13542.813],[10650.506, 13542.813],[7820.6582, 16211.718],[9114.3018, 14869.175],[5055.0986, 16038.3],[6348.7417, 14695.758],[5071.272, 13369.392],[2419.2996, 16038.305],[3712.9426, 14695.76],[2435.4729, 13369.392],[13253.568, 16523.553],[12096.6, 15071.295],[13406.416, 13955.209],[14725.089, 15132.486],[-323.61914, 13185.43],[953.85059, 14511.8],[-339.79248, 15854.346]];
|
||||
dayz_gridsActive = [];
|
||||
dayz_seedloot = [];
|
||||
dayz_deseedloot = [];
|
||||
dayz_ghostPlayers = [];
|
||||
dayz_activePlayers = [];
|
||||
@@ -552,47 +544,11 @@ if (isServer) then {
|
||||
};
|
||||
|
||||
if (!isDedicated) then {
|
||||
//Establish Location Streaming
|
||||
_funcGetLocation =
|
||||
{
|
||||
dayz_Locations = [];
|
||||
for "_i" from 0 to ((count _this) - 1) do
|
||||
{
|
||||
private ["_location","_config","_locHdr","_position","_size","_type"];
|
||||
//Get Location Data from config
|
||||
_config = _this select _i;
|
||||
_position = getArray (_config >> "position");
|
||||
_locHdr = configName _config;
|
||||
_size = getNumber (_config >> "size");
|
||||
dayz_Locations set [count dayz_Locations, [_position,_locHdr,_size]];
|
||||
};
|
||||
};
|
||||
_cfgLocation = configFile >> "CfgTownGeneratorChernarus";
|
||||
_cfgLocation call _funcGetLocation;
|
||||
|
||||
_funcGetGrid =
|
||||
{
|
||||
dayz_GridSystem = [];
|
||||
for "_i" from 0 to ((count _this) - 1) do
|
||||
{
|
||||
private ["_location","_config","_locHdr","_position","_size","_type"];
|
||||
_config = _this select _i;
|
||||
_position = getArray (_config >> "position");
|
||||
_locHdr = configName _config;
|
||||
_size = getNumber (_config >> "size");
|
||||
dayz_GridSystem set [count dayz_GridSystem, [_position,_locHdr,_size]];
|
||||
};
|
||||
};
|
||||
_cfggrid = configFile >> "CfgGrid";
|
||||
_cfggrid call _funcGetGrid;
|
||||
|
||||
dayz_buildingMonitor = []; //Buildings to check
|
||||
dayz_bodyMonitor = [];
|
||||
dayz_flyMonitor = [];
|
||||
dayz_zedMonitor = [];
|
||||
dayz_buildingBubbleMonitor = [];
|
||||
dayz_gridsActive = [];
|
||||
|
||||
dayz_baseTypes = if (DZE_MissionLootTable) then {getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass")} else {getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass")};
|
||||
|
||||
//temperature variables
|
||||
|
||||
@@ -370,207 +370,6 @@ fa_staywithus = {
|
||||
}
|
||||
};
|
||||
|
||||
// used only by fa_server_locationCheck
|
||||
stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
|
||||
dayz_locationsActive = [];
|
||||
// used only by fa_smartlocation. Same as stream_locationCheck, but without any deletion.
|
||||
fa_server_locationCheck = {
|
||||
private ["_point","_rad","_config","_i","_location","_distCfg","_distAct"];
|
||||
|
||||
_point = _this select 0;
|
||||
_rad = _this select 1;
|
||||
_config = configFile >> "CfgTownGeneratorChernarus";
|
||||
|
||||
if (count _point >= 2) then {
|
||||
for "_i" from (count _config -1) to 0 step -1 do {
|
||||
_x = _config select _i;
|
||||
_location = getArray (_x >> "position");
|
||||
_distCfg = getNumber (_x >> "size");
|
||||
_distAct = [_point select 0, _point select 1, 0] distance [_location select 0, _location select 1, 0];
|
||||
|
||||
if (!(_i in dayz_locationsActive)) then {
|
||||
if (_distAct < _distCfg + _rad) then {
|
||||
dayz_locationsActive set [count dayz_locationsActive,_i];
|
||||
diag_log format ["%1::fa_server_locationCheck : creating %2 objects at '%3'", __FILE__, count _x, _location];
|
||||
[_x, false] call stream_locationFill; // create wrecks & rubbish as local objects
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// used only by fa_smartlocation
|
||||
fa_smartlocation_commonTests = { // [_type, _pos, _minAltitude, _maxAltitude, _found]
|
||||
private ["_found", "_point", "_worldspace"];
|
||||
|
||||
_found = false;
|
||||
_point = _this select 1;
|
||||
|
||||
//diag_log(format["fa_smartlocation %1 %2", __LINE__, _this]);
|
||||
|
||||
_point set [2, 0];
|
||||
_point = ATLtoASL _point;
|
||||
if (((_point select 2) < _this select 3) AND {((_point select 2) > _this select 2)}) then {
|
||||
if (count (_point nearEntities [["Air", "LandVehicle", "Ship"], _this select 4]) <= 0) then {
|
||||
if (_this select 3 < 0) then { // boats
|
||||
_found = surfaceisWater _point;
|
||||
}
|
||||
else { // not boats
|
||||
_point set [2, 0];
|
||||
_worldspace = [_this select 0, _point] call fn_niceSpot;
|
||||
if (count _worldspace == 2) then {
|
||||
_point = _worldspace select 1;
|
||||
(_this select 1) set [0, _point select 0];
|
||||
(_this select 1) set [1, _point select 1];
|
||||
(_this select 1) set [2, 0];
|
||||
_found = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
// diag_log(format["fa_smartlocation %1 %2", __LINE__, _this]);
|
||||
|
||||
_found
|
||||
};
|
||||
|
||||
// move vehicle to a safe position, respawn vehicle.
|
||||
fa_smartlocation = {
|
||||
private ["_type","_class","_dir","_oldpos","_action","_distance","_minAltitude","_maxAltitude","_tmpobject","_width","_found","_wp","_worldCenter","_worldRadius","_locations","_radius","_nearObjectTypes","_types","_pickedLocation","_o","_objects","_counter","_locpos","_loc","_y","_r","_deg","_veh","_size","_old", "_point"];
|
||||
|
||||
_type = _this select 0; // vehicle "typeOf"
|
||||
_class = _type;
|
||||
if (_type isKindOf "Air") then { _class = "Land_Ind_TankBig"; }; // for helis we take a big circular tank as a footprint
|
||||
_dir = _this select 1;
|
||||
_oldpos = +(_this select 2); // current vehicle position (from hive)
|
||||
_action = _this select 3; // "OBJ"=> read from hive, keep position the best we can. Otherwise: choose a random position.
|
||||
_distance = 500; // distance from other vehicles. decrease as soon as we can't find a spot
|
||||
|
||||
_minAltitude = getNumber(CONFIGBASE_VEHMAINTENANCE >> _type >> "minAltitude");
|
||||
_maxAltitude = getNumber(CONFIGBASE_VEHMAINTENANCE >> _type >> "maxAltitude");
|
||||
|
||||
// workaround for sizeof bug -- do not remove
|
||||
_tmpobject = _class createVehicleLocal (getMarkerPos "respawn_west");
|
||||
sleep 0.01; // wait object loading
|
||||
_width = (((boundingBox _tmpobject) select 1) select 0);
|
||||
//diag_log(format["fa_smartlocation _this:%1 %2", _this, (sizeOf _class)]);
|
||||
|
||||
_point = [];
|
||||
_found = false;
|
||||
// try to place the object in a safe position near current position
|
||||
if ((!(_action IN [ "CREATED", "SPAWNED"])) and {(count _oldpos>=2)}) then {
|
||||
#ifdef VEH_MAINTENANCE_FIX_OUTOFMAP
|
||||
// move object back on the map
|
||||
_wp = [0, _oldpos] call fa_staywithus; // use ATL format
|
||||
_point = +(_wp select 1);
|
||||
if (count _point < 2) then { _point = _oldpos; };
|
||||
#else
|
||||
_point = +(_oldpos);
|
||||
#endif
|
||||
// find a safe position around current position for air vehicles
|
||||
if (_type isKindOf "Air") then {
|
||||
[_point, 20] call fa_server_locationCheck; // towngenerator around spawn point, to limit collisions
|
||||
deleteVehicle _tmpobject;
|
||||
_tmpobject = _class createVehicleLocal _point;
|
||||
_point = getPosATL _tmpobject;
|
||||
};
|
||||
// check altitude
|
||||
#ifdef VEH_MAINTENANCE_FIX_OUTOFMAP
|
||||
if (count _point >= 2) then {
|
||||
_point set [2, 0];
|
||||
_point = ATLtoASL _point;
|
||||
_found = (((_point select 2) < _maxAltitude) AND {((_point select 2) > _minAltitude)});
|
||||
};
|
||||
#else
|
||||
_found = true;
|
||||
#endif
|
||||
/*diag_log(format["fa_smartlocation: Looking for a safe place near original position... _action:%1 _type:%2 suitable:%3 distance:%4",
|
||||
_action,
|
||||
_type,
|
||||
_found,
|
||||
if (_found) then { [_oldpos, _point] call BIS_fnc_distance2D } else { "" }
|
||||
]);*/
|
||||
}
|
||||
else {
|
||||
[_point, 20] call fa_server_locationCheck; // towngenerator around spawn point, to limit collisions
|
||||
};
|
||||
deleteVehicle _tmpobject;
|
||||
sleep 0.01; // wait object destroy. nearEntities may return false info if not done.
|
||||
#ifndef VEH_MAINTENANCE_DONT_BE_SMART
|
||||
if (!_found) then { // we failed to find a suitable position around current one, so respawn vehicle
|
||||
_worldCenter = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "center");
|
||||
_worldRadius = getNumber(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "spawnRadius");
|
||||
|
||||
// if vehicle is not described in configFile, then locations is empty.
|
||||
_locations = nearestLocations [
|
||||
_worldCenter,
|
||||
getArray(CONFIGBASE_VEHMAINTENANCE >> _type >> "localityTypes"),
|
||||
_worldRadius
|
||||
];
|
||||
_radius = getNumber(CONFIGBASE_VEHMAINTENANCE >> _type >> "localityRadius");
|
||||
_nearObjectTypes = getArray(CONFIGBASE_VEHMAINTENANCE >> _type >> "nearObjects");
|
||||
// diag_log(format["fa_smartlocation: Getting choice logic: Altitude min:%1 max:%2 _radius:%3 _types=%4 countlocations:%5", _minAltitude, _maxAltitude, _radius, _nearObjectTypes, (count _locations) ]);
|
||||
_pickedLocation = nil;
|
||||
_o = nil;
|
||||
_objects = nil;
|
||||
_counter = 0;
|
||||
_point = [];
|
||||
while ({count _locations > 0 AND !_found}) do {
|
||||
_pickedLocation = _locations call BIS_fnc_selectRandom;
|
||||
_locpos = position _pickedLocation;
|
||||
_locpos set [2,0];
|
||||
_locpos = ATLtoASL _locpos;
|
||||
// if location is in the sea, or on the ground and at the right altitude
|
||||
if ((_maxAltitude<0) OR {(((_locpos select 2) < _maxAltitude+0.05*_radius) AND {((_locpos select 2) > _minAltitude-0.05*_radius)})}) then {
|
||||
[_locpos, _radius] call fa_server_locationCheck;
|
||||
if (count _nearObjectTypes > 0 ) then { // spawn close to an object
|
||||
_objects = nearestObjects [_locpos, _nearObjectTypes, _radius];
|
||||
//diag_log(format["fa_smartlocation: In locality loop _loc:%1 near objects count:%2 ", _pickedLocation, count _objects ]);
|
||||
while ({count _objects > 0 AND !_found}) do {
|
||||
_counter=_counter+0.0001;
|
||||
_o = _objects call BIS_fnc_selectRandom;
|
||||
// move spot in front of object, according to object length (its Y axis) and vehicle width (its X axis)
|
||||
// vehicle should be located slightly in front object, twisted by a 90* angle
|
||||
_point = _o modelToWorld [0,-(_width+(((boundingBox _o) select 1) select 1))/2,0];
|
||||
_point set [2, 0];
|
||||
_dir = (getDir _o)+90;
|
||||
_found = [_class, _point, _minAltitude, _maxAltitude, _distance] call fa_smartlocation_commonTests;
|
||||
//if (_found) then { diag_log(format["fa_smartlocation %1 %3 +--> %2", __LINE__, _point, _oldpos]); };
|
||||
_objects = _objects - [_o];
|
||||
_distance = _distance * 0.995;
|
||||
};
|
||||
}
|
||||
else { // spawn anywhere on the location
|
||||
for [{_y = _radius * _radius / 20000}, {(_y > 0 ) AND !_found}, {_y = _y - 1}] do {
|
||||
_counter=_counter+0.0001;
|
||||
_r = random(_radius*_radius)^0.5;
|
||||
_deg = random 360;
|
||||
_point = [(_locpos select 0) + sin(_deg) * _r, (_locpos select 1) + cos(_deg) * _r, 0];
|
||||
_dir = _deg;
|
||||
_found = [_class, _point, _minAltitude, _maxAltitude,_distance] call fa_smartlocation_commonTests;
|
||||
//if (_found) then { diag_log(format["fa_smartlocation %1 %3 +--> %2", __LINE__, _point, _oldpos]); };
|
||||
_distance = _distance * 0.995;
|
||||
};
|
||||
};
|
||||
}; // was suitable altitude
|
||||
_counter = _counter + 1;
|
||||
_locations = _locations - [_pickedLocation];
|
||||
}; // while suitable location
|
||||
diag_log(format["fa_smartlocation: %2 _veh:%1 _size:%6 _old:%8 |--> _point:%3 _pickedLocation:%4 _counter=%5 badly near:%7",
|
||||
_type,
|
||||
if (_found) then {"ok"} else {"** FAILED **"},
|
||||
_point,
|
||||
if (!isNil "_pickedLocation") then {text(_pickedLocation)} else {""},
|
||||
_counter, (sizeOf _class),
|
||||
if (count _point >0) then { (_point nearEntities [["Air", "LandVehicle", "Ship"],_distance])-[_tmpobject] } else { "" },
|
||||
_oldpos
|
||||
]);
|
||||
};
|
||||
#endif
|
||||
|
||||
if (_found) then { [_dir, [_point select 0, _point select 1, 0]] } else { [] }
|
||||
};
|
||||
|
||||
|
||||
FNC_kindOf = {
|
||||
_inherit = inheritsFrom _this;
|
||||
_list = [configName _this];
|
||||
|
||||
Reference in New Issue
Block a user