Add settings for various things

This commit is contained in:
Brandon Danyluk 2021-05-18 21:32:04 -06:00
parent 395b2b2d12
commit 790faf1c21
7 changed files with 117 additions and 22 deletions

View File

@ -6,7 +6,7 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
ADDON = true;
#include "initSettings.sqf"
// Server handles the tracking of all projectiles. It dispatches events to launchers to fire at specific targets
// The tracker and launcher array are global to allow for early-out if it is impossible to kill any projectiles to avoid wasting bandwidth
@ -90,3 +90,5 @@ GVAR(projectilesToIntercept) = [];
};
}] call CBA_fnc_addClassEventHandler;
ADDON = true;

View File

@ -6,7 +6,8 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
// no point having this system without missile guidance: nothing would happen
requiredAddons[] = {"ace_common","ace_missileguidance"};
author = ECSTRING(common,ACETeam);
authors[] = {"Brandon (TCVM)"};
url = ECSTRING(main,URL);
@ -15,3 +16,4 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"

View File

@ -29,7 +29,7 @@ GVAR(launchers) = GVAR(launchers) select {
};
[GVAR(toBeShot), {
(CBA_missionTime - _value) < RECYCLE_TIME
(CBA_missionTime - _value) < GVAR(targetRecycleTime)
}] call CBA_fnc_hashFilter;
private _idleLaunchers = GVAR(launchers) select {
@ -126,7 +126,7 @@ if (_idleLaunchers isNotEqualTo []) then {
_targetList = _targetList select {
private _timeFiredAt = [_engagedTargets, _x, 0] call CBA_fnc_hashGet;
alive _x && { (CBA_missionTime - _timeFiredAt) >= RE_ENGAGEMENT_TIME }
alive _x && (_timeFiredAt == 0 || { (CBA_missionTime - _timeFiredAt) >= GVAR(targetRecycleTime) })
};
private _bestTarget = objNull;
@ -161,7 +161,7 @@ if (_idleLaunchers isNotEqualTo []) then {
private _elevation = 90 - ((_localDirection#1) atan2 (_localDirection#2));
private _angle = acos (_turretDirection vectorCos _directionToTarget);
if (_angle <= LAUNCH_ACCEPTABLE_ANGLE && _elevation >= LAUNCH_ACCEPTABLE_ELEVATION) then {
if (_angle <= GVAR(launchAcceptableAngle) && _elevation >= GVAR(launchAcceptableElevation)) then {
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_FIRING];
};
@ -189,7 +189,7 @@ if (_idleLaunchers isNotEqualTo []) then {
};
case LAUNCH_STATE_COOLDOWN: {
private _lastLaunchTime = _launcher getVariable QGVAR(lastLaunchTime);
if (CBA_missionTime - _lastLaunchTime >= TIME_BETWEEN_LAUNCHES) then {
if (CBA_missionTime - _lastLaunchTime >= GVAR(timeBetweenLaunches)) then {
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_IDLE];
};

View File

@ -40,10 +40,11 @@ GVAR(interceptors) = GVAR(interceptors) select {
#ifdef DRAW_TRACKING_INFO
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,0,1,1], (getPos _target) vectorAdd [0, 0, 0.5], 0.75, 0.75, 0, format ["%1m", _minDistance], 1, 0.025, "TahomaB"];
#endif
if (!alive _target || { _minDistance <= PROX_RANGE } || { _minDistance > _lastDistance }) then {
if (!alive _target || { _minDistance <= GVAR(proximityFuseRange) } || { _minDistance > _lastDistance }) then {
triggerAmmo _projectile;
// if we overshot target, dont take out target
if (_minDistance <= _lastDistance) then {
if (_minDistance <= _lastDistance && { GVAR(proximityFuseFailureChance) <= random 1 }) then {
private _explosion = createVehicle ["SmallSecondary", _target, [], 0, "CAN_COLLIDE"];
deleteVehicle _target;
};
false

View File

@ -0,0 +1,60 @@
[
QGVAR(targetRecycleTime), "SLIDER",
[LSTRING(targetRecycleTime_setting), LSTRING(targetRecycleTime_description)],
LSTRING(category),
[0, 60, 15, 0, false], // default value
true, // isGlobal
{[QGVAR(targetRecycleTime), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(launchAcceptableAngle), "SLIDER",
[LSTRING(launchAcceptableAngle_setting), LSTRING(launchAcceptableAngle_description)],
LSTRING(category),
[1, 60, 10, 0, false], // default value
true, // isGlobal
{[QGVAR(launchAcceptableAngle), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(launchAcceptableElevation), "SLIDER",
[LSTRING(launchAcceptableElevation_setting), LSTRING(launchAcceptableElevation_description)],
LSTRING(category),
[-90, 90, 5, 0, false], // default value
true, // isGlobal
{[QGVAR(launchAcceptableElevation), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(timeBetweenLaunches), "SLIDER",
[LSTRING(timeBetweenLaunches_setting), LSTRING(timeBetweenLaunches_description)],
LSTRING(category),
[0, 60, 1, 0, false], // default value
true, // isGlobal
{[QGVAR(timeBetweenLaunches), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(proximityFuseRange), "SLIDER",
[LSTRING(proximityFuseRange_setting), LSTRING(proximityFuseRange_description)],
LSTRING(category),
[1, 50, 10, 0, false], // default value
true, // isGlobal
{[QGVAR(timeBetweenLaunches), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(proximityFuseFailureChance), "SLIDER",
[LSTRING(proximityFuseFailureChance_setting), LSTRING(proximityFuseFailureChance_description)],
LSTRING(category),
[0, 1, 0, 2, true], // default value
true, // isGlobal
{[QGVAR(proximityFuseFailureChance), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

View File

@ -20,18 +20,4 @@
#define LAUNCH_STATE_FIRING 2
#define LAUNCH_STATE_COOLDOWN 3
// How long it takes to recycle a target
#define RECYCLE_TIME 2
// how many error degrees the launcher has to be pointing toward the target
#define LAUNCH_ACCEPTABLE_ANGLE 10
// How many degrees up this needs to point for a valid firing solution
#define LAUNCH_ACCEPTABLE_ELEVATION 5
// How fast the launcher launches
#define TIME_BETWEEN_LAUNCHES 1
// how many seconds does a launcher have to wait before re-engaging the same target
#define RE_ENGAGEMENT_TIME 5
// Proximity fuse range
#define PROX_RANGE 10
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="IRON_DOME">
<Key ID="STR_ACE_IRON_DOME_category">
<English>ACE Iron Dome</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_targetRecycleTime_setting">
<English>Target Recycle Time</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_targetRecycleTime_description">
<English>How many seconds until another launcher can consider firing at the target</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_launchAcceptableAngle_setting">
<English>Launch Acceptable Angle</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_launchAcceptableAngle_description">
<English>How many degrees offset the launcher can be before firing</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_launchAcceptableElevation_setting">
<English>Launch Acceptable Elevation</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_launchAcceptableElevation_description">
<English>The minimum number of degrees the launcher has to be pointing up/down before firing</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_timeBetweenLaunches_setting">
<English>Time Between Launches</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_timeBetweenLaunches_description">
<English>Minimum number of seconds between each launch of an interceptor for a single launcher</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_proximityFuseRange_setting">
<English>Proximity Fuse Range</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_proximityFuseRange_description">
<English>How close the interceptor has to be to the target in order to detonate</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_proximityFuseFailureChance_setting">
<English>Proximity Fuse Failure Chance</English>
</Key>
<Key ID="STR_ACE_IRON_DOME_proximityFuseFailureChance_description">
<English>Chance for proximity fuse to fail to destroy target</English>
</Key>
</Package>
</Project>