Missile Defense - New Component#10965
Conversation
TheCandianVendingMachine
left a comment
There was a problem hiding this comment.
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...)
Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: PabstMirror <[email protected]>
SpicyBagpipes
left a comment
There was a problem hiding this comment.
I'm daft and couldn't figure out how to PR the branch on GitHub desktop so have a review instead
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. |
There was a problem hiding this comment.
| * 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. |
There was a problem hiding this comment.
| * 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. |
There was a problem hiding this comment.
| * <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 |
There was a problem hiding this comment.
| * [] 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"); |
There was a problem hiding this comment.
| 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; |
There was a problem hiding this comment.
| 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 { |
There was a problem hiding this comment.
| if (count _near > 0) then { | |
| if (_near isNotEqualTo []) then { |
|
|
||
| GVAR(destroyRadius) = 20; | ||
|
|
||
| [QGVAR(destroyProjectile), { |
There was a problem hiding this comment.
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); | ||
| }; | ||
|
|
There was a problem hiding this comment.
maybe add warning if placed with no crew
| 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 { |
There was a problem hiding this comment.
| 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; |
There was a problem hiding this comment.
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
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
Component - Add|Fix|Improve|Change|Make|Remove {changes}.