From 1bdbda8794ee189148885b37ddf53871d824ad1c Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 2 Sep 2013 20:58:21 +0100 Subject: [PATCH 1/4] Update fn_lightFunctions.sqf Add missing function DZE_getModelName. --- SQF/dayz_code/compile/fn_lightFunctions.sqf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SQF/dayz_code/compile/fn_lightFunctions.sqf b/SQF/dayz_code/compile/fn_lightFunctions.sqf index 0d6e30ccd..5003c997b 100644 --- a/SQF/dayz_code/compile/fn_lightFunctions.sqf +++ b/SQF/dayz_code/compile/fn_lightFunctions.sqf @@ -82,3 +82,20 @@ _nrTLs= position _twr nearObjects ["#lightpoint",30]; }; }; }; +DZE_getModelName = { + _objInfo = toArray(str(_this)); + _lenInfo = count _objInfo - 1; + _objName = []; + _i = 0; + // determine where the object name starts + { + if (58 == _objInfo select _i) exitWith {}; + _i = _i + 1; + } forEach _objInfo; + _i = _i + 2; // skip the ": " part + for "_k" from _i to _lenInfo do { + _objName = _objName + [_objInfo select _k]; + }; + _objName = toLower(toString(_objName)); + _objName +}; From ff0f4ee274b2bdac6410559bfb42fa53ae4111ff Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 2 Sep 2013 23:02:00 +0100 Subject: [PATCH 2/4] Update local_lights_init.sqf Add requirement for a running generator and remove lights if generator is switched off. --- SQF/dayz_code/compile/local_lights_init.sqf | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SQF/dayz_code/compile/local_lights_init.sqf b/SQF/dayz_code/compile/local_lights_init.sqf index 0d14a122f..92f75379e 100644 --- a/SQF/dayz_code/compile/local_lights_init.sqf +++ b/SQF/dayz_code/compile/local_lights_init.sqf @@ -2,7 +2,7 @@ DayZ Epoch Lighting System Made for DayZ Epoch please ask permission to use/edit/distrubute email axeman@thefreezer.co.uk. */ -private ["_nrGen","_i","_doHouse","_doStreet","_doTower","_doAll","_fnHr","_stHr","_plyr","_hndlSLights","_hndlHLights","_hndlTLights","_tmpPlyrPos","_ndGen","_rngGen","_rngPlyr","_arrStreetLights","_rtnLights","_wait","_waitcmd","_trigDist"]; +private ["_nrGen","_i","_doHouse","_doStreet","_doTower","_doAll","_fnHr","_stHr","_plyr","_hndlSLights","_hndlHLights","_hndlTLights","_hndlDelLights","_tmpPlyrPos","_ndGen","_rngGen","_rngPlyr","_arrStreetLights","_rtnLights","_wait","_waitcmd","_trigDist"]; _stHr = 17;//Hour (in 24 hours) to start lights _fnHr = 6;//Hour (in 24 hours) to stop lights @@ -24,6 +24,7 @@ call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_lightFunc 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}; while {alive player} @@ -35,12 +36,11 @@ do _nrGen = nearestObjects [player, ["Generator_DZ"], _rngPlyr]; - if(count _nrGen >0)then{ - }; { - if(_ndGen && (count _nrGen)<1)then{_doAll = false;}else{_doAll=true;}; - if(_doAll)then{ + //if(_ndGen && (count _nrGen)<1)then{_doAll = false;}else{_doAll=true;}; + + if(_x getVariable["GeneratorRunning",false])then{ _rtnLights = [_rngGen,_x] call axe_returnStreetLights; _arrStreetLights = _rtnLights select 0; @@ -62,7 +62,10 @@ do for [{_i=0}, {_i<3}, {_i=_i+1}]do{_waitcmd=_waitcmd+format["%1",_wait select _i];if(_i<2)then{_waitcmd=_waitcmd+"&&";};}; call compile format ["waitUntil {%1}",_waitcmd]; - + }else{ + hint "Lights Off"; + _hndlDelLights = [_rngGen,_x] spawn axeDeleteLights; + waitUntil {scriptDone _hndlDelLights}; }; }forEach _nrGen; From e4408384e02932fba689c157610bc5882ecd6876 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 2 Sep 2013 23:02:42 +0100 Subject: [PATCH 3/4] Create local_lights_off.sqf Add requirement for a running generator and remove lights if generator is switched off. --- SQF/dayz_code/compile/local_lights_off.sqf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 SQF/dayz_code/compile/local_lights_off.sqf diff --git a/SQF/dayz_code/compile/local_lights_off.sqf b/SQF/dayz_code/compile/local_lights_off.sqf new file mode 100644 index 000000000..fb49a4609 --- /dev/null +++ b/SQF/dayz_code/compile/local_lights_off.sqf @@ -0,0 +1,20 @@ +/* + DayZ Epoch Lighting System + Made for DayZ Epoch please ask permission to use/edit/distrubute email axeman@thefreezer.co.uk. +*/ +private ["_objLightPoint","_rng","_nrstGen","_objHouse"]; +_rng = _this select 0; +_rng=_rng+5; +_nrstGen = _this select 1; +_objLightPoint = nearestObject [_nrstGen, "#lightpoint"]; + +while {_nrstGen distance _objLightPoint < _rng} do { +_objLightPoint = nearestObject [_nrstGen, "#lightpoint"]; +deleteVehicle _objLightPoint; +}; + +_objHouse = nearestObjects [_nrstGen, ["House"], _rng]; +{ +_x animate ["Lights_1",0]; +_x animate ["Lights_2",0]; +}forEach _objHouse; From 7f98db133032989eb82e98c2ab9c41874a4487ff Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 2 Sep 2013 23:17:00 +0100 Subject: [PATCH 4/4] Update local_lights_init.sqf Comment out debug player hint. --- SQF/dayz_code/compile/local_lights_init.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/compile/local_lights_init.sqf b/SQF/dayz_code/compile/local_lights_init.sqf index 92f75379e..c3a96ca11 100644 --- a/SQF/dayz_code/compile/local_lights_init.sqf +++ b/SQF/dayz_code/compile/local_lights_init.sqf @@ -63,7 +63,7 @@ do for [{_i=0}, {_i<3}, {_i=_i+1}]do{_waitcmd=_waitcmd+format["%1",_wait select _i];if(_i<2)then{_waitcmd=_waitcmd+"&&";};}; call compile format ["waitUntil {%1}",_waitcmd]; }else{ - hint "Lights Off"; + //hint "Lights Off"; _hndlDelLights = [_rngGen,_x] spawn axeDeleteLights; waitUntil {scriptDone _hndlDelLights}; };