Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Numerics;
using Robust.Shared.Map.Components;

namespace Content.Server._Mono.Projectiles.TargetSeeking;

public sealed partial class TargetSeekingSystem
{
private Vector2 GetTargetWorldPosition(EntityUid target, TransformComponent xform)
{
if (TryComp<MapGridComponent>(target, out var grid))
return Vector2.Transform(grid.LocalAABB.Center, _transform.GetWorldMatrix(xform));

return _transform.GetWorldPosition(xform);
}
}
48 changes: 48 additions & 0 deletions Content.Server/_Forge/ShipWeapons/ForgeTorpedoLauncherComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared.Physics;

namespace Content.Server._Forge.ShipWeapons;

/// <summary>
/// Marks a static ship launcher that uses its own facing for launch direction and
/// the gunnery cursor only for target-grid selection.
/// </summary>
[RegisterComponent]
public sealed partial class ForgeTorpedoLauncherComponent : Component
{
/// <summary>
/// Distance from the launcher center used to sample the tile in front of the muzzle.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float TileProbeDistance = 1f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ClearanceRayDistance = 1.25f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
public int ClearanceCollisionMask = (int) (CollisionGroup.Opaque | CollisionGroup.Impassable);

/// <summary>
/// Distance used to build a gun shoot coordinate straight out of the launcher.
/// The actual locked target is stored separately, because the cursor is not the muzzle direction.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LaunchAimDistance = 32f;

/// <summary>
/// Minimum random delay before the prepared torpedo launch is actually fired.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LaunchDelayMin = 0f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LaunchDelayMax = 0.1f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
public float TargetSearchRadius = 48f;

/// <summary>
/// Minimum tile count for a grid to be considered a valid torpedo target.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public int MinTargetTiles = 25;
}
Loading
Loading