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; BIS_effects_gepv = _this;
publicVariable "BIS_effects_gepv"; publicVariable "BIS_effects_gepv";
_this call BIS_Effects_startEvent; _this call BIS_Effects_startEvent;
}; };
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 { switch (_this select 0) do {
case "AirDestruction": { case "AirDestruction": {
[_this select 1] spawn BIS_Effects_AirDestruction; [_this select 1] spawn BIS_Effects_AirDestruction;
[_This select 1] call _KillEject;
}; };
case "AirDestructionStage2": { case "AirDestructionStage2": {
[_this select 1, _this select 2, _this select 3] spawn BIS_Effects_AirDestructionStage2; [_this select 1, _this select 2, _this select 3] spawn BIS_Effects_AirDestructionStage2;
@@ -32,6 +48,9 @@ BIS_Effects_startEvent = {
case "Burn": { case "Burn": {
[_this select 1, _this select 2, _this select 3, false, true] 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;
};
}; };
}; };
"BIS_effects_gepv" addPublicVariableEventHandler { "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; _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 (!DZE_NoVehicleExplosions) then {
if (_v iskindof "helicopter" || _v iskindof "plane") 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; ["AirDestruction", _v] call BIS_Effects_globalEvent;
}; };
if (_v iskindof "tank") then { if (_v iskindof "tank") then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
_int = (fuel _v)*(2+random 2); _int = (fuel _v)*(2+random 2);
_t = time; _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; [_v,_int] spawn BIS_Effects_Secondaries;
["Eject", _v] call BIS_Effects_globalEvent;
}; };
if (_v iskindof "car" || _v iskindof "ship")then { if (_v iskindof "car" || _v iskindof "ship") then {
if (player in (crew _v)) then {
[] spawn _KillEject;
};
_int = (fuel _v)*(2 + random 1); _int = (fuel _v)*(2 + random 1);
_t = time; _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; [_v,_int] spawn BIS_Effects_Secondaries;
["Eject", _v] call BIS_Effects_globalEvent;
//Possible initial explosion
if ((random _int)>2.2) then if ((random _int)>2.2) then
{ {
_b = createVehicle ["SmallSecondary", (getPosATL _v), [], 0, "CAN_COLLIDE"]; _b = createVehicle ["SmallSecondary", (getPosATL _v), [], 0, "CAN_COLLIDE"];
}; };
}; };
} else { } else {
_isVeh = (_v iskindof "helicopter" || _v iskindof "plane" || _v iskindof "tank" || _v iskindof "car" || _v iskindof "ship"); _isVeh = (_v iskindof "helicopter" || _v iskindof "plane" || _v iskindof "tank" || _v iskindof "car" || _v iskindof "ship");
if (_isVeh) then { if (_isVeh && {player in (crew _v)}) then {
if (player in (crew _v)) then { ["Eject", _v] call BIS_Effects_globalEvent;
[] spawn _KillEject;
};
}; };
}; };