From 12f59f046c86d3743332d5afbe6f32591e61f3e5 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Mon, 20 Feb 2017 18:47:35 -0500 Subject: [PATCH] Update Core Patch BIS_Effects again Updated to same formatting and comments as latest Corepatch files: https://github.com/Goliath86/CorePatch/tree/master/CorePatch_FIS/data/scripts airdestruction.sqf: - fixed _velocity variable was undefined - updated, Sa-Matra removed clearVehicleInit - !isNull checks are not needed because (local objNull) returns false and (speed objNull) returns zero BIS_Effects_startEvent: - 6th parameter is not used in BIS_Effects_Burn, neither in the old nor new version. Although the formatting is ugly, it is better to stay consistent with Bohemia's so they are easy to compare with future updates and scripts.txt exceptions are the same whether the official or custom files are used. Added Sa-Matra's final commit from yesterday: https://github.com/Goliath86/CorePatch/commit/5e696bebdca1777ef45c64323c6ad38a73667ff2 This partially reverts c15caf5. --- CHANGE LOG 1.0.6.1.txt | 1 + SQF/dayz_code/config.cpp | 2 +- .../system/BIS_Effects/airdestruction.sqf | 68 ++++--- .../BIS_Effects/airdestructionstage2.sqf | 169 ++++++++++-------- SQF/dayz_code/system/BIS_Effects/init.sqf | 40 +++-- 5 files changed, 155 insertions(+), 125 deletions(-) diff --git a/CHANGE LOG 1.0.6.1.txt b/CHANGE LOG 1.0.6.1.txt index 49d726afc..c75252d5f 100644 --- a/CHANGE LOG 1.0.6.1.txt +++ b/CHANGE LOG 1.0.6.1.txt @@ -79,6 +79,7 @@ [FIXED] server_PublishVehicle3 will no longer dupe a vehicle if it fails to read the vehicle back from the database. @oiad [FIXED] Panic sounds will no longer overlap when the player is attacked by zombies. #1861 @DeVloek [FIXED] Melee weapons will no longer be eaten when attempting to add them to a full toolbelt. +[FIXED] Updated to Sa-Matra's latest Core Patch BIS Effects which fix the fire in the sky bug again. #1883 @oiad @icomrade [NOTE] The fixes below are included in the 1.0.6 Build C server package released December 29th, 2016 (http://dayzepoch.com/a2dayzepoch.php) [FIXED] Hive child 309 errors that resulted in broken saving of newly built storage object inventory. @icomrade diff --git a/SQF/dayz_code/config.cpp b/SQF/dayz_code/config.cpp index 7fc11e860..f3c5e2d65 100644 --- a/SQF/dayz_code/config.cpp +++ b/SQF/dayz_code/config.cpp @@ -93,7 +93,7 @@ class CfgAddons }; class DefaultEventhandlers { - init = "if (isNil 'BIS_Effects_Init_DZE') then {[] call compile preProcessFileLineNumbers '\z\addons\dayz_code\system\BIS_Effects\init.sqf';};"; + init = "if (isNil 'BIS_Effects_Init_DZ') then {[] call compile preProcessFileLineNumbers '\z\addons\dayz_code\system\BIS_Effects\init.sqf';};"; }; #include "Configs\rscTitles.hpp" diff --git a/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf b/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf index 5ad1b5fea..923aad462 100644 --- a/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf +++ b/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf @@ -1,16 +1,12 @@ -private ["_fl","_sm","_expl","_dr","_velocity","_tv","_i","_wave","_splash","_velz","_v","_int","_t","_pos"]; - -_v =_this select 0; -_int = ((fuel _v) * (8 + (random 2))); -_t = time; -_i = 0; -_dr = 0.2; -_tv = 11; +private ["_fl", "_sm"]; +_v=_this select 0; +_int = (fuel _v)*(8+random 2); +_t=time; // No explosion CorePatch flag _no_explosion = getNumber(configFile >> "CfgVehicles" >> typeOf _v >> "NoDestructionExplosion_CP") > 0; -if (!isDedicated) then { +if !(isDedicated) then { //dw, particle stuff don't need run on dedicated _fl = "#particlesource" createVehicleLocal getpos _v; _fl attachto [_v,[0,0,0],"destructionEffect2"]; _fl setParticleRandom [0.3, [1, 1, 0], [0, 0, 0], 0, 0.3, [0, 0, 0, 0], 0, 0]; @@ -26,9 +22,17 @@ if (!isDedicated) then { [0, 0, 5], 0, 10, 7.9, 0.075, [4,8,12,14], [[0.3, 0.3, 0.3, 1], [0.45, 0.45, 0.45, 1],[0.6, 0.6, 0.6, 0.6], [0.7, 0.7, 0.7, 0.25], [1, 1, 1, 0]], [0.8,0.3,0.25], 1, 0, "", "", _v]; _sm setDropInterval 1; -}; +}; // end of dedicated check + +_i=0; +_dr=0.2; +_tv=11; + + +//Remove weapons/ammo to prevent explosion. Script will create its own explosions (doesnt work?) removeallweapons _v; -if ((local _v) && !_no_explosion) then { + +if (local _v && !_no_explosion) then { // Sa-Matra: Small explosion regardless of where vehicle landed _trig = "EmptyDetector" createVehicleLocal [0,0,0]; _trig setTriggerArea [0,0,0,false]; _trig setVariable ["obj", _v]; @@ -40,8 +44,8 @@ if ((local _v) && !_no_explosion) then { }; while {_i <1200 && ((velocity _v select 2)<-20 || (getpos _v select 2)>8) && !(alive _v) && !(isnull _v) && (getpos _v select 2)>1} do { - if(!isDedicated) then { - _tv = (abs(_velocity select 0) + abs(_velocity select 1) + abs(_velocity select 2)); + if(!isDedicated) then { // particle stuff is not needed on dedicated + _tv=abs(velocity _v select 0)+abs(velocity _v select 1)+abs(velocity _v select 2); if (_tv>2) then {_dr=1/_tv} else {_dr=1}; _fl setDropInterval _dr; _sm setDropInterval _dr; @@ -50,17 +54,15 @@ while {_i <1200 && ((velocity _v select 2)<-20 || (getpos _v select 2)>8) && !(a sleep 0.2; }; -_pos = getpos _v; -clearVehicleInit _v; - -if (!isDedicated) then { +if !(isDedicated) then { //dw, particle stuff don't need run on dedicated deletevehicle _fl; deletevehicle _sm; -}; +}; // end of dedicated check +//if (surfaceiswater(_pos) && (_pos select 2)<9 ) then if((getTerrainHeightASL getPosASL _v < -1) && (getPosASL _v select 2 < 1)) then { - if (!isDedicated) then { - _wave = "#particlesource" createVehicleLocal (getpos _v); + if !(isDedicated) then { //dw, particle stuff don't need run on dedicated + _wave = "#particlesource" createVehicleLocal getpos _v; _wave attachto [_v,[0,0,0],"destructionEffect1"]; _wave setParticleRandom [0.3, [1, 1, 0], [0.5, 0.5, 0], 0, 0.3, [0, 0, 0, 0], 0, 0]; _wave setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 1, 1.6, "destructionEffect1", @@ -69,7 +71,7 @@ if((getTerrainHeightASL getPosASL _v < -1) && (getPosASL _v select 2 < 1)) then _wave setparticlecircle [2,[0,16,0]]; _wave setDropInterval 0.0015; - _splash = "#particlesource" createVehicleLocal (getpos _v); + _splash = "#particlesource" createVehicleLocal getpos _v; _splash attachto [_v,[0,0,0],"destructionEffect1"]; _splash setParticleRandom [2, [2, 2, 0], [2, 2, 7], 0, 0.5, [0, 0, 0, 0], 0, 0]; _splash setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 13, 6, 0], "", "Billboard", 1, 4, "destructionEffect1", @@ -79,13 +81,19 @@ if((getTerrainHeightASL getPosASL _v < -1) && (getPosASL _v select 2 < 1)) then _splash setDropInterval 0.002; sleep 0.2; - deletevehicle _wave;deletevehicle _splash; - }; + + deletevehicle _wave; + deletevehicle _splash; + }; // end of dedicated check } else { - if ((local _v) && {!isNull _v}) then { - _velz = (velocity _v) select 2; - if (_velz > 1) then {_v setvelocity [velocity _v select 0,velocity _v select 1,0]}; - //_expl = createVehicle ["HelicopterExploBig", [_pos select 0,_pos select 1,(_pos select 2) + 1], [], 0, "CAN_COLLIDE"]; + if (local _v) then { + //_velx = velocity _v select 0; _velx = _velx / 4; + //_vely = velocity _v select 1; _vely = _vely / 4; + _velz=velocity _v select 2; + if (_velz>1) then (_v setvelocity [velocity _v select 0,velocity _v select 1,0]); + //_expl="HelicopterExploBig" createvehicle [_pos select 0,_pos select 1,(_pos select 2) + 1]; + + // Sa-Matra: Big explosion only if landed on solid ground if(!_no_explosion) then { _trig = "EmptyDetector" createVehicleLocal [0,0,0]; _trig setTriggerArea [0,0,0,false]; @@ -97,7 +105,9 @@ if((getTerrainHeightASL getPosASL _v < -1) && (getPosASL _v select 2 < 1)) then deleteVehicle thisTrigger; ", "", ""]; }; + sleep 0.05; - ["AirDestructionStage2", _v, _int, _t, (getPos _v)] call BIS_Effects_globalEvent; + + ["AirDestructionStage2", _v, _int, _t] call BIS_Effects_globalEvent; }; -}; +}; \ No newline at end of file diff --git a/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf b/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf index c0b8b4f06..e9d72d170 100644 --- a/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf +++ b/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf @@ -1,95 +1,106 @@ -private ["_dr","_pos","_vel","_xv","_yv","_zv","_dir","_Crater","_speed","_velz","_tv","_smoke","_fire","_dirt","_v","_int","_t"]; + _v = _this select 0; + _int = _this select 1; + _t =_this select 2; + _pos = getpos _v; -_v = _this select 0; -_int = _this select 1; -_t = _this select 2; -_pos = _this select 3; + // No explosion CorePatch flag + _no_explosion = getNumber(configFile >> "CfgVehicles" >> typeOf _v >> "NoDestructionExplosion_CP") > 0; -// No explosion CorePatch flag -_no_explosion = getNumber(configFile >> "CfgVehicles" >> typeOf _v >> "NoDestructionExplosion_CP") > 0; + // Particle effects + private ["_smoke", "_fire", "_dirt"]; -if (!isDedicated) then { - _smoke = "#particlesource" createVehicleLocal _pos; - _smoke attachto [_v,[0,0,0],"destructionEffect1"]; - _smoke setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,7,48], - "", "Billboard", 1, 15, [0, 0, 0], [0, 0, 0], 1, 1.275, 1, 0, [8,14], - [[0.1,0.1,0.1,1],[0.1,0.1,0.1,0]], [0.5], 0.1, 0.1, "", "", _v]; - _smoke setParticleRandom [4, [2, 2, 2], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0]; - _smoke setDropInterval 0.02; - _fire = "#particlesource" createVehicleLocal _pos; - _fire attachto [_v,[0,0,0],"destructionEffect2"]; + if(!isDedicated) then { + _smoke = "#particlesource" createVehicleLocal _pos; + _smoke attachto [_v,[0,0,0],"destructionEffect1"]; + _smoke setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,7,48], + "", "Billboard", 1, 15, [0, 0, 0], [0, 0, 0], 1, 1.275, 1, 0, [8,14], + [[0.1,0.1,0.1,1],[0.1,0.1,0.1,0]], [0.5], 0.1, 0.1, "", "", _v]; + _smoke setParticleRandom [4, [2, 2, 2], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0]; + _smoke setDropInterval 0.02; - _fire setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,2,80], - "", "Billboard", 1, 2, [0, 1, 0], [0, 0, 0], 1, 1.275, 1, 0, [7,13], - [[1,1,1,-1],[1,1,1,0]], [0.5], 0.01, 0.01, "", "", _v,360]; - _fire setParticleRandom [0.5, [0.5, 0.5, 0.5], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0]; - _fire setDropInterval 0.01; - _dirt = "#particlesource" createVehicleLocal _pos; - _dirt attachto [_v,[0,0,0],"destructionEffect1"]; - _dirt setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,12,9,0], "", "Billboard", 1, 5, [0, 0, 0], [0, 0, 5], 0, 5, 1, 0, [10,20], - [[0.1,0.1,0.1,1],[0.1,0.1,0.1,0.7],[0.1,0.1,0.1,0]], [1000], 0, 0, "", "", _v,360]; - _dirt setParticleRandom [0, [1, 1, 1], [1, 1, 2.5], 0, 0, [0, 0, 0, 0.5], 0, 0]; - _dirt setDropInterval 0.05; -}; + _fire = "#particlesource" createVehicleLocal _pos; + _fire attachto [_v,[0,0,0],"destructionEffect2"]; -if(local _v && !_no_explosion) then { - _v spawn { - _index = 0; - _old_pos = [0,0,0]; - _failsafe = diag_tickTime + 30; - waitUntil { - _pos = getPosASL _this; - _pos set [2, _old_pos select 2]; + _fire setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,2,80], + "", "Billboard", 1, 2, [0, 1, 0], [0, 0, 0], 1, 1.275, 1, 0, [7,13], + [[1,1,1,-1],[1,1,1,0]], [0.5], 0.01, 0.01, "", "", _v,360]; + _fire setParticleRandom [0.5, [0.5, 0.5, 0.5], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0]; + _fire setDropInterval 0.01; - if(_old_pos distance _pos > 4 || speed _this <= 0.1) then { - if(getTerrainHeightASL _pos > -1 && getPosATL _this select 2 < 10) then { - _pos set [2, random 0.1 + (_index min 14) / -14]; - if(getTerrainHeightASL _pos < 0) then {_pos = ATLtoASL _pos}; + _dirt = "#particlesource" createVehicleLocal _pos; + _dirt attachto [_v,[0,0,0],"destructionEffect1"]; + _dirt setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,12,9,0], "", "Billboard", 1, 5, [0, 0, 0], [0, 0, 5], 0, 5, 1, 0, [10,20], + [[0.1,0.1,0.1,1],[0.1,0.1,0.1,0.7],[0.1,0.1,0.1,0]], [1000], 0, 0, "", "", _v,360]; + _dirt setParticleRandom [0, [1, 1, 1], [1, 1, 2.5], 0, 0, [0, 0, 0, 0.5], 0, 0]; + _dirt setDropInterval 0.05; + }; - _crater = createVehicle ["CraterLong", _pos, [], 0, "CAN_COLLIDE"]; - _crater setDir ((velocity _this select 0) atan2 (velocity _this select 1) - 5 + random 10 + 180 * (_index % 2)); - _crater setVectorUp surfaceNormal _pos; + // Ground craters + if(local _v && !_no_explosion) then { + _v spawn { + _index = 0; + _old_pos = [0,0,0]; + _failsafe = diag_tickTime + 30; + waitUntil { + _pos = getPosASL _this; + _pos set [2, _old_pos select 2]; - _old_pos = _pos; - _index = _index + 1; + if(_old_pos distance _pos > 4 || speed _this <= 0.1) then { + if(getTerrainHeightASL _pos > -1 && getPosATL _this select 2 < 10) then { + _pos set [2, random 0.1 + (_index min 14) / -14]; + if(getTerrainHeightASL _pos < 0) then {_pos = ATLtoASL _pos}; + + _crater = createVehicle ["CraterLong", _pos, [], 0, "CAN_COLLIDE"]; + _crater setDir ((velocity _this select 0) atan2 (velocity _this select 1) - 5 + random 10 + 180 * (_index % 2)); + _crater setVectorUp surfaceNormal _pos; + + _old_pos = _pos; + _index = _index + 1; + }; }; + + speed _this <= 0.1 || diag_tickTime > _failsafe; }; - speed _this <= 0.1 || diag_tickTime > _failsafe; }; }; -}; -while {(speed _v) > 0.1 && (!isNull _v)} do -{ - if (!isDedicated) then { - _pos = getpos _v; - _vel = velocity _v; - _xv =_vel select 0; - _yv = _vel select 1; - _zv = _vel select 2; - _dir = abs(_xv atan2 _yv); - _speed = (speed _v); - _tv = (abs(_xv) + abs(_yv) + abs(_zv)); - if (_tv > 2) then {_dr = (1/_tv)} else {_dr = 1}; - _smoke setDropInterval (_dr * 1.5); - _fire setDropInterval (_dr * 1.5); - _dirt setDropInterval _dr; - sleep (0.25 - (_speed / 1000)); + + // Ground particles + _i = 0; + while {(speed _v) > 0.1} do + { + if(!isDedicated) then { + _pos = getpos _v; + _xv = velocity _v select 0; + _yv = velocity _v select 1; + _dir = abs(_xv atan2 _yv); + + _speed = (speed _v); + _zv = velocity _v select 2; + + _tv = abs(_xv)+abs(_yv)+abs(_zv); + _dr = 1; + if (_tv>2) then {_dr = 1/_tv}; + _smoke setDropInterval _dr*1.5; + _fire setDropInterval _dr*1.5; + _dirt setDropInterval _dr; + + sleep (0.25 - (_speed / 1000)); + }; }; -}; -if (!isDedicated) then { - deleteVehicle _smoke; - deleteVehicle _fire; - deleteVehicle _dirt; - -}; - -_v setvelocity [0,0,-0.01]; - -if ((local _v) && (!isNull _v)) then { - ["Burn", _v, _int, _t] call BIS_Effects_globalEvent; - if (!_no_explosion) then { - [_v,_int,false] spawn BIS_Effects_Secondaries; + if(!isDedicated) then { + deleteVehicle _smoke; + deleteVehicle _fire; + deleteVehicle _dirt; }; -}; + _v setvelocity [0,0,-0.01]; + + if (local _v) then { + ["Burn", _v, _int, _t] call BIS_Effects_globalEvent; + if(!_no_explosion) then { + [_v,_int,false] spawn BIS_Effects_Secondaries; + }; + }; + + sleep 0.5; \ No newline at end of file diff --git a/SQF/dayz_code/system/BIS_Effects/init.sqf b/SQF/dayz_code/system/BIS_Effects/init.sqf index 5dbe0c53e..fa43146d0 100644 --- a/SQF/dayz_code/system/BIS_Effects/init.sqf +++ b/SQF/dayz_code/system/BIS_Effects/init.sqf @@ -1,10 +1,11 @@ BIS_Effects_Init = true; Corepatch_Effects_Init = true; -if (isNil "BIS_Effects_Init_DZE") then { - BIS_Effects_Init_DZE = true; +if (isNil "BIS_Effects_Init_DZ") then { + BIS_Effects_Init_DZ = true; diag_log "Res3tting B!S effects..."; BIS_Effects_EH_Fired=compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\fired.sqf"; // Allows tanks to use smoke counter measures BIS_Effects_EH_Killed = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\killed.sqf"; + BIS_Effects_Rifle = {false}; BIS_Effects_Cannon=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\cannon.sqf"; BIS_Effects_HeavyCaliber=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\heavycaliber.sqf"; @@ -13,18 +14,27 @@ if (isNil "BIS_Effects_Init_DZE") then { BIS_Effects_SmokeShell=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\smokeshell.sqf"; BIS_Effects_SmokeLauncher=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\smokelauncher.sqf"; BIS_Effects_Flares=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\flares.sqf"; + + //must use spawn command for these: BIS_Effects_Burn=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf"; BIS_Effects_AircraftVapour=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\misc\aircraftvapour.sqf"; BIS_Effects_AirDestruction = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\AirDestruction.sqf"; BIS_Effects_AirDestructionStage2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\AirDestructionStage2.sqf"; BIS_Effects_Secondaries = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\secondaries.sqf"; - BIS_Effects_globalEvent = { + //BIS_Effects_RocketTrail=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\rockettrail.sqf"; + + /////////////////Dwarden fixing fire in the sky bug + + BIS_Effects_globalEvent = + { BIS_effects_gepv = _this; publicVariable "BIS_effects_gepv"; _this call BIS_Effects_startEvent; }; - BIS_Effects_startEvent = { + + BIS_Effects_startEvent = + { private "_KillEject"; _KillEject = { private "_cancel"; @@ -42,27 +52,25 @@ if (isNil "BIS_Effects_Init_DZE") then { switch (_this select 0) do { case "AirDestruction": { [_this select 1] spawn BIS_Effects_AirDestruction; - [_This select 1] call _KillEject; + [_this select 1] call _KillEject; }; case "AirDestructionStage2": { - [_this select 1, _this select 2, _this select 3, _this select 4] spawn BIS_Effects_AirDestructionStage2; + [_this select 1, _this select 2, _this select 3] spawn BIS_Effects_AirDestructionStage2; }; case "Burn": { - [_this select 1, _this select 2, _this select 3, false, true, _this select 4] spawn BIS_Effects_Burn; + [_this select 1, _this select 2, _this select 3, false, true] spawn BIS_Effects_Burn; }; case "Eject": { - [_This select 1] call _KillEject; + [_this select 1] call _KillEject; }; }; }; + "BIS_effects_gepv" addPublicVariableEventHandler { - if(time <= 0) then { - (_this select 1) spawn { //Fire in the sky bug fix - waitUntil {time > 0}; - _this call BIS_Effects_startEvent; - }; - } else { - (_this select 1) call BIS_Effects_startEvent; - }; + if(time <= 0) exitWith {(_this select 1) spawn { //Fire in the sky bug fix + waitUntil {sleep 1; !isNull findDisplay 46}; // Display 46 is indication that client finished loading + _this call BIS_Effects_startEvent; + }}; + (_this select 1) call BIS_Effects_startEvent; }; };