RandomTriggerOnTriggerComponent (#41422)

* commit

* rename

* prevent recusion

---------

Co-authored-by: iaada <iaada@users.noreply.github.com>
This commit is contained in:
āda
2025-11-13 17:56:17 -06:00
committed by GitHub
parent 3bbd08d889
commit 31ade640d0
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using Content.Shared.Random;
using Content.Shared.Trigger.Components.Triggers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Trigger.Components.Effects;
/// <summary>
/// When triggered this component will choose a key and send a new trigger.
/// Trigger is sent to user if <see cref="BaseXOnTriggerComponent.TargetUser"/> is true.
/// </summary>
/// <remarks>Does not support recursive loops where this component triggers itself. Use <see cref="RepeatingTriggerComponent"/> instead.</remarks>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class RandomTriggerOnTriggerComponent : BaseXOnTriggerComponent
{
/// <summary>
/// The trigger keys and their weights.
/// </summary>
[DataField(required: true), AutoNetworkedField]
public ProtoId<WeightedRandomPrototype> RandomKeyOut;
}