mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added random destruction of fuel and ammo storage
This commit is contained in:
parent
fa5923378f
commit
b9531b0644
@ -39,6 +39,31 @@
|
|||||||
[QGVAR(unloadedCargoOnKilled), {
|
[QGVAR(unloadedCargoOnKilled), {
|
||||||
params ["_item", "_vehicle"];
|
params ["_item", "_vehicle"];
|
||||||
|
|
||||||
|
// Remove invulernability from this addon
|
||||||
|
[_item, "blockDamage", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
|
// Check if item can take damage
|
||||||
|
if (isDamageAllowed _item) then {
|
||||||
|
// Random chance of destroying fuel and ammo storage
|
||||||
|
if (
|
||||||
|
random 1 < CARGO_DESTROY_FUEL_CHANCE &&
|
||||||
|
{getFuelCargo _item > 0 || {missionNamespace getVariable [QEGVAR(refuel,enabled), false] && {(_item call EFUNC(refuel,getFuel)) > 0}}}
|
||||||
|
) then {
|
||||||
|
_item setDamage 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// If the item has ammunition, detonate it
|
||||||
|
if (["ace_cookoff"] call EFUNC(common,isModLoaded) && {random 1 < CARGO_DESTROY_AMMO_CHANCE} && {(_item call EFUNC(cookoff,getVehicleAmmo)) select 1 > 0}) then {
|
||||||
|
[QEGVAR(cookoff,cookOffBoxServer), _item] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Readd invulnerability for while, so that items aren't destroyed when being thrown
|
||||||
|
[_item, "blockDamage", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
|
// Even though QGVAR(serverUnload) handles that on the server, make sure invulnerability from this addon is removed
|
||||||
|
[EFUNC(common,statusEffect_set), [_item, "blockDamage", QUOTE(ADDON), false], 2] call CBA_fnc_waitAndExecute;
|
||||||
|
};
|
||||||
|
|
||||||
// Get direction from vehicle to item, so that item is thrown away from vehicle
|
// Get direction from vehicle to item, so that item is thrown away from vehicle
|
||||||
private _vectorDir = (getPosWorld _vehicle) vectorFromTo (getPosWorld _item);
|
private _vectorDir = (getPosWorld _vehicle) vectorFromTo (getPosWorld _item);
|
||||||
|
|
||||||
|
@ -20,5 +20,8 @@
|
|||||||
|
|
||||||
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
|
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
|
||||||
|
|
||||||
|
#define CARGO_DESTROY_FUEL_CHANCE 0.5
|
||||||
|
#define CARGO_DESTROY_AMMO_CHANCE 0.8
|
||||||
|
|
||||||
#define CARGO_TUMBLE_RANDOM_MUL 8
|
#define CARGO_TUMBLE_RANDOM_MUL 8
|
||||||
#define CARGO_TUMBLE_TORQUE 500
|
#define CARGO_TUMBLE_TORQUE 500
|
||||||
|
Loading…
Reference in New Issue
Block a user