CatStation/Content.Server/StationEvents/Components/SpaceSpawnRuleComponent.cs
Whatstone 456c291073
SpaceSpawnRule: generate around grid center, not local origin (#46225)
* SpaceSpawnRule: generate around grid center, N try

* handle non-positive MaxAttempts

it'll just spawn on the arc at a random position, like it does now!

* comment

* fix use of indices in spawn point index list

you absolute boob

* MaxAttempts, clear before FindGridsIntersecting

Co-authored-by: Pok27 <113675512+Pok27@users.noreply.github.com>

* formattt

---------

Co-authored-by: Pok27 <113675512+Pok27@users.noreply.github.com>
2026-09-29 20:55:19 +00:00

42 lines
1.1 KiB
C#

using Content.Server.StationEvents.Events;
using Content.Shared.Antag.Components;
using Robust.Shared.Map;
namespace Content.Server.StationEvents.Components;
/// <summary>
/// Component for spawning antags in space around a station.
/// </summary>
/// <remarks>
/// Requires <see cref="AntagSelectionComponent"/>.
/// </remarks>
[RegisterComponent, Access(typeof(SpaceSpawnRule))]
public sealed partial class SpaceSpawnRuleComponent : Component
{
/// <summary>
/// Final distance that the entity should spawn from the station's grid.
/// </summary>
[DataField]
public float SpawnDistance = 20f;
/// <summary>
/// The distance we should check around each spawn point for grids.
/// </summary>
/// <remarks>
/// Should be less than <see cref="SpawnDistance"/>
/// </remarks>
[DataField]
public float ClearDistance = 5f;
/// <summary>
/// Number of attempts to check around the station, evenly spaced around a circle.
/// </summary>
[DataField]
public int MaxAttempts = 5;
/// <summary>
/// Location that was picked.
/// </summary>
[DataField]
public MapCoordinates? Coords;
}