Skip to content

Missile Defense - New Component#10965

Open
BrettMayson wants to merge 19 commits into
acemod:masterfrom
BrettMayson:missile_defense
Open

Missile Defense - New Component#10965
BrettMayson wants to merge 19 commits into
acemod:masterfrom
BrettMayson:missile_defense

Conversation

@BrettMayson
Copy link
Copy Markdown
Member

@BrettMayson BrettMayson commented Jun 17, 2025

When merged this pull request will:

https://www.youtube.com/watch?v=H-JSDWOMnXY

This meets my needs and if big changes are wanted someone will have to take over. I still didn't use a CBA state machine just because I wanted to do this quick and I don't know them.

Could maybe use some additional customization and functionality (specifying projectile classes to intercept, only fire on projectiles that will hit in a certain area?)

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

Comment thread .vscode/settings.json Outdated
Copy link
Copy Markdown
Contributor

@TheCandianVendingMachine TheCandianVendingMachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial pass, not super thorough. I'm going to close the other PR, I like this more in every way (especially naming given recent events...)

Comment thread addons/missile_defense/CfgEventHandlers.hpp Outdated
Comment thread addons/missile_defense/XEH_preInit.sqf Outdated
Comment thread addons/missile_defense/CfgEventHandlers.hpp Outdated
Comment thread addons/missile_defense/XEH_preInit.sqf Outdated
Comment thread addons/missile_defense/XEH_preInit.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_systemPFH.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_interceptorPFH.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_createSystem.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_createSystem.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_createSystem.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_interceptorPFH.sqf
Comment thread addons/missile_defense/functions/fnc_registerLauncher.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_systemPFH.sqf Outdated
Comment thread addons/missile_defense/XEH_preInit.sqf
Co-authored-by: Filip Maciejewski <[email protected]>
Co-authored-by: PabstMirror <[email protected]>
Comment thread addons/missile_defense/functions/fnc_createSystem.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_registerTracker.sqf Outdated
Comment thread addons/missile_defense/initSettings.inc.sqf
Copy link
Copy Markdown
Contributor

@SpicyBagpipes SpicyBagpipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm daft and couldn't figure out how to PR the branch on GitHub desktop so have a review instead

Comment thread addons/missile_defense/functions/fnc_interceptorPFH.sqf
Comment thread addons/missile_defense/functions/fnc_interceptorPFH.sqf Outdated
Comment thread addons/missile_defense/functions/fnc_interceptorPFH.sqf Outdated
Co-Authored-By: SpicyBagpipes <[email protected]>
* Create a missile defense system.
*
* Arguments:
* 0: Sides <ARRAY of SIDEs> - The sides that the missile defense system will engage. If not provided, it will engage all sides.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 0: Sides <ARRAY of SIDEs> - The sides that the missile defense system will engage. If not provided, it will engage all sides.
* 0: Sides - The sides that the missile defense system will engage. If not provided, it will engage all sides. <ARRAY of SIDEs>

*
* Arguments:
* 0: Sides <ARRAY of SIDEs> - The sides that the missile defense system will engage. If not provided, it will engage all sides.
* 1: ID <STRING> - Optional, The ID of the missile defense system to create.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 1: ID <STRING> - Optional, The ID of the missile defense system to create.
* 1: ID - Optional, The ID of the missile defense system to create. <STRING>

* 1: ID <STRING> - Optional, The ID of the missile defense system to create.
*
* Return Value:
* <STRING> - The ID of the created missile defense system.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* <STRING> - The ID of the created missile defense system.
The ID of the created missile defense system. <STRING>

* <STRING> - The ID of the created missile defense system.
*
* Example:
* [] call ace_missile_defense_createSystem
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [] call ace_missile_defense_createSystem
* [] call ace_missile_defense_fnc_createSystem

params ["_sides", ["_id", ""]];

if (!isServer) exitWith {
ERROR("missile_defense functions only run on server");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ERROR("missile_defense functions only run on server");
ERROR("missile_defense functions only run on server"); "#error"

if (_angle <= GVAR(launchAcceptableAngle) && _elevation >= GVAR(launchAcceptableElevation)) then {
_launcher setVariable [QGVAR(state), LAUNCH_STATE_COOLDOWN];
_launcher setVariable [QGVAR(lastLaunchTime), CBA_missionTime];
private _turret = [_launcher, (crew _launcher) select 0] call CBA_fnc_turretPath;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private _turret = [_launcher, (crew _launcher) select 0] call CBA_fnc_turretPath;
private _turret = [(crew _launcher) select 0] call CBA_fnc_turretPath;

TRACE_1("Destroyed projectile using object",_target);
};
private _near = nearestObjects [_position, [_type], GVAR(destroyRadius)];
if (count _near > 0) then {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (count _near > 0) then {
if (_near isNotEqualTo []) then {


GVAR(destroyRadius) = 20;

[QGVAR(destroyProjectile), {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would want this event to be added everywhere (not just preInitClient)
So server will also delete shots and prevent damage being applied

if (_launcher in _launchers) exitWith {
ERROR_1("Missile defense launcher '%1' already registered",_launcher);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add warning if placed with no crew

Suggested change
if ((crew _launcher) isEqualTo []) then { WARNING_1("no crew for launcher %1",_launcher); };

if (!isNil "_target" && {!isNull _target}) then {
private _sides = _system getOrDefault ["sides", []];
private _side = _target getVariable [QGVAR(side), side _target];
if (_side in _sides) then {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_side in _sides) then {
if (_side in _sides || {_sides isEqualTo []}) then {

this would match createSystem's header

_launcher setVariable [QGVAR(state), LAUNCH_STATE_COOLDOWN];
_launcher setVariable [QGVAR(lastLaunchTime), CBA_missionTime];
private _turret = [_launcher, (crew _launcher) select 0] call CBA_fnc_turretPath;
[_launcher, _launcher currentWeaponTurret _turret] call BIS_fnc_fire;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this func gave me a lot of trouble
[q1,"ace_missile_manpad_rim116"] call bis_fnc_fire seems to have no effect sometimes
forceWeaponFire seemed to be more reliable but we'd also need to handle locality issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants