This commit is contained in:
Skaronator
2014-02-11 20:46:43 +01:00
33 changed files with 354 additions and 251 deletions

View File

@@ -1,5 +1,6 @@
[ADDED] BTR90 HQ ride in back option. @Fank
[ADDED] Version check for dayz.pbo. @Skaronator
[ADDED] Updated dayZ Lighting by Axeman disabled by default, uncomment line in init.sqf to enable. @andgregor
[FIXED] Completed trade counter was incorrectly returning output count instead of actual number of trades. @vbawol
[FIXED] Incremental water bottle had a typo in the picture path. fixes: https://github.com/vbawol/DayZ-Epoch/issues/1084 @vbawol

View File

@@ -51,6 +51,7 @@ Developers
--------------------------
Contributors
--------------------------
* Fank - Fixes - https://github.com/Fank
* facoptere - Extra Security - https://github.com/facoptere
* Torndeco - Fixes - https://github.com/Torndeco
* Armifer - Humanity changes. - https://github.com/Armifer

View File

@@ -1,14 +1,13 @@
/*
DayZ Epoch Lighting System - Light Functions
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com or vbawol@veteranbastards.com.
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com.
*/
axe_returnStreetLights={
private["_lights","_objName","_rng","_nrstGen","_rndLights","_sleeptime"];
_rng = _this select 0;
_nrstGen = _this select 1;
_rndLights = _this select 2;
axe_NoStreetLights={//For testing - Need to see brightness of house lights
private["_lights","_rng","_target","_objName"];
_target = _this select 0;
_rng = _this select 1;
_lights = ["a_fuelstation_sign.p3d","lampa_ind_zebr.p3d","lampa_ind.p3d","lampa_sidl_3.p3d","lampa_sidl_2.p3d","lampa_sidl.p3d","powlines_concl.p3d","powlines_woodl.p3d"];
axe_streetLamps=[];
{
if("" != typeOf _x) then {
@@ -18,40 +17,16 @@ axe_streetLamps=[];
_objName = _x call DZE_getModelName;
if (_objName in _lights) then {
if(_rndLights<random 100)then{
if(_rndLights/3>random 100)then{//Reduce chance more due to speed of script
for "_s" from 1 to 8 do {
if(_s%2==0)then{
_x switchlight "off";
}else{
_x switchlight "on";
;
};
_sleeptime=(random 100)/100;
sleep _sleeptime;
};
_x switchlight "off";
//axeDiagLog = format["FN:SL NEW OFF:%1",_x];
//publicVariable "axeDiagLog";
}else{
_x switchlight "on";
//axeDiagLog = format["FN:SL NEW ON:%1",_x];
//publicVariable "axeDiagLog";
};
}else{
_x switchlight "on";
//axeDiagLog = format["FN:SL NEW ON:%1",_x];
//publicVariable "axeDiagLog";
};
[axe_streetLamps , [_x]] call BIS_fnc_arrayPush;
_x switchlight "off";
};
};
};
} foreach nearestObjects [getPos _nrstGen, [], _rng];
axe_streetLamps
} foreach nearestObjects [getPos _target, [], _rng];
};
axe_newLightPoint={
private ["_lp","_pos","_col","_brt","_amb","_pos","_dir","_vect"];
_col = _this select 0;
@@ -60,16 +35,18 @@ _amb = _this select 2;
_pos = _this select 3;
_dir = _this select 4;
_vect = _this select 5;
_lp = "#lightpoint" createVehicleLocal _pos;
_lp = "#lightpoint" createVehicleLocal _pos;//Only create locally now.
_lp setLightColor _col;
_lp setLightBrightness _brt;
_lp setLightAmbient _amb;
_lp setDir _dir;
_lp setVectorUp _vect;
//axeDiagLog = format["FN:LP NEW CREATE:%1",_lp];
//_lp enableSimulation false;//Using this stops lights from illuminating for local player (not tried moving it to before parameters set) - Makes no difference to network broadcast, other players DO NOT see the object anyway
//axeDiagLog = format["FN:LP NEW CREATE:BRIGHT:%3 | %1 for %2",_lp,player,_brt];
//publicVariable "axeDiagLog";
_lp
};
axe_lightPoint={
private ["_lp","_col","_brt","_amb"];
_col = _this select 0;
@@ -82,6 +59,26 @@ _lp setLightAmbient _amb;
//axeDiagLog = format["FN:LP EXISTS LIGHT:%1",_lp];
//publicVariable "axeDiagLog";
};
//return brightness of light attached to object
axe_lightBrightness={
private["_plyr","_brtns","_lightPcnt","_target"];
_plyr = _this select 0;
_target = _this select 1;
if(isNil "dayz_fullMoonNights")then{dayz_fullMoonNights = false;};
if(dayz_fullMoonNights)then{
_brtns = 0.024;
}else{
_brtns = 0.018;
};
_brtns = _brtns + ((_brtns/100) * ((_plyr distance _target)/15)); //Add percentage of brightness based on distance from player
//Min / Max Levels
//if (_brtns > 0.025)then{_brtns = 0.025;};
//if (_brtns < 0.015)then{_brtns = 0.015;};
_brtns
};
axe_towerLight={
private["_twr","_lCol","_lbrt","_lamb","_oset","_twrPos","_rad","_a","_b","_ang","_nrTLs","_doLit"];
_twr = _this select 3 select 0;

View File

@@ -1,102 +1,164 @@
/*
DayZ Epoch Lighting System - House Lights
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com or vbawol@veteranbastards.com.
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com.
*/
private ["_objLightPoint","_pos","_objHouse","_dir","_rng","_lpDist","_nrstTrig","_rndLights","_lmpCol","_hsAnimPer","_brtns","_lightPcnt","_hsLPDist","_hsTime","_hsCount","_litCount","_hsAnimPer2","_chnGCount","_debug"];
_hsCount = 0;
_litCount = 0;
_chnGCount = 0;
//_debug = false;
private ["_validHouses","_animPhase","_maxHouses","_houseNum","_plyr","_objLightPoint","_pos","_objHouse","_dir","_rng","_rngPlyr","_lpRange","_nrstTrig","_lmpCol","_hsAnimPer","_brtns","_lightPcnt","_hsLPDist","_notLitHouses","_areaLit","_litHouses","_hsAnimPhase","_litWindowFound","_currLighting"];
_rng = _this select 0;//player range to light windows
_nrstTrig = _this select 1;
_rndLights = _this select 2;
_lmpCol = _this select 3;
_lpDist = _this select 4;//Range to create lightpoints at
_hsLPDist = 2; //Distance to dettect local lightpoint from house center
_objHouse = nearestObjects [_nrstTrig, ["House"], _rng];
if(!isNil "_objHouse")then{
_hsTime = time;
{
//axeDiagLog = format["HL:ATTEMPT typeof _x:%1 | _x:%2",typeof _x,_x];
//publicVariable "axeDiagLog";
_hsAnimPer = getNumber (configFile >> "CfgVehicles" >> (typeof _x) >> "AnimationSources" >> "Lights_1" >> "animPeriod");
_hsAnimPer2 = getNumber (configFile >> "CfgVehicles" >> (typeof _x) >> "AnimationSources" >> "Lights_2" >> "animPeriod");
//axeDiagLog = format["HL:CONFIG:%1 | Base:%2 | MLight Bright:%3 | MLight Blink:%4 | Alive:%5 | Lights_2:%6",_hsAnimPer,_base,_mLights,_mLightsBlink, alive _x,_hsAnimPer2];
//publicVariable "axeDiagLog";
if(_hsAnimPer>0 && alive _x)then{//Is house with window
_brtns = 0.0025;
_lightPcnt = (player distance _x)/10;
_brtns = _brtns * _lightPcnt;//Light brightness by percentage
//Min / Max Levels
if (_brtns > 0.06)then{_brtns = 0.06;};
if (_brtns < 0.015)then{_brtns = 0.015;};
//test
private["_animPhase2"];
_objLightPoint = nearestObject [_x, "#lightpoint"];
_pos = getPos _x;
_dir = getDir _x;
if(_x getVariable ["axeHLight", 0]<1)then{
if(_rndLights>random 100)then{
_litCount = _litCount +1;
if(_x animationPhase "Lights_1"==0) then{
_x animate ["Lights_1",1];
if(_hsAnimPer2>0)then{
if(42 > random 100) then{_x animate ["Lights_2",1];};//Randomly light second set of windows if house has the option
};
//Wait for animation phase
while{true}do{sleep .1;if (_x animationPhase "Lights_1"==1) exitWith {};};
};
//axeDiagLog = format["HL: animPhase:%1",_x animationPhase "Lights_1"];
//publicVariable "axeDiagLog";
if((_x animationPhase "Lights_1">0))then{
if((abs ([_pos, _objLightPoint] call BIS_fnc_distance2D))>_hsLPDist)then{
if(player distance _x < _lpDist)then{
//if(_debug)then{axeDiagLog = format["HL:NEW LP:%1 | _brtns:%2",_x,_brtns];publicVariable "axeDiagLog";};
//[_lmpCol,0.01,_lmpCol,[_pos select 0,_pos select 1,1],_dir,[0,0,-1]] call axe_newLightPoint;
[_lmpCol,_brtns,_lmpCol,getPos _x,_dir,[0,0,-2.6]] call axe_newLightPoint;
_x setVariable ["brtns", _brtns, false];
_x setVariable ["axeHLight", 1, false];
};
}else{
if(player distance _x < _lpDist)then{
//if(_debug)then{axeDiagLog = format["HL:EXISTS LP:%1 | _brtns:%2",_x,_brtns];publicVariable "axeDiagLog";};
//[_lmpCol,_brtns,_lmpCol,_objLightPoint] call axe_lightPoint;
_objLightPoint setLightColor _lmpCol;
_objLightPoint setLightBrightness _brtns;
_objLightPoint setLightAmbient _lmpCol;
_chnGCount = _chnGCount + 1;
_x setVariable ["brtns", _brtns, false];
_x setVariable ["axeHLight", 1, false];
};
};
//_debug = false;
_rng = _this select 0;//player range to light windows - REDUCE if individual players experience lag (Is client based)
_nrstTrig = _this select 1;
_lightPcnt = _this select 2;
_lmpCol = _this select 3;
_lpRange = round(_rng - ((_rng/100)*16));//Create an outer radius to cleanup lightpoints in
_plyr = _this select 4;
_houseNum = _this select 5;
_hsLPDist = 2; //Distance to detect local lightpoint from house center
_notLitHouses = [];
_litHouses = [];
_areaLit = false;
_litWindowFound = false;
_currLighting = 0;
_validHouses = 0;
_maxHouses = 0;
//Create a routine to reduce range if house amount limit is hit, reduce lag in cities..
//TESTING
//if(_houseNum>200)then{_rng = _rng - (_rng/100)*(_houseNum/10)};//Reduce range by % of housenum. If 600 houses reduce range by 60%, 400 house reduce by 40% etc.. - USAGE: In cities where visible houses are lower
//TESTING
_objHouse = nearestObjects [_nrstTrig, ["House"], _rng];
//axeDiagLog = format["HL:HOUSE NUM:%1 (From Last Run) | Range:%2 | Total House Objs:%3",_houseNum,_rng, count _objHouse];
//publicVariable "axeDiagLog";
_houseNum = count _objHouse;
if(!isNil "_objHouse")then{
{
_animPhase = getNumber(configFile >> "cfgVehicles" >> typeOf _x >> "AnimationSources" >> "Lights_1" >> "animPeriod");
//test
//axeDiagLog = format["HL:House Found: InitPhase: %3 | InPhase2:%4 | Phase:%1 for %2",_x animationPhase "Lights_1", _x,_animPhase,_animPhase2];
//publicVariable "axeDiagLog";
if(_animPhase>0)then{//Only if has a window (Lights_1)
if(_x animationPhase "Lights_1" == 0)then{//If not lit
[_notLitHouses , _x] call BIS_fnc_arrayPush;
}else{//Already Lit - Do your thing.. later
[_litHouses , _x] call BIS_fnc_arrayPush;
_currLighting = _currLighting + 1;
};
_validHouses = _validHouses +1;
};
} forEach _objHouse;
_maxHouses = ((_validHouses/100)*_lightPcnt);
//axeDiagLog = format["HL:START(%5): Max Houses: %1 | Previous Houses: %2 | LIT HOUSES:%3 | Not Lit:%4",_maxHouses, _houseNum,count _litHouses,count _notLitHouses, name player];
//publicVariable "axeDiagLog";
if(count _litHouses < _maxHouses)then{
_currLighting = count _litHouses;
{
if(_currLighting < _maxHouses)then{
if(_lightPcnt > floor (random 100))then{//Randomness required or first nearest houses to player get lit in a block - Needs to be based on range !
//axeDiagLog = format["HL:Lighting New House: %3 Num:%1 Type: %4 for %2 | Dist:%5",_currLighting, name player,_x,typeOf _x,player distance _x];
//publicVariable "axeDiagLog";
//_x enableSimulation false;//Attempt to stop Arma from broadcasting animationphase. DOESN'T WORK - House lights_1 animationphase is still broadcast regardless - Using that as the basis for lights ! Removed as it may stop destruction of building.. (For Now)
_x animate ["Lights_1",1];
//Randomly light second window(s)
if(42 > floor (random 100)) then{
//Only light if available otherwise animate 'attempt' may continue indefinitely..
_animPhase2 = getNumber(configFile >> "cfgVehicles" >> typeOf _x >> "AnimationSources" >> "Lights_2" >> "animPeriod");
if(_animPhase2>0)then{
_x animate ["Lights_2",1];
};
};
}else{//change brightness
if(player distance _x < _lpDist)then{
if((abs ([_pos, _objLightPoint] call BIS_fnc_distance2D))<_hsLPDist)then{
_litCount = _litCount +1;
//if(_debug)then{axeDiagLog = format["HL:EXISTS LP:%1 | _brtns:%2",_x,_brtns];publicVariable "axeDiagLog";};
_chnGCount = _chnGCount + 1;
_x setVariable ["brtns", _brtns, false];
//[_lmpCol,_brtns,_lmpCol,_objLightPoint] call axe_lightPoint;
_objLightPoint setLightColor _lmpCol;
_objLightPoint setLightBrightness _brtns;
_objLightPoint setLightAmbient _lmpCol;
_brtns = [_plyr,_x] call axe_lightBrightness;
while{true}do{sleep .1;if (_x animationPhase "Lights_1"==1) exitWith {};};
//axeDiagLog = format["HL:NEW HOUSE LIT:%1",_x];
//publicVariable "axeDiagLog";
_objLightPoint = nearestObject [_x, "#lightpoint"];
_pos = getPos _x;
_dir = getDir _x;
if(_plyr distance _x < _lpRange)then{//If within create radius
[_lmpCol,_brtns,_lmpCol,getPos _x,_dir,[0,0,-1]] call axe_newLightPoint;
//_x setVariable ["axeHLight", 1, false];
};
}else{
deleteVehicle _objLightPoint;
_x setVariable ["axeHLight", 0, false];
_currLighting=_currLighting+1;
};
};
};
//axeDiagLog = "-------------------------------------------";
_hsCount = _hsCount + 1;
} forEach _objHouse;
if(_debug)then{
//axeDiagLog = format["HL:FINISHED: Time:%1 | Total Houses:%2 | Lit Houses:%3",time - _hsTime,_hsCount,_litCount];
}forEach _notLitHouses;
}else{
//axeDiagLog = format["House Limit Reached(%3): Max:%1 | Count:%2",_maxHouses,count _litHouses,name player];
//publicVariable "axeDiagLog";
};
if(count _litHouses > 0 )then{
{
_objLightPoint = nearestObject [_x, "#lightpoint"];
_pos = getPos _x;
if((abs ([_pos, _objLightPoint] call BIS_fnc_distance2D))<_hsLPDist)then{//In House
if(_plyr distance _x < _lpRange)then{//If within range and outside band
_brtns = [_plyr,_x] call axe_lightBrightness;
_objLightPoint enableSimulation false;//Attempt to stop Arma from broadcasting lightpoint, just reminding it here ! DO NOT USE ! Will stop light from being visible to player (At least upon creation) !
_objLightPoint setLightColor _lmpCol;
_objLightPoint setLightBrightness _brtns;
_objLightPoint setLightAmbient _lmpCol;
//_x setVariable ["axeHLight", 1, false];
//axeDiagLog = format["HL:Resetting brightness (%3) of house %1 for player %2 at %4m distance",_x,player,_brtns,_x distance player];
//publicVariable "axeDiagLog";
}else{//If outside create radius delete light that IS in house
//axeDiagLog = format["HL:Deleteing old light %1 for %2 ",_objLightPoint,name player];
//publicVariable "axeDiagLog";
deleteVehicle _objLightPoint;//Clean up lightpoints as player leaves area.
};
}else{
if(_plyr distance _x < _lpRange)then{//If within create radius recreate lightpoint (after logging)
_brtns = [_plyr,_x] call axe_lightBrightness;
[_lmpCol,_brtns,_lmpCol,getPos _x,_dir,[0,0,-2.6]] call axe_newLightPoint;
//axeDiagLog = format["HL:Recreating light %1 for %2 ",_x,name player];
//publicVariable "axeDiagLog";
};
};
}forEach _litHouses;
};
}else{
_houseNum = 0;
};
//axeDiagLog = format["HL:EXIT: Max Houses%1", _maxHouses];
//publicVariable "axeDiagLog";
_houseNum

View File

@@ -1,109 +1,153 @@
/*
DayZ Epoch Lighting System - Light Init
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com or vbawol@veteranbastards.com.
To Do - Light poles - Automatic lighting for bases (with or without generator) - Menu action to switch off house and tower lights - Add sparks and electrical sound - Add slight randomness to 'reliable' light source - Try and use ASC_EU lights for map based streetlights so they have bulbs and look better - Towers within 20m of 3 house light sources may not always light up - Add Custom (enterable) buildings and items (water pump). Maybe create brighter house lightpoints at further distances to compensate for engine limits.
Wishlist - Detect weather to make lights fail in thunder :)
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com.
*/
private ["_sunrise","_slpTime","_lpRange","_hsRange","_nrGen","_genCount","_rndLightsIn","_rndLightsOut","_genClass","_doHouse","_doTower","_doLight","_fnHr","_stHr","_plyr","_ndGen","_trgRng","_rngPlyr","_lightTrig","_lmpCol"];
//Start / Stop Time
_stHr = _this select 0;
_fnHr = _this select 1;
_doHouse = _this select 2;
_doTower = _this select 3;
_ndGen = _this select 4;
_rndLightsIn = _this select 5;
_trgRng = _this select 6;
_rngPlyr = _this select 7;
_lmpCol = _this select 8;
_genClass = _this select 9;
_slpTime = _this select 10;
_lpRange = _rngPlyr -20;
_doLight = true;
_nrGen = [];
_genCount = 0;
_hsRange = 250;
_lightTrig = vehicle player;//Central point around which to run the lights
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_lightFunctions.sqf";
axeTowerLights = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lights_tower.sqf";
axeHouseLights = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lights_house.sqf";
//axeStreetLights = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lights_street.sqf";
axeDeleteLights = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lights_off.sqf";
waitUntil {getPos Player select 0 > 0};
if(!isDedicated)then{
private ["_plyPos","_sunrise","_slpTime","_lpRange","_hsRange","_nrGen","_genCount","_rndLights","_genClass","_doHouse","_doTower","_doLight","_fnHr","_stHr","_plyr","_ndGen","_trgRng","_rngPlyr","_lightTrig","_lmpCol","_houseNum"];
//Detect Dusk and Dawn
_sunrise = call world_sunRise;
if(_fnHr < 1)then{_fnHr = _sunrise + 0.5;};
if(_stHr < 1)then{_stHr = (24 - _sunrise) - 0.5;};
//Start / Stop Time
_doHouse = true;
_doTower = true;
_noStreetLights = true;
_ndGen = _this select 0;
_rndLights = _this select 1;//Default 12
if(_rndLights<1)exitWith{};//EXIT
_trgRng = 280;//Distance from Gen
_rngPlyr = 480;//Distance from Player
_lmpCol = [0.698, 0.556, 0.419];//Light colour
_genClass = "Generator_DZ";
_slpTime = 6;
_doLight = true;
_nrGen = [];
_genCount = 0;
_hsRange = 250;//set var
_houseNum = 0;//Monitor house numbers in range.. Pass around and reduce range if too many and/or client lag (NOT server / client lag)
_lightTrig = vehicle player;//Central point around which to run the lights
_plyPos = [0,0,0];
call compile preprocessFileLineNumbers "lights\fn_lightFunctions.sqf";
axeTowerLights = compile preprocessFileLineNumbers "lights\local_lights_tower.sqf";
axeHouseLights = compile preprocessFileLineNumbers "lights\local_lights_house.sqf";
//axeDiagLog = format["IL:LIGHTS STARTED: _stHr:%1 | _fnHr:%2 | time:%3 | for:%4",_stHr,_fnHr, dayTime, vehicle player];
//publicVariable "axeDiagLog";
while {alive player}do{
if(daytime<_fnHr||daytime>_stHr)then{
_plyr = vehicle player;
_rndLightsOut = _rndLightsIn;
_nrGen = nearestObjects [_plyr, [_genClass], _rngPlyr];
_genCount = count _nrGen;
//Set Generator to use and Assign trigger object
_lightTrig = _plyr;
if(_genCount>0)then{
{
if(_x getVariable["GeneratorRunning",false])then{
_lightTrig = _x;
};
}forEach _nrGen;
};
if(!_ndGen)then{_lightTrig = _plyr;};
//Nearby Generator ?
if(_ndGen && _genCount<1)then{_doLight = false;}else{_doLight=true;};
//Generator not required !
if(!_ndGen)then{_doLight = true;};
//Choose range, player or generator
if(_ndGen)then{_hsRange = _trgRng;}else{_hsRange = _rngPlyr;};
//100% chance of lights with nearby generator - ToDo, make this slightly lower.
if(_genCount>0&&(_lightTrig getVariable["GeneratorRunning",false]))then{
_rndLightsOut = 100;
};
//Do streetlight stuff
[_trgRng,player,_rndLightsOut] call axe_returnStreetLights;
if(_ndGen && !(_lightTrig getVariable["GeneratorRunning",false]))then{_doLight = false;};//Final check - Not run if nearest gen isn't running
//axeDiagLog = format["IL:RUNNING: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLightsOut:%4",_doLight,_ndGen,_lightTrig,_rndLightsOut];
waitUntil {getPos Player select 0 > 0};
//Detect Dusk and Dawn
_sunrise = call world_sunRise;
_fnHr = _sunrise + 0.5;
_stHr = (24 - _sunrise) - 0.5;
if(_rndLights>75)then{_rndLights=75;};//Max allowed
//axeDiagLog = format["IL:LIGHTS STARTED: _stHr:%1 | _fnHr:%2 | time:%3 | for:%4",_stHr,_fnHr, dayTime, vehicle player];
//publicVariable "axeDiagLog";
while {alive player}do{
if(daytime<_fnHr||daytime>_stHr)then{
_plyr = vehicle player;
//if(_plyPos distance _plyr > 6)then{//Only run if player moves
_lightTrig = _plyr;
if(_doLight)then{
//if(speed _plyr > 0 )then{
if(_doHouse)then{
//axeDiagLog = format["IL:RUNNING HOUSE: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLightsOut:%4",_doLight,_ndGen,_lightTrig,_rndLightsOut];
//publicVariable "axeDiagLog";
[_hsRange,_lightTrig,_rndLightsOut,_lmpCol,_lpRange] call axeHouseLights;
};
//};
if(_doTower)then{
//axeDiagLog = format["IL:RUNNING TOWER: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLightsOut:%4",_doLight,_ndGen,_lightTrig,_rndLightsOut];
//publicVariable "axeDiagLog";
[_rngPlyr,_lightTrig,_rndLightsOut] call axeTowerLights;
if(_ndGen)then{
_nrGen = nearestObjects [_plyr, [_genClass], _rngPlyr];
_genCount = count _nrGen;
//Set Generator to use and Assign trigger object
if(_genCount>0)then{
{
if(_x getVariable["GeneratorRunning",false])exitWith{
_lightTrig = _x;
};
}forEach _nrGen;
};
};
//Decide how and if to turn lights off
if(_ndGen && !(_lightTrig getVariable["GeneratorRunning",false]))then{
[_rngPlyr,_lightTrig,false,_genCount,_lpRange] call axeDeleteLights;
//if(!_ndGen)then{_lightTrig = _plyr;};
//Nearby Generator ?
if(_ndGen && _genCount<1)then{_doLight = false;}else{_doLight=true;};
//Generator not required !
if(!_ndGen)then{_doLight = true;};
//Choose range, player or generator
if(_ndGen)then{_hsRange = _trgRng;}else{_hsRange = _rngPlyr;};
//100% chance of lights with nearby generator - ToDo, make this slightly lower.
if(_ndGen && _genCount>0&&(_lightTrig getVariable["GeneratorRunning",false]))then{
_rndLights = 75;
};
if(_rndLightsOut<random 100)then{
[_rngPlyr,_lightTrig,true,_genCount,_lpRange] call axeDeleteLights;
};
};
sleep _slpTime;
if(_ndGen && !(_lightTrig getVariable["GeneratorRunning",false]))then{_doLight = false;};//Final check - Not run if nearest gen isn't running
//axeDiagLog = format["IL:RUNNING: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLights:%4",_doLight,_ndGen,_lightTrig,_rndLights];
//publicVariable "axeDiagLog";
if(_doLight)then{
//if(speed _plyr > 0 )then{
if(_doHouse)then{
//axeDiagLog = format["IL:RUNNING HOUSE: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLights:%4",_doLight,_ndGen,_lightTrig,_rndLights];
//publicVariable "axeDiagLog";
_houseNum = [_hsRange,_lightTrig,_rndLights,_lmpCol,_plyr,_houseNum] call axeHouseLights;
};
//};
if(_doTower)then{
//axeDiagLog = format["IL:RUNNING TOWER: _doLight:%1 | _ndGen:%2 | _lightTrig:%3 | _rndLights:%4",_doLight,_ndGen,_lightTrig,_rndLights];
//publicVariable "axeDiagLog";
[_rngPlyr,_lightTrig,_rndLights] call axeTowerLights;
};
if(_noStreetLights)then{
[player,_rngPlyr] call axe_NoStreetLights
};
};
//};
_plyPos = getPos player;
};
sleep _slpTime;
};
};
//Attempt a server cleanup - Not detectable..
/*
if(isServer)then{
server_spawnCleanLightpoints = {
private ["_pos","_delQtyLights","_qty","_missonLights","_nearby","_missionObjs"];
if(!isNil "DZE_DYN_cleanLightpoints") exitWith { };
DZE_DYN_cleanLightpoints = true;
_missonLights = entities "#lightpoint";
_missionObjs = allMissionObjects "#lightpoint";
diag_log (format["CLEANUP: Attempting Cleanup of Lights out of %1 or %2",count _missonLights, count _missionObjs]);
_delQtyLights = 0;
{
if (local _x) then {
_x call dayz_perform_purge;
sleep 0.025;
_delQtyLights = _delQtyLights + 1;
} else {
if (!alive _x) then {
_pos = getPosATL _x;
if (count _pos > 0) then {
_nearby = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 420]);//Use calculated range here.
if (_nearby==0) then {
_x call dayz_perform_purge;
sleep 0.025;
_delQtyLights = _delQtyLights + 1;
};
};
};
};
sleep 0.001;
} forEach _missonLights;
if (_delQtyLights > 0) then {
_qty = count _missonLights;
diag_log (format["CLEANUP: Deleted %1 Lights out of %2",_delQtyLights,_qty]);
};
DZE_DYN_cleanLightpoints = nil;
};
while{true}do{
[] spawn server_spawnCleanLightpoints;
sleep 30;
};
};
*/

View File

@@ -1,6 +1,6 @@
/*
DayZ Epoch Lighting System - Illuminant Tower Lights
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com or vbawol@veteranbastards.com.
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com.
*/
private ["_nrTowers","_nrstTrig","_lCol","_lbrt","_lamb","_twrCl"];
_nrstTrig = _this select 1;
@@ -8,12 +8,10 @@ _lCol = [1, 0.88, 0.73];
_lbrt = 0.04;
_lamb = [1, 0.88, 0.73];
_twrCl = "Land_Ind_IlluminantTower";
_nrTowers = nearestObjects [_nrstTrig, [_twrCl], 1000];
_nrTowers = nearestObjects [_nrstTrig, [_twrCl], 600];
if(count _nrTowers >0)then{
{
if((_x getVariable ["axeTLight", 0])<1)then{
//axeDiagLog = format["TL: FOUND:%1",_x];
//publicVariable "axeDiagLog";
[_lCol,_lbrt,_lamb,[_x],[true]] call axe_towerLight;
_x setVariable ["axeTLight", 1, false];
};

Binary file not shown.

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -84,7 +84,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};

View File

@@ -81,7 +81,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -85,7 +85,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -84,7 +84,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -84,7 +84,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -81,7 +81,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -80,7 +80,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -84,7 +84,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -84,7 +84,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -83,7 +83,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -82,7 +82,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather

View File

@@ -80,7 +80,7 @@ if (!isDedicated) then {
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather