Disable TownGenerator and plant spawner by default

Junk and plant spawning is disabled by default. It can be enabled via
dayz_townGenerator config variable and positions blacklist (for trader
cities, etc.).

The trader objects spawn code was consolidated to functions.
This commit is contained in:
ebaydayz
2016-04-06 19:44:00 -04:00
parent 181c47d2a4
commit 6a42ef40d3
41 changed files with 134 additions and 550 deletions

View File

@@ -89,7 +89,7 @@ sched_townGenerator_ready = {
sched_townGenerator = {
HIDE_FSM_VARS
private ["_character","_position","_y","_velocity","_iy","_i","_j","_jx",
"_index","_cell","_imax","_object","_onFire", "_x"];
"_index","_cell","_imax","_object","_onFire", "_x", "_blocked"];
switch true do {
case (sched_tg_state == 0): { // look for new cells to show and old cells to hide
@@ -159,15 +159,19 @@ sched_townGenerator = {
_x = _cell select _i;
//sched_tg_newSpawned = sched_tg_newSpawned + 1;
if ("" != (_x select 1)) then {
_object = (_x select 1) createVehicleLocal [0,0,0];
_blocked = if (!dayz_townGenerator or {toLower worldName != "chernarus"}) then {true} else {false};
_position = _x select 2;
_object setDir (_x select 3);
_object setPos [_position select 0,_position select 1,0];
_object setPosATL _position;
_object allowDamage false;
//_onFire ...
_object setVariable ["", true]; // SV used by player_spawnCheck, exists if object is local
_x set [ 0, _object ]; // object reference for faster delete
{if (_position distance _x < 150) exitWith {_blocked = true;};} forEach dayz_townGeneratorBlackList;
if (!_blocked) then {
_object = (_x select 1) createVehicleLocal [0,0,0];
_object setDir (_x select 3);
_object setPos [_position select 0,_position select 1,0];
_object setPosATL _position;
_object allowDamage false;
//_onFire ...
_object setVariable ["", true]; // SV used by player_spawnCheck, exists if object is local
_x set [ 0, _object ]; // object reference for faster delete
};
};
};
sched_tg_var2 = _imax;