diff --git a/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf b/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf index 813622b89..5ad1b5fea 100644 --- a/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf +++ b/SQF/dayz_code/system/BIS_Effects/airdestruction.sqf @@ -7,8 +7,11 @@ _i = 0; _dr = 0.2; _tv = 11; +// No explosion CorePatch flag +_no_explosion = getNumber(configFile >> "CfgVehicles" >> typeOf _v >> "NoDestructionExplosion_CP") > 0; + if (!isDedicated) then { - _fl = "#particlesource" createVehicleLocal getPosATL _v; + _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]; _fl setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard", 1, 2, "destructionEffect2", @@ -16,7 +19,7 @@ if (!isDedicated) then { [1, 1, 1, -1], [1, 1, 1, -0.5], [1, 1, 1, -0]], [1,0.5], 1, 0, "", "", _v]; _fl setDropInterval 1; - _sm = "#particlesource" createVehicleLocal getPosATL _v; + _sm = "#particlesource" createVehicleLocal getpos _v; _sm attachto [_v,[0,0,0],"destructionEffect1"]; _sm setParticleRandom [2, [2, 2, 0], [0, 0, 0], 0, 0.3, [0, 0, 0, 0.1], 0, 0]; _sm setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 5, "destructionEffect1", @@ -24,24 +27,30 @@ if (!isDedicated) then { [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; }; - removeallweapons _v; -if (local _v) then {_expl = createVehicle ["HelicopterExploSmall", (getPosATL _v), [], 0, "CAN_COLLIDE"];}; - -if (!isDedicated) then { - while {(_i < 1200) && ((((velocity _v) select 2) < -20) || (((getPosATL _v) select 2) > 8)) && !(alive _v) && !(isnull _v) && (((getPosATL _v) select 2) > 1)} do - { - _velocity = velocity _v; - _tv = (abs(_velocity select 0) + abs(_velocity select 1) + abs(_velocity select 2)); - if (_tv > 2) then {_dr = (1/_tv)} else {_dr = 1}; - _fl setDropInterval _dr; - _sm setDropInterval _dr; - _i = _i + 1; - sleep 0.2; - }; +if ((local _v) && !_no_explosion) then { + _trig = "EmptyDetector" createVehicleLocal [0,0,0]; + _trig setTriggerArea [0,0,0,false]; + _trig setVariable ["obj", _v]; + _trig setTriggerStatements [" + _v = thisTrigger getVariable [""obj"", objNull]; + createVehicle [""HelicopterExploSmall"", getPos _v, [], 0, ""CAN_COLLIDE""] setPosATL getPosATL _v; + deleteVehicle thisTrigger; + ", "", ""]; }; -_pos = getPosATL _v; +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 (_tv>2) then {_dr=1/_tv} else {_dr=1}; + _fl setDropInterval _dr; + _sm setDropInterval _dr; + }; + _i=_i+1; + sleep 0.2; +}; + +_pos = getpos _v; clearVehicleInit _v; if (!isDedicated) then { @@ -49,9 +58,9 @@ if (!isDedicated) then { deletevehicle _sm; }; -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 (getPosATL _v); + _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", @@ -60,7 +69,7 @@ if (surfaceiswater(_pos) && {(_pos select 2 ) < 9} ) then { _wave setparticlecircle [2,[0,16,0]]; _wave setDropInterval 0.0015; - _splash = "#particlesource" createVehicleLocal (getPosATL _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", @@ -76,8 +85,19 @@ if (surfaceiswater(_pos) && {(_pos select 2 ) < 9} ) then { 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"]; + //_expl = createVehicle ["HelicopterExploBig", [_pos select 0,_pos select 1,(_pos select 2) + 1], [], 0, "CAN_COLLIDE"]; + if(!_no_explosion) then { + _trig = "EmptyDetector" createVehicleLocal [0,0,0]; + _trig setTriggerArea [0,0,0,false]; + _trig setVariable ["obj", _v]; + _trig setTriggerStatements [" + _v = thisTrigger getVariable [""obj"", objNull]; + _atl = getPosATL _v; _atl set [2, (_atl select 2) + 1]; + createVehicle [""HelicopterExploBig"", getPos _v, [], 0, ""CAN_COLLIDE""] setPosATL _atl; + deleteVehicle thisTrigger; + ", "", ""]; + }; sleep 0.05; - ["AirDestructionStage2", _v, _int, _t, (getPosATL _v)] call BIS_Effects_globalEvent; + ["AirDestructionStage2", _v, _int, _t, (getPos _v)] call BIS_Effects_globalEvent; }; }; diff --git a/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf b/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf index ee5ae8a68..c0b8b4f06 100644 --- a/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf +++ b/SQF/dayz_code/system/BIS_Effects/airdestructionstage2.sqf @@ -1,10 +1,13 @@ -private ["_dr","_pos","_vel","_xv","_yv","_zv","_dir","_Crater","_speed","_velz","_tv","_i","_smoke","_fire","_dirt","_v","_int","_t"]; +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 = _this select 3; +// No explosion CorePatch flag +_no_explosion = getNumber(configFile >> "CfgVehicles" >> typeOf _v >> "NoDestructionExplosion_CP") > 0; + if (!isDedicated) then { _smoke = "#particlesource" createVehicleLocal _pos; _smoke attachto [_v,[0,0,0],"destructionEffect1"]; @@ -27,45 +30,66 @@ if (!isDedicated) then { [[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; +}; - _i = 0; - while {(speed _v) > 0.1 && (!isNull _v)} do - { - _pos = getPosATL _v; - _vel = velocity _v; - _xv =_vel select 0; - _yv = _vel select 1; - _zv = _vel select 2; - _dir = abs(_xv atan2 _yv); - _Crater= "CraterLong" createvehiclelocal [_pos select 0, _pos select 1, 0]; - _Crater setdir (_dir + (180 * _i)); - _Crater setpos [_pos select 0, _pos select 1, 0]; - _Crater setPos [_pos select 0, _pos select 1, ((0 - _i)/13)]; - _speed = (speed _v); - _velz = _vel select 2; - if (_velz > 1) then {_v setvelocity [(_xv/1.3),(_yv/1.3),0]} - else {_v setvelocity [(_xv/1.2),(_yv/1.2),(velocity _v) select 2]}; - _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)); - _i = _i + 1; +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]; + + 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; }; + }; +}; +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)); + }; +}; +if (!isDedicated) then { deleteVehicle _smoke; deleteVehicle _fire; deleteVehicle _dirt; }; -_v setvelocity [0,0,-0.1]; +_v setvelocity [0,0,-0.01]; -if (local _v && (!isNull _v)) then { +if ((local _v) && (!isNull _v)) then { ["Burn", _v, _int, _t] call BIS_Effects_globalEvent; - [_v,_int,false] spawn BIS_Effects_Secondaries; + if (!_no_explosion) then { + [_v,_int,false] spawn BIS_Effects_Secondaries; + }; }; -sleep 0.5; -_v setvelocity [0,0,-0.01]; \ 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 79ef6e499..5dbe0c53e 100644 --- a/SQF/dayz_code/system/BIS_Effects/init.sqf +++ b/SQF/dayz_code/system/BIS_Effects/init.sqf @@ -1,5 +1,5 @@ BIS_Effects_Init = true; - +Corepatch_Effects_Init = true; if (isNil "BIS_Effects_Init_DZE") then { BIS_Effects_Init_DZE = true; diag_log "Res3tting B!S effects..."; @@ -56,6 +56,13 @@ if (isNil "BIS_Effects_Init_DZE") then { }; }; "BIS_effects_gepv" addPublicVariableEventHandler { - (_this select 1) call BIS_Effects_startEvent; + 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; + }; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/system/BIS_Effects/killed.sqf b/SQF/dayz_code/system/BIS_Effects/killed.sqf index 1b3f9fb3d..d87fcc24a 100644 --- a/SQF/dayz_code/system/BIS_Effects/killed.sqf +++ b/SQF/dayz_code/system/BIS_Effects/killed.sqf @@ -17,7 +17,7 @@ if (!DZE_NoVehicleExplosions) then { ["Eject", _v] call BIS_Effects_globalEvent; if ((random _int)>2.2) then { - _b = createVehicle ["SmallSecondary", (getPosATL _v), [], 0, "CAN_COLLIDE"]; + _b = "SmallSecondary" createvehicle (getpos _v); }; }; } else {