Roundstart variation game rules (#24397)
* Raise `StationPostInitEvent` broadcast * Basic variation pass handling * standardize names + rule entities * why does it work like that? * add to defaults * light break variation pass * ent spawn entry * move some stationevent utility functions to gamerule + add one for finding random tile on specified station * forgot how statistics works * powered light variation pass is good now * station tile count function * public method to ensure all solutions (for procedural use before mapinit) * move gamerulesystem utility funcs to partial * ensure all solutions before spilling in puddlesystem. for use when spilling before mapinit * trash & puddle variation passes! * oh yeah * ehh lets live a little * std * utility for game rule check based on comp * entprotoid the trash spawner oops * generalize trash variation * use added instead of started for secret rule * random cleanup * generic replacement variation system * Wall rusting variation rule * account for modifying while enumerating * use localaabb * fix test * minor tweaks * reinforced wall replacer + puddletweaker
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for replacing a certain amount of entities with other entities in a variation pass.
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// POTENTIALLY REPLACEABLE ENTITIES MUST BE MARKED WITH A REPLACEMENT MARKER
|
||||
/// AND HAVE A SYSTEM INHERITING FROM <see cref="BaseEntityReplaceVariationPassSystem{TEntComp,TGameRuleComp}"/>
|
||||
/// SEE <see cref="WallReplaceVariationPassSystem"/>
|
||||
/// </remarks>
|
||||
[RegisterComponent]
|
||||
public sealed partial class EntityReplaceVariationPassComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of matching entities before one will be replaced on average.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public float EntitiesPerReplacementAverage;
|
||||
|
||||
[DataField(required: true)]
|
||||
public float EntitiesPerReplacementStdDev;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype(s) to replace matched entities with.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public List<EntitySpawnEntry> Replacements = default!;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for spawning entities randomly dotted around the station in a variation pass.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class EntitySpawnVariationPassComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of tiles before we spawn one entity on average.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float TilesPerEntityAverage = 50f;
|
||||
|
||||
[DataField]
|
||||
public float TilesPerEntityStdDev = 7f;
|
||||
|
||||
/// <summary>
|
||||
/// Spawn entries for each chosen location.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public List<EntitySpawnEntry> Entities = default!;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Content.Shared.Light.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This handle randomly destroying lights, causing them to flicker endlessly, or replacing their tube/bulb with different variants.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class PoweredLightVariationPassComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Chance that a light will be replaced with a broken variant.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float LightBreakChance = 0.15f;
|
||||
|
||||
/// <summary>
|
||||
/// Chance that a light will be replaced with an aged variant.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float LightAgingChance = 0.05f;
|
||||
|
||||
[DataField]
|
||||
public float AgedLightTubeFlickerChance = 0.03f;
|
||||
|
||||
[DataField]
|
||||
public EntProtoId BrokenLightBulbPrototype = "LightBulbBroken";
|
||||
|
||||
[DataField]
|
||||
public EntProtoId BrokenLightTubePrototype = "LightTubeBroken";
|
||||
|
||||
[DataField]
|
||||
public EntProtoId AgedLightBulbPrototype = "LightBulbOld";
|
||||
|
||||
[DataField]
|
||||
public EntProtoId AgedLightTubePrototype = "LightTubeOld";
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Content.Shared.Random;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Handles spilling puddles with various reagents randomly around the station.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class PuddleMessVariationPassComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Tiles before one spill on average.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float TilesPerSpillAverage = 600f;
|
||||
|
||||
[DataField]
|
||||
public float TilesPerSpillStdDev = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Weighted random prototype to use for random messes.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public ProtoId<WeightedRandomFillSolutionPrototype> RandomPuddleSolutionFill = default!;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class ReinforcedWallReplaceVariationPassComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components.ReplacementMarkers;
|
||||
|
||||
/// <summary>
|
||||
/// This component marks replaceable reinforced walls for use with fast queries in variation passes.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ReinforcedWallReplacementMarkerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components.ReplacementMarkers;
|
||||
|
||||
/// <summary>
|
||||
/// This component marks replaceable walls for use with fast queries in variation passes.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class WallReplacementMarkerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class WallReplaceVariationPassComponent : Component
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user