Advertisement
secondcoming

ExileClient_system_lootManager_thread_spawn.sqf

Jul 22nd, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.10 KB | None | 0 0
  1. /**
  2.  * ExileClient_system_lootManager_thread_spawn
  3.  *
  4.  * Exile Mod
  5.  * www.exilemod.com
  6.  * © 2015 Exile Mod Team
  7.  *
  8.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10.  */
  11.  
  12. private["_spawnRadius","_minimumDistanceToTraderZones","_minimumDistanceToTerritories","_lootLifeTime","_buildings","_buildingNetIdsToSpawnLootIn","_building","_lastTimeSentToServer"];
  13. if !(alive player) exitWith {false};
  14. if !((vehicle player) isEqualTo player) exitWith {false};
  15. _spawnRadius = getNumber (missionConfigFile >> "CfgExileLootSettings" >> "spawnRadius");
  16. _minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgExileLootSettings" >> "minimumDistanceToTraderZones");
  17. _minimumDistanceToTerritories = getNumber (missionConfigFile >> "CfgExileLootSettings" >> "minimumDistanceToTerritories");
  18. _lootLifeTime = getNumber (missionConfigFile >> "CfgExileLootSettings" >> "lifeTime") * 60;
  19. //_buildings = player nearObjects ["House", _spawnRadius];
  20. _buildings = player nearObjects ["building", _spawnRadius];
  21. _buildingNetIdsToSpawnLootIn = [];
  22. {
  23.     _building = _x;
  24.     try
  25.     {
  26.         if (isObjectHidden _building) throw false;
  27.         _lastTimeSentToServer = _building getVariable ["ExileLastLootRequestedAt", -99999];
  28.         if ((time - _lastTimeSentToServer) < _lootLifeTime) throw false;
  29.         if (_minimumDistanceToTraderZones > 0) then
  30.         {
  31.             if ([_building, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
  32.             {
  33.                 throw false;
  34.             };
  35.         };
  36.         if (_minimumDistanceToTerritories > 0) then
  37.         {
  38.             if ([_building, _minimumDistanceToTerritories] call ExileClient_util_world_isTerritoryInRange) then
  39.             {
  40.                 throw false;
  41.             };
  42.         };
  43.         _buildingNetIdsToSpawnLootIn pushBack (netId _building);
  44.         _building setVariable ["ExileLastLootRequestedAt", time];
  45.     }
  46.     catch
  47.     {
  48.     };
  49. }
  50. forEach _buildings;
  51. if ((count _buildingNetIdsToSpawnLootIn) > 0) then
  52. {
  53.     ["spawnLootRequest", [_buildingNetIdsToSpawnLootIn]] call ExileClient_system_network_send;
  54. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement