Advertisement
Guest User

ExileClient_system_lootManager_thread_spawn.sqf

a guest
Oct 18th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 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 = [];
  20. {
  21. _buildings append (player nearObjects [_x, _spawnRadius]);
  22. } forEach ["House","Building","Structure"];
  23.  
  24. _buildingNetIdsToSpawnLootIn = [];
  25. {
  26. _building = _x;
  27. try
  28. {
  29. if (isObjectHidden _building) throw false;
  30. _lastTimeSentToServer = _building getVariable ["ExileLastLootRequestedAt", -99999];
  31. if ((time - _lastTimeSentToServer) < _lootLifeTime) throw false;
  32. if (_minimumDistanceToTraderZones > 0) then
  33. {
  34. if ([_building, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
  35. {
  36. throw false;
  37. };
  38. };
  39. if (_minimumDistanceToTerritories > 0) then
  40. {
  41. if ([_building, _minimumDistanceToTerritories] call ExileClient_util_world_isTerritoryInRange) then
  42. {
  43. throw false;
  44. };
  45. };
  46. _buildingNetIdsToSpawnLootIn pushBack (netId _building);
  47. _building setVariable ["ExileLastLootRequestedAt", time];
  48. }
  49. catch
  50. {
  51. };
  52. }
  53. forEach _buildings;
  54. if ((count _buildingNetIdsToSpawnLootIn) > 0) then
  55. {
  56. ["spawnLootRequest", [_buildingNetIdsToSpawnLootIn]] call ExileClient_system_network_send;
  57. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement