mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2385 from jokoho48/BackBlastEnhanced
Back blast enhanced
This commit is contained in:
commit
82d9e70c88
@ -14,38 +14,38 @@ class Extended_PostInit_EventHandlers {
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireLauncherBackblast)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};);
|
||||
};
|
||||
};
|
||||
|
||||
class Tank {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
class Car {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
class Helicopter {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
class Plane {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
class Ship_F {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
|
||||
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ class CfgWeapons {
|
||||
|
||||
class LauncherCore;
|
||||
class Launcher: LauncherCore {
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 60;
|
||||
GVAR(range) = 10;
|
||||
GVAR(damage) = 0.7;
|
||||
@ -11,6 +12,7 @@ class CfgWeapons {
|
||||
class Launcher_Base_F: Launcher {};
|
||||
|
||||
class launch_Titan_base: Launcher_Base_F {
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 40;
|
||||
GVAR(range) = 8;
|
||||
GVAR(damage) = 0.5;
|
||||
@ -18,6 +20,7 @@ class CfgWeapons {
|
||||
|
||||
class launch_Titan_short_base: launch_Titan_base {
|
||||
// Titan is a soft-launch launcher
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 30;
|
||||
GVAR(range) = 2;
|
||||
GVAR(damage) = 0.5;
|
||||
@ -25,12 +28,14 @@ class CfgWeapons {
|
||||
|
||||
class launch_NLAW_F: Launcher_Base_F {
|
||||
// NLAW is a soft-launch launcher
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 30;
|
||||
GVAR(range) = 2;
|
||||
GVAR(damage) = 0.6;
|
||||
};
|
||||
|
||||
class launch_RPG32_F: Launcher_Base_F {
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 60;
|
||||
GVAR(range) = 15;
|
||||
GVAR(damage) = 0.7;
|
||||
@ -38,12 +43,14 @@ class CfgWeapons {
|
||||
|
||||
class CannonCore;
|
||||
class cannon_120mm: CannonCore {
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 90;
|
||||
GVAR(range) = 50;
|
||||
GVAR(damage) = 0.85;
|
||||
};
|
||||
|
||||
class mortar_155mm_AMOS: CannonCore {
|
||||
GVAR(priority) = 1;
|
||||
GVAR(angle) = 90;
|
||||
GVAR(range) = 60;
|
||||
GVAR(damage) = 1;
|
||||
|
@ -6,5 +6,7 @@ PREP(fireLauncherBackblast);
|
||||
PREP(fireOverpressureZone);
|
||||
PREP(getDistance);
|
||||
PREP(overpressureDamage);
|
||||
|
||||
PREP(cacheOverPressureValues);
|
||||
PREP(firedEHOP);
|
||||
PREP(firedEHBB);
|
||||
ADDON = true;
|
||||
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Author: joko // Jonas
|
||||
*
|
||||
* Handle fire of local launchers
|
||||
*
|
||||
* Argument:
|
||||
* 0: Weapon <STRING>
|
||||
* 1: Magazine <STRING>
|
||||
* 2: Ammo <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Array:
|
||||
* 0: Angle <Number>
|
||||
* 1: Range <Number>
|
||||
* 2: Damage <Number>
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_weapon", "_ammo", "_magazine"];
|
||||
TRACE_3("Parameter",_weapon,_magazine,_ammo);
|
||||
|
||||
private ["_array", "_type", "_return", "_config" /*, "_priority"*/];
|
||||
|
||||
// get Priority Array from Config
|
||||
_array = [
|
||||
getNumber (configFile >> "CfgWeapons" >> QGVAR(priority)),
|
||||
getNumber (configFile >> "CfgMagazines" >> QGVAR(priority)),
|
||||
getNumber (configFile >> "CfgAmmo" >> QGVAR(priority))
|
||||
];
|
||||
|
||||
TRACE_1("Proiroity Array",_array);
|
||||
|
||||
/* for CBA Upadte 2.1
|
||||
_priority = _array call CBA_fnc_findMax;
|
||||
_type = if (isNil "_priority") then {
|
||||
0
|
||||
} else {
|
||||
_priority select 1
|
||||
};
|
||||
*/
|
||||
|
||||
// obsolete as CBA Update 2.1 start
|
||||
_array params ["_max"];
|
||||
|
||||
// set Default type
|
||||
_type = 0;
|
||||
// get Highest Entry out the the Priority Array
|
||||
{
|
||||
if (_max < _x) then {
|
||||
_max = _x;
|
||||
_type = _forEachIndex;
|
||||
};
|
||||
} forEach _array;
|
||||
// obsolete end
|
||||
|
||||
TRACE_2("Highest Value",_max,_type);
|
||||
// create the Config entry Point
|
||||
_config = [
|
||||
(configFile >> "CfgWeapons" >> _weapon),
|
||||
(configFile >> "CfgMagazines" >> _magazine),
|
||||
(configFile >> "CfgAmmo" >> _ammo)
|
||||
] select _type;
|
||||
TRACE_1("ConfigPath",_config);
|
||||
|
||||
// get the Variables out of the Configes and create a array with then
|
||||
_return = [
|
||||
(getNumber (_config >> QGVAR(angle))),
|
||||
(getNumber (_config >> QGVAR(range))),
|
||||
(getNumber (_config >> QGVAR(damage)))
|
||||
];
|
||||
TRACE_1("Return",_return);
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return];
|
||||
|
||||
_return
|
@ -3,22 +3,22 @@
|
||||
*
|
||||
* Handle fire of local launchers
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that fired (Object)
|
||||
* 1: Weapon fired (String)
|
||||
* 2: Muzzle (String)
|
||||
* 3: Mode (String)
|
||||
* 4: Ammo (String)
|
||||
* 5: Magazine (String)
|
||||
* 6: Projectile (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that fired <OBJECT>
|
||||
* 1: Weapon fired <STRING>
|
||||
* 2: Muzzle <STRING>
|
||||
* 3: Mode <STRING>
|
||||
* 4: Ammo <STRING>
|
||||
* 5: Magazine <STRING>
|
||||
* 6: Projectile <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||
params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
|
||||
|
||||
// Prevent AI from causing backblast damage
|
||||
if !([_firer] call EFUNC(common,isPlayer)) exitWith {};
|
||||
@ -28,11 +28,16 @@ private ["_position", "_direction"];
|
||||
_position = getPosASL _projectile;
|
||||
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
||||
|
||||
private ["_backblastAngle", "_backblastRange", "_backblastDamage"];
|
||||
private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"];
|
||||
// Bake variable name and check if the variable exists, call the caching function otherwise
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
_var = if (isNil _varName) then {
|
||||
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
|
||||
} else {
|
||||
missionNameSpace getVariable _varName;
|
||||
};
|
||||
_var params["_backblastAngle","_backblastRange","_backblastDamage"];
|
||||
|
||||
_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
||||
_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
||||
_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
||||
|
||||
// Damage to others
|
||||
private "_affected";
|
||||
|
@ -3,14 +3,14 @@
|
||||
*
|
||||
* Handle fire of local vehicle weapons creating overpressure zones
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that fired (Object)
|
||||
* 1: Weapon fired (String)
|
||||
* 2: Muzzle (String)
|
||||
* 3: Mode (String)
|
||||
* 4: Ammo (String)
|
||||
* 5: Magazine (String)
|
||||
* 6: Projectile (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that fired <OBJECT>
|
||||
* 1: Weapon fired <STRING>
|
||||
* 2: Muzzle <STRING>
|
||||
* 3: Mode <STRING>
|
||||
* 4: Ammo <STRING>
|
||||
* 5: Magazine <STRING>
|
||||
* 6: Projectile <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
@ -18,8 +18,7 @@
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||
|
||||
params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
|
||||
// Prevent AI from causing overpressure damage
|
||||
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets?
|
||||
|
||||
@ -28,18 +27,23 @@ private ["_position", "_direction"];
|
||||
_position = getPosASL _projectile;
|
||||
_direction = vectorDir _projectile;
|
||||
|
||||
private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
||||
private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
||||
|
||||
_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
||||
_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
||||
_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
||||
// Bake variable name and check if the variable exists, call the caching function otherwise
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
_var = if (isNil _varName) then {
|
||||
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
|
||||
} else {
|
||||
missionNameSpace getVariable _varName;
|
||||
};
|
||||
_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"];
|
||||
|
||||
// Damage to others
|
||||
private "_affected";
|
||||
_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange];
|
||||
|
||||
// Let each client handle their own affected units
|
||||
["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent);
|
||||
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
|
||||
|
||||
// Draw debug lines
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
|
32
addons/overpressure/functions/fnc_firedEHBB.sqf
Normal file
32
addons/overpressure/functions/fnc_firedEHBB.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: joko // Jonas
|
||||
*
|
||||
* Handle fire of local launchers
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that fired <OBJECT>
|
||||
* 1: Weapon fired <STRING>
|
||||
* 2: Muzzle <STRING>
|
||||
* 3: Mode <STRING>
|
||||
* 4: Ammo <STRING>
|
||||
* 5: Magazine <STRING>
|
||||
* 6: Projectile <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_damage","_varName"];
|
||||
params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
|
||||
|
||||
// Bake variable name and check if the variable exists, call the caching function otherwise
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
_damage = if (isNil _varName) then {
|
||||
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
|
||||
} else {
|
||||
(missionNameSpace getVariable _varName) select 2;
|
||||
};
|
||||
|
||||
if (_damage > 0) then {
|
||||
_this call DFUNC(fireLauncherBackblast)
|
||||
};
|
32
addons/overpressure/functions/fnc_firedEHOP.sqf
Normal file
32
addons/overpressure/functions/fnc_firedEHOP.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: joko // Jonas
|
||||
*
|
||||
* Handle fire of Other Weapons
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that fired <OBJECT>
|
||||
* 1: Weapon fired <STRING>
|
||||
* 2: Muzzle <STRING>
|
||||
* 3: Mode <STRING>
|
||||
* 4: Ammo <STRING>
|
||||
* 5: Magazine <STRING>
|
||||
* 6: Projectile <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_damage","_varName"];
|
||||
params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
|
||||
|
||||
// Bake variable name and check if the variable exists, call the caching function otherwise
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
_damage = if (isNil _varName) then {
|
||||
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
|
||||
} else {
|
||||
(missionNameSpace getVariable _varName) select 2;
|
||||
};
|
||||
|
||||
if (_damage > 0) then {
|
||||
_this call DFUNC(fireOverpressureZone)
|
||||
};
|
@ -3,13 +3,13 @@
|
||||
*
|
||||
* Calculate the distance to the first intersection of a line
|
||||
*
|
||||
* Argument:
|
||||
* 0: Pos ASL of origin (Array)
|
||||
* 1: Direction (Array)
|
||||
* 2: Max distance to search (Number)
|
||||
* Arguments:
|
||||
* 0: Pos ASL of origin (ARRAY>
|
||||
* 1: Direction <ARRAY>
|
||||
* 2: Max distance to search <Number>
|
||||
*
|
||||
* Return value:
|
||||
* Distance to intersection (+- 0.1 m)
|
||||
* Distance to intersection (+- 0.1 m) <NUMBER>
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -4,23 +4,29 @@
|
||||
* Calculate and apply backblast damage to potentially affected local units
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that fired (Object)
|
||||
* 1: Pos ASL of the projectile (Array)
|
||||
* 2: Direction of the projectile (Array)
|
||||
* 3: Weapon fired (String)
|
||||
* 0: Unit that fired <OBJECT>
|
||||
* 1: Pos ASL of the projectile <ARRAY>
|
||||
* 2: Direction of the projectile <ARRAY>
|
||||
* 3: Weapon fired <STRING>
|
||||
* 4: Magazine <STRING>
|
||||
* 5: Ammo <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon);
|
||||
private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
||||
params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"];
|
||||
|
||||
private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
||||
|
||||
_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
||||
_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
||||
_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
||||
// Bake variable name and check if the variable exists, call the caching function otherwise
|
||||
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||
_var = if (isNil _varName) then {
|
||||
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
|
||||
} else {
|
||||
missionNameSpace getVariable _varName;
|
||||
};
|
||||
_var params["_overpressureAngle","_overpressureRange","_overpressureDamage"];
|
||||
|
||||
TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon);
|
||||
|
||||
|
@ -9,4 +9,4 @@
|
||||
#define DEBUG_SETTINGS DEBUG_ENABLED_OVERPRESSURE
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user