TriggerOnPlayerSpawnComplete and ExplosionOnTrigger (#39820)

This commit is contained in:
āda
2025-09-23 15:24:45 -05:00
committed by GitHub
parent 3ee7d81944
commit eee5751a22
7 changed files with 127 additions and 20 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Explosion.Components;
using Robust.Shared.GameStates;
namespace Content.Shared.Trigger.Components.Effects;
@@ -7,8 +8,6 @@ namespace Content.Shared.Trigger.Components.Effects;
/// TargetUser will only work of the user has ExplosiveComponent as well.
/// The User will be logged in the admin logs.
/// </summary>
/// <summary>
/// TODO: Allow this to work without an ExplosiveComponent on the user via QueueExplosion.
/// </summary>
/// <seealso cref="ExplosionOnTriggerComponent"/>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ExplodeOnTriggerComponent : BaseXOnTriggerComponent;

View File

@@ -0,0 +1,46 @@
using Content.Shared.Explosion;
using Content.Shared.Explosion.Components;
using Content.Shared.Explosion.EntitySystems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Trigger.Components.Effects;
// TODO some sort of struct like DamageSpecifier but for explosions.
/// <summary>
/// Will explode the entity using this component's explosion specifications.
/// If TargetUser is true, they'll explode instead.
/// The User will be logged in the admin logs.
/// </summary>
/// <seealso cref="ExplodeOnTriggerComponent"/>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ExplosionOnTriggerComponent : BaseXOnTriggerComponent
{
/// <inheritdoc cref="ExplosiveComponent.ExplosionType"/>
[DataField, AutoNetworkedField]
public ProtoId<ExplosionPrototype> ExplosionType = SharedExplosionSystem.DefaultExplosionPrototypeId;
/// <inheritdoc cref="ExplosiveComponent.MaxIntensity"/>
[DataField, AutoNetworkedField]
public float MaxTileIntensity = 4;
/// <inheritdoc cref="ExplosiveComponent.IntensitySlope"/>
[DataField, AutoNetworkedField]
public float IntensitySlope = 1;
/// <inheritdoc cref="ExplosiveComponent.TotalIntensity"/>
[DataField, AutoNetworkedField]
public float TotalIntensity = 10;
/// <inheritdoc cref="ExplosiveComponent.TileBreakScale"/>
[DataField, AutoNetworkedField]
public float TileBreakScale = 1f;
/// <inheritdoc cref="ExplosiveComponent.MaxTileBreak"/>
[DataField, AutoNetworkedField]
public int MaxTileBreak = int.MaxValue;
/// <inheritdoc cref="ExplosiveComponent.CanCreateVacuum"/>
[DataField, AutoNetworkedField]
public bool CanCreateVacuum = true;
}

View File

@@ -0,0 +1,11 @@
using Content.Shared.GameTicking;
using Robust.Shared.GameStates;
namespace Content.Shared.Trigger.Components.Triggers;
/// <summary>
/// A trigger which occurs on <see cref="PlayerSpawnCompleteEvent"/>.
/// </summary>
/// <remarks>This does not work with <see cref="TraitSystem"/>, as it would add this component while the event is getting raised.</remarks>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TriggerOnPlayerSpawnCompleteComponent : BaseTriggerOnXComponent;