Should fix BIS_Effect eject/kill

excludes cars now
This commit is contained in:
icomrade
2016-10-19 13:23:44 -04:00
parent 606098a1e3
commit d116bfecb4
2 changed files with 26 additions and 39 deletions

View File

@@ -20,11 +20,27 @@ BIS_Effects_globalEvent = {
BIS_effects_gepv = _this;
publicVariable "BIS_effects_gepv";
_this call BIS_Effects_startEvent;
};
BIS_Effects_startEvent = {
private "_KillEject";
_KillEject = {
private "_cancel";
if (((vehicle player) == (_this select 0)) && {(vehicle player) != player} && {player in (crew (_This select 0))}) then {
_cancel = false;
{
if ((isInTraderCity || !canbuild) && {(player distance (_x select 0)) < (_x select 1)}) then {_cancel = true;};
} count DZE_SafeZonePosArray;
player action ["getOut", (_this select 0)];
if (!_cancel && {!((_this select 0) iskindof "car")}) then {
[player, "explosion"] spawn player_death;
};
};
};
switch (_this select 0) do {
case "AirDestruction": {
[_this select 1] spawn BIS_Effects_AirDestruction;
[_This select 1] call _KillEject;
};
case "AirDestructionStage2": {
[_this select 1, _this select 2, _this select 3] spawn BIS_Effects_AirDestructionStage2;
@@ -32,6 +48,9 @@ BIS_Effects_startEvent = {
case "Burn": {
[_this select 1, _this select 2, _this select 3, false, true] spawn BIS_Effects_Burn;
};
case "Eject": {
[_This select 1] call _KillEject;
};
};
};
"BIS_effects_gepv" addPublicVariableEventHandler {

View File

@@ -1,60 +1,28 @@
private ["_v","_int","_t","_b","_KillEject"];
private ["_v","_int","_t","_b"];
_v=_this select 0;
_KillEject = { //leave as local compile for a tiny bit more security
private ["_cancel","_radius","_SZPos"];
_cancel = false;
{
_SZPos = _x select 0;
_radius = _x select 1;
if ((isInTraderCity || !canbuild) && {(player distance _SZPos) < _radius}) then {_cancel = true;};
} count DZE_SafeZonePosArray;
player action ["getOut",vehicle player]; //eject player so their gear is accessible if dead and they aren't stuck in wreck if alive
if (!_cancel) then {
sleep 0.01; //don't use uisleep here
[player, "explosion"] spawn player_death;
};
};
if (!DZE_NoVehicleExplosions) then {
if (_v iskindof "helicopter" || _v iskindof "plane") then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
//_v setVehicleInit "[this] spawn BIS_Effects_AirDestruction";
//processInitCommands; //ClearvehicleInit done at end of burn script
["AirDestruction", _v] call BIS_Effects_globalEvent;
};
if (_v iskindof "tank") then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
_int = (fuel _v)*(2+random 2);
_t = time;
//_v setVehicleInit format ["[this, %1, %2]spawn BIS_Effects_Burn",_int, _t]; - disabled to prepaire for move into engine
//processInitCommands; //ClearvehicleInit done at end of burn script
[_v,_int] spawn BIS_Effects_Secondaries;
["Eject", _v] call BIS_Effects_globalEvent;
};
if (_v iskindof "car" || _v iskindof "ship")then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
if (_v iskindof "car" || _v iskindof "ship") then {
_int = (fuel _v)*(2 + random 1);
_t = time;
//_v setVehicleInit format ["[this, %1, %2]spawn BIS_Effects_Burn; ",_int, _t]; - disabled to prepaire for move into engine
//processInitCommands; //ClearvehicleInit done at end of burn script
[_v,_int] spawn BIS_Effects_Secondaries;
//Possible initial explosion
["Eject", _v] call BIS_Effects_globalEvent;
if ((random _int)>2.2) then
{
_b = createVehicle ["SmallSecondary", (getPosATL _v), [], 0, "CAN_COLLIDE"];
_b = createVehicle ["SmallSecondary", (getPosATL _v), [], 0, "CAN_COLLIDE"];
};
};
} else {
_isVeh = (_v iskindof "helicopter" || _v iskindof "plane" || _v iskindof "tank" || _v iskindof "car" || _v iskindof "ship");
if (_isVeh) then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
if (_isVeh && {player in (crew _v)}) then {
["Eject", _v] call BIS_Effects_globalEvent;
};
};