mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
rewrite Caching in overpressure
update code to params command update Comments
This commit is contained in:
parent
41edf3dd38
commit
35b6e04345
@ -3,6 +3,7 @@ class CfgWeapons {
|
|||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
class Launcher: LauncherCore {
|
class Launcher: LauncherCore {
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 60;
|
GVAR(angle) = 60;
|
||||||
GVAR(range) = 10;
|
GVAR(range) = 10;
|
||||||
GVAR(damage) = 0.7;
|
GVAR(damage) = 0.7;
|
||||||
@ -11,6 +12,7 @@ class CfgWeapons {
|
|||||||
class Launcher_Base_F: Launcher {};
|
class Launcher_Base_F: Launcher {};
|
||||||
|
|
||||||
class launch_Titan_base: Launcher_Base_F {
|
class launch_Titan_base: Launcher_Base_F {
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 40;
|
GVAR(angle) = 40;
|
||||||
GVAR(range) = 8;
|
GVAR(range) = 8;
|
||||||
GVAR(damage) = 0.5;
|
GVAR(damage) = 0.5;
|
||||||
@ -18,6 +20,7 @@ class CfgWeapons {
|
|||||||
|
|
||||||
class launch_Titan_short_base: launch_Titan_base {
|
class launch_Titan_short_base: launch_Titan_base {
|
||||||
// Titan is a soft-launch launcher
|
// Titan is a soft-launch launcher
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 30;
|
GVAR(angle) = 30;
|
||||||
GVAR(range) = 2;
|
GVAR(range) = 2;
|
||||||
GVAR(damage) = 0.5;
|
GVAR(damage) = 0.5;
|
||||||
@ -25,12 +28,14 @@ class CfgWeapons {
|
|||||||
|
|
||||||
class launch_NLAW_F: Launcher_Base_F {
|
class launch_NLAW_F: Launcher_Base_F {
|
||||||
// NLAW is a soft-launch launcher
|
// NLAW is a soft-launch launcher
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 30;
|
GVAR(angle) = 30;
|
||||||
GVAR(range) = 2;
|
GVAR(range) = 2;
|
||||||
GVAR(damage) = 0.6;
|
GVAR(damage) = 0.6;
|
||||||
};
|
};
|
||||||
|
|
||||||
class launch_RPG32_F: Launcher_Base_F {
|
class launch_RPG32_F: Launcher_Base_F {
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 60;
|
GVAR(angle) = 60;
|
||||||
GVAR(range) = 15;
|
GVAR(range) = 15;
|
||||||
GVAR(damage) = 0.7;
|
GVAR(damage) = 0.7;
|
||||||
@ -38,12 +43,14 @@ class CfgWeapons {
|
|||||||
|
|
||||||
class CannonCore;
|
class CannonCore;
|
||||||
class cannon_120mm: CannonCore {
|
class cannon_120mm: CannonCore {
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 90;
|
GVAR(angle) = 90;
|
||||||
GVAR(range) = 50;
|
GVAR(range) = 50;
|
||||||
GVAR(damage) = 0.85;
|
GVAR(damage) = 0.85;
|
||||||
};
|
};
|
||||||
|
|
||||||
class mortar_155mm_AMOS: CannonCore {
|
class mortar_155mm_AMOS: CannonCore {
|
||||||
|
GVAR(priority) = 1;
|
||||||
GVAR(angle) = 90;
|
GVAR(angle) = 90;
|
||||||
GVAR(range) = 60;
|
GVAR(range) = 60;
|
||||||
GVAR(damage) = 1;
|
GVAR(damage) = 1;
|
||||||
|
@ -4,30 +4,57 @@
|
|||||||
* Handle fire of local launchers
|
* Handle fire of local launchers
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Magazine (String)
|
* 0: Weapon <STRING>
|
||||||
* 1:
|
* 1: Magazine <STRING>
|
||||||
|
* 2: Ammo <STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Array:
|
* Array:
|
||||||
* 0:
|
* 0: Angle <Number>
|
||||||
* 1:
|
* 1: Range <Number>
|
||||||
* 2:
|
* 2: Damage <Number>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_2_PVT(_this,_weapon,_magazine);
|
params ["_weapon", "_magazine", "_ammo"];
|
||||||
if !(isNil (QGVAR(Damage) + _magazine)) exitWith {};
|
|
||||||
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(values) + _magazine),[_angle, _range,_damage]];
|
private ["_array", "_type", "_return", "_config"];
|
||||||
[_angle,_range,_damage]
|
|
||||||
|
// get Priority Array from Config
|
||||||
|
_array = [
|
||||||
|
getNumber (configFile >> "CfgWeapons" >> QGVAR(priority)),
|
||||||
|
getNumber (configFile >> "CfgMagazines" >> QGVAR(priority)),
|
||||||
|
getNumber (configFile >> "CfgAmmo" >> QGVAR(priority))
|
||||||
|
];
|
||||||
|
|
||||||
|
// define Fist Values for Types
|
||||||
|
_type = 0;
|
||||||
|
_array params ["_max"];
|
||||||
|
|
||||||
|
// get Highest Entry out the the Priority Array
|
||||||
|
{
|
||||||
|
if (_max < _x) then {
|
||||||
|
_max = _x;
|
||||||
|
_type = _forEachIndex;
|
||||||
|
};
|
||||||
|
} forEach _array;
|
||||||
|
|
||||||
|
// create the Config entry Point
|
||||||
|
[
|
||||||
|
(configFile >> "CfgWeapons" >> _weapon),
|
||||||
|
(configFile >> "CfgMagazines" >> _magazine),
|
||||||
|
(configFile >> "CfgMagazines" >> _ammo)
|
||||||
|
] select _type;
|
||||||
|
|
||||||
|
// 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)))
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return];
|
||||||
|
|
||||||
|
_return
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
*
|
*
|
||||||
* Handle fire of local launchers
|
* Handle fire of local launchers
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit that fired (Object)
|
* 0: Unit that fired <OBJECT>
|
||||||
* 1: Weapon fired (String)
|
* 1: Weapon fired <STRING>
|
||||||
* 2: Muzzle (String)
|
* 2: Muzzle <STRING>
|
||||||
* 3: Mode (String)
|
* 3: Mode <STRING>
|
||||||
* 4: Ammo (String)
|
* 4: Ammo <STRING>
|
||||||
* 5: Magazine (String)
|
* 5: Magazine <STRING>
|
||||||
* 6: Projectile (Object)
|
* 6: Projectile <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#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
|
// Prevent AI from causing backblast damage
|
||||||
if !([_firer] call EFUNC(common,isPlayer)) exitWith {};
|
if !([_firer] call EFUNC(common,isPlayer)) exitWith {};
|
||||||
@ -29,7 +29,7 @@ _position = getPosASL _projectile;
|
|||||||
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
||||||
|
|
||||||
private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"];
|
private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"];
|
||||||
_varName = (QGVAR(values) + _magazine);
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||||
_var = if (isNil _varName) then {
|
_var = if (isNil _varName) then {
|
||||||
[_weapon,_magazine] call FUNC(cacheOverPressureVales);
|
[_weapon,_magazine] call FUNC(cacheOverPressureVales);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
*
|
*
|
||||||
* Handle fire of local vehicle weapons creating overpressure zones
|
* Handle fire of local vehicle weapons creating overpressure zones
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit that fired (Object)
|
* 0: Unit that fired <OBJECT>
|
||||||
* 1: Weapon fired (String)
|
* 1: Weapon fired <STRING>
|
||||||
* 2: Muzzle (String)
|
* 2: Muzzle <STRING>
|
||||||
* 3: Mode (String)
|
* 3: Mode <STRING>
|
||||||
* 4: Ammo (String)
|
* 4: Ammo <STRING>
|
||||||
* 5: Magazine (String)
|
* 5: Magazine <STRING>
|
||||||
* 6: Projectile (Object)
|
* 6: Projectile <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
@ -18,8 +18,7 @@
|
|||||||
//#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#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
|
// Prevent AI from causing overpressure damage
|
||||||
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets?
|
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets?
|
||||||
|
|
||||||
@ -28,10 +27,12 @@ private ["_position", "_direction"];
|
|||||||
_position = getPosASL _projectile;
|
_position = getPosASL _projectile;
|
||||||
_direction = vectorDir _projectile;
|
_direction = vectorDir _projectile;
|
||||||
|
|
||||||
private ["_var","_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
||||||
_varName = (QGVAR(values) + _magazine);
|
|
||||||
|
// Bake Variablen Name and Check if the Variable Exist else call the Cache Function
|
||||||
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||||
_var = if (isNil _varName) then {
|
_var = if (isNil _varName) then {
|
||||||
[_weapon,_magazine] call FUNC(cacheOverPressureVales);
|
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureVales);
|
||||||
} else {
|
} else {
|
||||||
missionNameSpace getVariable _varName;
|
missionNameSpace getVariable _varName;
|
||||||
};
|
};
|
||||||
@ -42,7 +43,7 @@ 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,_magazine]] call EFUNC(common,targetEvent);
|
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
// Draw debug lines
|
// Draw debug lines
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
@ -3,25 +3,29 @@
|
|||||||
*
|
*
|
||||||
* Handle fire of local launchers
|
* Handle fire of local launchers
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit that fired (Object)
|
* 0: Unit that fired <OBJECT>
|
||||||
* 1: Weapon fired (String)
|
* 1: Weapon fired <STRING>
|
||||||
* 2: Muzzle (String)
|
* 2: Muzzle <STRING>
|
||||||
* 3: Mode (String)
|
* 3: Mode <STRING>
|
||||||
* 4: Ammo (String)
|
* 4: Ammo <STRING>
|
||||||
* 5: Magazine (String)
|
* 5: Magazine <STRING>
|
||||||
* 6: Projectile (Object)
|
* 6: Projectile <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
private ["_var","_varName"];
|
private ["_var","_varName"];
|
||||||
_varName = (QGVAR(values) + _this select 1);
|
params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
|
||||||
_var = if (isNil _varName) then {
|
|
||||||
([_this select 1,_this select 5] call FUNC(cacheOverPressureVales)) select 2;
|
// Bake Variable Name and Check if the Variable Exist else call the Cache Function
|
||||||
} else {
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||||
(missionNameSpace getVariable _varName) select 2;
|
_var = if (isNil _varName) then {
|
||||||
};
|
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureVales)) select 2;
|
||||||
if (_var > 0) then {
|
} else {
|
||||||
|
(missionNameSpace getVariable _varName) select 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_var > 0) then {
|
||||||
_this call DFUNC(fireLauncherBackblast)
|
_this call DFUNC(fireLauncherBackblast)
|
||||||
};
|
};
|
||||||
|
@ -3,26 +3,29 @@
|
|||||||
*
|
*
|
||||||
* Handle fire of Other Weapons
|
* Handle fire of Other Weapons
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit that fired (Object)
|
* 0: Unit that fired <OBJECT>
|
||||||
* 1: Weapon fired (String)
|
* 1: Weapon fired <STRING>
|
||||||
* 2: Muzzle (String)
|
* 2: Muzzle <STRING>
|
||||||
* 3: Mode (String)
|
* 3: Mode <STRING>
|
||||||
* 4: Ammo (String)
|
* 4: Ammo <STRING>
|
||||||
* 5: Magazine (String)
|
* 5: Magazine <STRING>
|
||||||
* 6: Projectile (Object)
|
* 6: Projectile <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private ["_var","_varName"];
|
private ["_var","_varName"];
|
||||||
_varName = (QGVAR(values) + _this select 1);
|
params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
|
||||||
|
|
||||||
|
// Bake Variable Name and Check if the Variable Exist else call the Cache Function
|
||||||
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||||
_var = if (isNil _varName) then {
|
_var = if (isNil _varName) then {
|
||||||
([_this select 1,_this select 5] call FUNC(cacheOverPressureVales)) select 2;
|
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureVales)) select 2;
|
||||||
} else {
|
} else {
|
||||||
(missionNameSpace getVariable _varName) select 2;
|
(missionNameSpace getVariable _varName) select 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_var > 0) then {
|
if (_var > 0) then {
|
||||||
_this call DFUNC(fireOverpressureZone)
|
_this call DFUNC(fireOverpressureZone)
|
||||||
};
|
};
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
*
|
*
|
||||||
* Calculate the distance to the first intersection of a line
|
* Calculate the distance to the first intersection of a line
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Pos ASL of origin (Array)
|
* 0: Pos ASL of origin (ARRAY>
|
||||||
* 1: Direction (Array)
|
* 1: Direction <ARRAY>
|
||||||
* 2: Max distance to search (Number)
|
* 2: Max distance to search <Number>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Distance to intersection (+- 0.1 m)
|
* Distance to intersection (+- 0.1 m) <NUMBER>
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
@ -4,20 +4,23 @@
|
|||||||
* Calculate and apply backblast damage to potentially affected local units
|
* Calculate and apply backblast damage to potentially affected local units
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Unit that fired (Object)
|
* 0: Unit that fired <OBJECT>
|
||||||
* 1: Pos ASL of the projectile (Array)
|
* 1: Pos ASL of the projectile <ARRAY>
|
||||||
* 2: Direction of the projectile (Array)
|
* 2: Direction of the projectile <ARRAY>
|
||||||
* 3: Weapon fired (String)
|
* 3: Weapon fired <STRING>
|
||||||
|
* 4: Magazine <STRING>
|
||||||
|
* 5: Ammo <STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon,_magazine);
|
|
||||||
|
|
||||||
private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
|
||||||
_varName = (QGVAR(values) + _magazine);
|
params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"];
|
||||||
|
|
||||||
|
// Bake Variablen Name and Check if the Variable Exist else call the Cache Function
|
||||||
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
||||||
_var = if (isNil _varName) then {
|
_var = if (isNil _varName) then {
|
||||||
[_weapon,_magazine] call FUNC(cacheOverPressureVales);
|
[_weapon,_magazine] call FUNC(cacheOverPressureVales);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user