Skip to content

Mines weapon type & weapon proximity triggers#7461

Merged
BMagnu merged 12 commits into
scp-fs2open:masterfrom
MjnMixael:mines-weapon-type
Jun 5, 2026
Merged

Mines weapon type & weapon proximity triggers#7461
BMagnu merged 12 commits into
scp-fs2open:masterfrom
MjnMixael:mines-weapon-type

Conversation

@MjnMixael
Copy link
Copy Markdown
Contributor

Adds mines as a new weapon type that sit stationary and have unlimited life. Mines are also plotted on radar and are destroyable like bombs. Because these are a true weapon type they can take advantage of all the other various weapon features to come up with all kinds of new weapon ideas.

This PR also adds a proximity system for triggering detonations that is generalized and fixes #2235 while we're here. Proximity can be limited by IFF (hard set or comparative relation), Species, Type, and Class. Also includes a +Stealth Proximity Multiplier to scale proximity radius for stealth ships allowing stealth ships to get closer than others if desired. +Detonate Chance is also a feature here for probabilistic detonation per contact and is, I hope, multiplayer-deterministic.

Mine-specific ($MineInfo:)
+Sensors Range: / +Targetable Range: radar/HUD visibility tiers (distorted blip vs. fully targetable). -1 = always, 0 = never.
+Hitpoints: destructible HP (default 50)
+Chase Duration: on trigger, turn into a guided missile chasing the target for N seconds instead of detonating immediately (requires a homing flag)
+Detonates on Chase Timeout: at chase end, detonate vs. give up and return to stationary
+Chase Cooldown: re-arm delay after a non-detonating chase

Additionally new spawn behaviors have been added to reproduce BtA's mine design.
$Spawn Aimed: / $Spawn Aim Lead: spawn children fire toward the parent's homing target instead of into a random cone, with optional lead extrapolation.

AI ships will never choose mines as a weapon to use. An AI Profile flag is added to gate mine defensive behavior for safety.

AI: $ships intercept mines: profile flag
When set, AI ships autonomously engage hostile mines they can detect, with imminent-threat preemption (swap targets if a mine is about to detonate on them) and standoff distance scaled to the mine's proximity radius. Guards also defend their charges against mines.

Some scripting behavior is also added here with mines in mind like a proximity triggered hook and ability to arbitrarily detonate a weapon.

@MjnMixael MjnMixael added this to the Release 26.0 milestone May 14, 2026
@MjnMixael MjnMixael added feature A totally new sort of functionality Requested by Active Mod A feature request that has been requested by a mod that is actively in development. labels May 14, 2026
Copy link
Copy Markdown
Member

@BMagnu BMagnu left a comment

Choose a reason for hiding this comment

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

Some questions and comments.
Otherwise mostly a fair bit of trivial replacements of which warning function to use.

Comment thread code/ai/aicode.cpp
Comment on lines +7457 to +7461
if (En_objp->type == OBJ_WEAPON) {
weapon_info *target_wip = &Weapon_info[Weapons[En_objp->instance].weapon_info_index];
if (target_wip->is_mine() && target_wip->proximity_radius > 0.0f)
optimal_range = MAX(optimal_range, target_wip->proximity_radius * 1.2f);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need special treatment when the given weapon's range is insufficient to reach target_wip->proximity_radius * 1.2?

Comment thread code/ai/aicode.cpp Outdated
Comment thread code/ai/aicode.cpp
Comment thread code/ai/aicode.cpp
Comment thread code/radar/radarsetup.cpp Outdated
Comment thread code/weapon/weapons.cpp
Comment on lines +6302 to +6306
vm_vec_zero(&obj->phys_info.vel);
vm_vec_zero(&obj->phys_info.desired_vel);
obj->phys_info.speed = 0.0f;
wp->weapon_max_vel = 0.0f;
wp->homing_object = &obj_used_list;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like these should not insta-stop but rather dampen and slow down, but I guess that can be for the future.

Comment thread code/weapon/weapons.cpp Outdated
Comment thread code/weapon/weapons.cpp Outdated
Comment thread code/weapon/weapons.cpp Outdated
Comment thread code/weapon/weapons.cpp Outdated
@MjnMixael MjnMixael force-pushed the mines-weapon-type branch from 2579261 to 86a1af3 Compare June 4, 2026 13:26
@BMagnu BMagnu merged commit 31f77e5 into scp-fs2open:master Jun 5, 2026
20 checks passed
@MjnMixael MjnMixael deleted the mines-weapon-type branch June 5, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A totally new sort of functionality Requested by Active Mod A feature request that has been requested by a mod that is actively in development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Proximity Munitions

2 participants