mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add caching for Backblast
This commit is contained in:
parent
8cd8504b3f
commit
9bb9df59ec
@ -14,38 +14,38 @@ class Extended_PostInit_EventHandlers {
|
|||||||
class Extended_FiredBIS_EventHandlers {
|
class Extended_FiredBIS_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHBB);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Tank {
|
class Tank {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Car {
|
class Car {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Helicopter {
|
class Helicopter {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Plane {
|
class Plane {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Ship_F {
|
class Ship_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 5 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class StaticWeapon {
|
class StaticWeapon {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgMagazines' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 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 DFUNC(firedEHOP);};);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -6,5 +6,7 @@ PREP(fireLauncherBackblast);
|
|||||||
PREP(fireOverpressureZone);
|
PREP(fireOverpressureZone);
|
||||||
PREP(getDistance);
|
PREP(getDistance);
|
||||||
PREP(overpressureDamage);
|
PREP(overpressureDamage);
|
||||||
|
PREP(cacheOverPressureValues);
|
||||||
|
PREP(firedEHOP);
|
||||||
|
PREP(firedEHBB);
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Author: joko // Jonas
|
||||||
|
*
|
||||||
|
* Handle fire of local launchers
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Magazine (String)
|
||||||
|
* 1:
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Array:
|
||||||
|
* 0:
|
||||||
|
* 1:
|
||||||
|
* 2:
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_2_PVT(_this,_weapon,_magazine);
|
||||||
|
|
||||||
|
private ["_damage","_angle","_range"];
|
||||||
|
_damage = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(damage));
|
||||||
|
if (_damage == 0) then {
|
||||||
|
_angle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
||||||
|
_range = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
||||||
|
_damage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
||||||
|
} else {
|
||||||
|
_angle = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(angle)) / 2;
|
||||||
|
_range = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(range));
|
||||||
|
};
|
||||||
|
|
||||||
|
missionNameSpace setVariable [(QGVAR(Angle) + _magazine),_angle];
|
||||||
|
missionNameSpace setVariable [(QGVAR(Range) + _magazine),_range];
|
||||||
|
missionNameSpace setVariable [(QGVAR(Damage) + _magazine),_damage];
|
||||||
|
|
||||||
|
[_angle,_range,_damage]
|
@ -15,7 +15,7 @@
|
|||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||||
@ -29,16 +29,9 @@ _position = getPosASL _projectile;
|
|||||||
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
||||||
|
|
||||||
private ["_backblastAngle", "_backblastRange", "_backblastDamage"];
|
private ["_backblastAngle", "_backblastRange", "_backblastDamage"];
|
||||||
_backblastDamage = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(damage));
|
_backblastAngle = missionNameSpace getVariable [(QGVAR(Angle) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 0];
|
||||||
|
_backblastRange = missionNameSpace getVariable [(QGVAR(Range) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 1];
|
||||||
if (_backblastDamage == 0) then {
|
_backblastDamage = missionNameSpace getVariable [(QGVAR(Damage) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 2];
|
||||||
_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
|
||||||
_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
|
||||||
_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
|
||||||
} else {
|
|
||||||
_backblastAngle = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(angle)) / 2;
|
|
||||||
_backblastRange = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(range));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Damage to others
|
// Damage to others
|
||||||
private "_affected";
|
private "_affected";
|
||||||
|
@ -29,24 +29,16 @@ _position = getPosASL _projectile;
|
|||||||
_direction = vectorDir _projectile;
|
_direction = vectorDir _projectile;
|
||||||
|
|
||||||
private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
||||||
|
_dangerZoneDamage = missionNameSpace getVariable [(QGVAR(Damage) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 2];
|
||||||
_dangerZoneDamage = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(damage));
|
_dangerZoneAngle = missionNameSpace getVariable [(QGVAR(Angle) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 0];
|
||||||
|
_dangerZoneRange = missionNameSpace getVariable [(QGVAR(Damage) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 2];
|
||||||
if (_dangerZoneDamage == 0) then {
|
|
||||||
_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
|
||||||
_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
|
||||||
_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
|
||||||
} else {
|
|
||||||
_dangerZoneAngle = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(angle)) / 2;
|
|
||||||
_dangerZoneRange = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(range));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Damage to others
|
// Damage to others
|
||||||
private "_affected";
|
private "_affected";
|
||||||
_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange];
|
_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange];
|
||||||
|
|
||||||
// Let each client handle their own affected units
|
// 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]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
// Draw debug lines
|
// Draw debug lines
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
21
addons/overpressure/functions/fnc_firedEHBB.sqf
Normal file
21
addons/overpressure/functions/fnc_firedEHBB.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Author: joko // Jonas
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (missionNameSpace getVariable [(QGVAR(Damage) + _this select 1),(([_this select 1,_this select 5] call DFUNC(cacheOverPressureVales)) select 2)]) then {
|
||||||
|
_this call DFUNC(fireLauncherBackblast)
|
||||||
|
};
|
21
addons/overpressure/functions/fnc_firedEHOP.sqf
Normal file
21
addons/overpressure/functions/fnc_firedEHOP.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Author: joko // Jonas
|
||||||
|
*
|
||||||
|
* Handle fire of Other Weapons
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (missionNameSpace getVariable [(QGVAR(Damage) + _this select 1),(([_this select 1,_this select 5] call DFUNC(cacheOverPressureVales)) select 2)]) then {
|
||||||
|
_this call DFUNC(fireOverpressureZone)
|
||||||
|
};
|
@ -14,13 +14,12 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon);
|
EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon,_magazine);
|
||||||
|
|
||||||
private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
||||||
|
_overpressureAngle = missionNameSpace getVariable [(QGVAR(Damage) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 2];
|
||||||
_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2;
|
_overpressureRange = missionNameSpace getVariable [(QGVAR(Angle) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 0];
|
||||||
_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range));
|
_overpressureDamage = missionNameSpace getVariable [(QGVAR(Damage) + _magazine),([_weapon,_magazine] call FUNC(cacheOverPressureVales)) select 2];
|
||||||
_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage));
|
|
||||||
|
|
||||||
TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon);
|
TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user