if (grid is null)
return;
- var amountToSpawn = Math.Max(1, (int) MathF.Round(GetSeverityModifier() / 2));
+ var amountToSpawn = 1;
for (var i = 0; i < amountToSpawn; i++)
{
_anomaly.SpawnOnRandomGridLocation(grid.Value, component.AnomalySpawnerPrototype);
{
base.Started(uid, component, gameRule, args);
- var amountToSpawn = Math.Max(1, (int) MathF.Round(GetSeverityModifier() / 1.5f));
+ var amountToSpawn = 1;
for (var i = 0; i < amountToSpawn; i++)
{
if (!TryFindRandomTile(out _, out _, out _, out var coords))
if (jobList.Count == 0)
return;
- var mod = GetSeverityModifier();
-
// Low chance to completely change up the late-join landscape by closing all positions except infinite slots.
// Lower chance than the /tg/ equivalent of this event.
- if (RobustRandom.Prob(Math.Min(0.25f * MathF.Sqrt(mod), 1.0f)))
+ if (RobustRandom.Prob(0.25f))
{
var chosenJob = RobustRandom.PickAndTake(jobList);
_stationJobs.MakeJobUnlimited(chosenStation.Value, chosenJob); // INFINITE chaos.
}
else
{
- var lower = (int) (jobList.Count * Math.Min(1.0f, 0.20 * mod));
- var upper = (int) (jobList.Count * Math.Min(1.0f, 0.30 * mod));
+ var lower = (int) (jobList.Count * 0.20);
+ var upper = (int) (jobList.Count * 0.30);
// Changing every role is maybe a bit too chaotic so instead change 20-30% of them.
var num = RobustRandom.Next(lower, upper);
for (var i = 0; i < num; i++)
if (!TryComp<StationEventComponent>(uid, out var stationEvent))
return;
- var mod = MathF.Sqrt(GetSeverityModifier());
-
// Essentially we'll pick out a target amount of gas to leak, then a rate to leak it at, then work out the duration from there.
if (TryFindRandomTile(out component.TargetTile, out var target, out component.TargetGrid, out component.TargetCoords))
{
component.LeakGas = RobustRandom.Pick(component.LeakableGases);
// Was 50-50 on using normal distribution.
- var totalGas = RobustRandom.Next(component.MinimumGas, component.MaximumGas) * mod;
+ var totalGas = RobustRandom.Next(component.MinimumGas, component.MaximumGas);
var startAfter = stationEvent.StartDelay;
component.MolesPerSecond = RobustRandom.Next(component.MinimumMolesPerSecond, component.MaximumMolesPerSecond);
{
base.Started(uid, component, gameRule, args);
- var mod = Math.Sqrt(GetSeverityModifier());
- component.WaveCounter = (int) (RobustRandom.Next(component.MinimumWaves, component.MaximumWaves) * mod);
+ component.WaveCounter = RobustRandom.Next(component.MinimumWaves, component.MaximumWaves);
}
protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent component, GameRuleComponent gameRule, float frameTime)
return;
}
- var mod = GetSeverityModifier();
-
component.Cooldown -= frameTime;
if (component.Cooldown > 0f)
component.WaveCounter--;
- component.Cooldown += (component.MaximumCooldown - component.MinimumCooldown) * RobustRandom.NextFloat() / mod + component.MinimumCooldown;
+ component.Cooldown += (component.MaximumCooldown - component.MinimumCooldown) * RobustRandom.NextFloat() + component.MinimumCooldown;
Box2? playableArea = null;
var mapId = GameTicker.DefaultMap;
{
HashSet<EntityUid> stationsToNotify = new();
- var mod = GetSeverityModifier();
var targetList = new List<Entity<SentienceTargetComponent>>();
var query = EntityQueryEnumerator<SentienceTargetComponent>();
while (query.MoveNext(out var targetUid, out var target))
RobustRandom.Shuffle(targetList);
- var toMakeSentient = (int) (RobustRandom.Next(2, 5) * Math.Sqrt(mod));
+ var toMakeSentient = RobustRandom.Next(2, 5);
var groups = new HashSet<string>();
foreach (var target in targetList)
GameTicker.EndGameRule(uid, component);
}
- public float GetSeverityModifier()
- {
- var ev = new GetSeverityModifierEvent();
- RaiseLocalEvent(ev);
- return ev.Modifier;
- }
-
#endregion
}
-
-/// <summary>
-/// Raised broadcast to determine what the severity modifier should be for an event, some positive number that can be multiplied with various things.
-/// Handled by usually other game rules (like the ramping scheduler).
-/// Most events should try and make use of this if possible.
-/// </summary>
-public sealed class GetSeverityModifierEvent : EntityEventArgs
-{
- /// <summary>
- /// Should be multiplied/added to rather than set, for commutativity.
- /// </summary>
- public float Modifier = 1.0f;
-}
.Where(x => !x.Abstract)
.Select(x => x.ID).ToList();
- // TODO: This is gross, but not much can be done until event refactor, which needs Dynamic.
- var mod = (float) Math.Sqrt(GetSeverityModifier());
-
foreach (var (_, transform) in EntityManager.EntityQuery<GasVentPumpComponent, TransformComponent>())
{
if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station != chosenStation)
var solution = new Solution();
- if (!RobustRandom.Prob(Math.Min(0.33f * mod, 1.0f)))
+ if (!RobustRandom.Prob(0.33f))
continue;
- var pickAny = RobustRandom.Prob(Math.Min(0.05f * mod, 1.0f));
+ var pickAny = RobustRandom.Prob(0.05f);
var reagent = RobustRandom.Pick(pickAny ? allReagents : component.SafeishVentChemicals);
var weak = component.WeakReagents.Contains(reagent);
- var quantity = (weak ? component.WeakReagentQuantity : component.ReagentQuantity) * mod;
+ var quantity = weak ? component.WeakReagentQuantity : component.ReagentQuantity;
solution.AddReagent(reagent, quantity);
var foamEnt = Spawn("Foam", transform.Coordinates);
return component.MaxChaos / component.EndTime * roundTime + component.StartingChaos;
}
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent<GetSeverityModifierEvent>(OnGetSeverityModifier);
- }
-
protected override void Started(EntityUid uid, RampingStationEventSchedulerComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
}
}
- private void OnGetSeverityModifier(GetSeverityModifierEvent ev)
- {
- var query = EntityQueryEnumerator<RampingStationEventSchedulerComponent, GameRuleComponent>();
- while (query.MoveNext(out var uid, out var scheduler, out var gameRule))
- {
- if (!GameTicker.IsGameRuleActive(uid, gameRule))
- return;
-
- ev.Modifier *= GetChaosModifier(uid, scheduler);
- Logger.Info($"Ramping set modifier to {ev.Modifier}");
- }
- }
-
private void PickNextEventTime(EntityUid uid, RampingStationEventSchedulerComponent component)
{
var mod = GetChaosModifier(uid, component);