mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cookoff - Use triggerAmmo
instead of setDamage
(#10185)
This commit is contained in:
parent
285f903b14
commit
43d42c85cd
@ -91,7 +91,7 @@ private _configMagazine = configFile >> "CfgMagazines" >> _magazineClassname;
|
|||||||
private _ammo = getText (_configMagazine >> "ammo");
|
private _ammo = getText (_configMagazine >> "ammo");
|
||||||
private _configAmmo = configFile >> "CfgAmmo" >> _ammo;
|
private _configAmmo = configFile >> "CfgAmmo" >> _ammo;
|
||||||
|
|
||||||
private _simType = toLower getText (_configAmmo >> "simulation");
|
private _simType = toLowerANSI getText (_configAmmo >> "simulation");
|
||||||
private _speed = linearConversion [0, 1, random 1, 1, 20, true];
|
private _speed = linearConversion [0, 1, random 1, 1, 20, true];
|
||||||
private _effect2pos = _object selectionPosition "destructionEffect2";
|
private _effect2pos = _object selectionPosition "destructionEffect2";
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ private _fnc_spawnProjectile = {
|
|||||||
// If the magazines are inside of the cargo (inventory), don't let their projectiles escape the interior of the vehicle
|
// If the magazines are inside of the cargo (inventory), don't let their projectiles escape the interior of the vehicle
|
||||||
if (!_spawnProjectile) exitWith {};
|
if (!_spawnProjectile) exitWith {};
|
||||||
|
|
||||||
params ["_object", "_ammo", "_speed", "_flyAway"];
|
params ["_flyAway"];
|
||||||
|
|
||||||
private _spawnPos = _object modelToWorld [-0.2 + random 0.4, -0.2 + random 0.4, random 3];
|
private _spawnPos = _object modelToWorld [-0.2 + random 0.4, -0.2 + random 0.4, random 3];
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ private _fnc_spawnProjectile = {
|
|||||||
_projectile setVectorDir _vectorVelocity;
|
_projectile setVectorDir _vectorVelocity;
|
||||||
_projectile setVelocity _vectorVelocity;
|
_projectile setVelocity _vectorVelocity;
|
||||||
} else {
|
} else {
|
||||||
_projectile setDamage 1;
|
triggerAmmo _projectile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,14 +126,14 @@ switch (_simType) do {
|
|||||||
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
if (random 1 < 0.6) then {
|
if (random 1 < 0.6) then {
|
||||||
[_object, _ammo, _speed, true] call _fnc_spawnProjectile;
|
true call _fnc_spawnProjectile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "shotshell": {
|
case "shotshell": {
|
||||||
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
if (random 1 < 0.15) then {
|
if (random 1 < 0.15) then {
|
||||||
[_object, _ammo, _speed, true] call _fnc_spawnProjectile;
|
true call _fnc_spawnProjectile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "shotgrenade": {
|
case "shotgrenade": {
|
||||||
@ -141,7 +141,7 @@ switch (_simType) do {
|
|||||||
_speed = 0;
|
_speed = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
[_object, _ammo, _speed, random 1 < 0.5] call _fnc_spawnProjectile;
|
(random 1 < 0.5) call _fnc_spawnProjectile;
|
||||||
};
|
};
|
||||||
case "shotrocket";
|
case "shotrocket";
|
||||||
case "shotmissile";
|
case "shotmissile";
|
||||||
@ -149,7 +149,7 @@ switch (_simType) do {
|
|||||||
if (random 1 < 0.1) then {
|
if (random 1 < 0.1) then {
|
||||||
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
[_object, _ammo, _speed, random 1 < 0.3] call _fnc_spawnProjectile;
|
(random 1 < 0.3) call _fnc_spawnProjectile;
|
||||||
} else {
|
} else {
|
||||||
createVehicle ["ACE_ammoExplosionLarge", _object modelToWorld _effect2pos, [], 0 , "CAN_COLLIDE"];
|
createVehicle ["ACE_ammoExplosionLarge", _object modelToWorld _effect2pos, [], 0 , "CAN_COLLIDE"];
|
||||||
};
|
};
|
||||||
@ -157,22 +157,13 @@ switch (_simType) do {
|
|||||||
case "shotdirectionalbomb";
|
case "shotdirectionalbomb";
|
||||||
case "shotmine": {
|
case "shotmine": {
|
||||||
if (random 1 < 0.5) then {
|
if (random 1 < 0.5) then {
|
||||||
// Not all explosives detonate on destruction, some have scripted alternatives
|
// _speed should be 0, but as it doesn't fly away, no need to set _speed
|
||||||
if (getNumber (_configAmmo >> "triggerWhenDestroyed") != 1) then {
|
false call _fnc_spawnProjectile;
|
||||||
_ammo = getText (_configAmmo >> QEGVAR(explosives,explosive));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a scripted alternative doesn't exist use generic explosion
|
|
||||||
if (_ammo != "") then {
|
|
||||||
[_object, _ammo, 0, false] call _fnc_spawnProjectile;
|
|
||||||
} else {
|
|
||||||
createVehicle ["SmallSecondary", _object modelToWorld _effect2pos, [], 0 , "CAN_COLLIDE"];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "shotilluminating": {
|
case "shotilluminating": {
|
||||||
if (random 1 < 0.15) then {
|
if (random 1 < 0.15) then {
|
||||||
[_object, _ammo, _speed, random 1 < 0.3] call _fnc_spawnProjectile;
|
(random 1 < 0.3) call _fnc_spawnProjectile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -52,7 +52,7 @@ private _ammo = "";
|
|||||||
_x params ["_magazine", "_count"];
|
_x params ["_magazine", "_count"];
|
||||||
|
|
||||||
if (_count > 0 && {!(_magazine call FUNC(isMagazineFlare))}) then {
|
if (_count > 0 && {!(_magazine call FUNC(isMagazineFlare))}) then {
|
||||||
_ammoToDetonate pushBack [_magazine, _count, false];
|
_ammoToDetonate pushBack [_magazine, _count, random 1 < 0.5];
|
||||||
_totalAmmo = _totalAmmo + _count;
|
_totalAmmo = _totalAmmo + _count;
|
||||||
};
|
};
|
||||||
} forEach (magazinesAmmoCargo _object);
|
} forEach (magazinesAmmoCargo _object);
|
||||||
|
Loading…
Reference in New Issue
Block a user