Skip to content

Commit

Permalink
Cleaning up!
Browse files Browse the repository at this point in the history
  • Loading branch information
ewokswagger committed Nov 17, 2024
1 parent 78098c3 commit 64d873e
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 206 deletions.
341 changes: 169 additions & 172 deletions Content.Server/DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public override void Update(float frameTime)
NextEventComponent? nextEventComponent = null;
if (Resolve(uid, ref nextEventComponent, false)) // If there is a nextEventComponent use the stashed event instead of running it directly.
{
ResetTimer(eventScheduler);
ResetTimer(eventScheduler); // Time needs to be reset ahead of time since we need to chose events based on the next time it will run.
TimeSpan nextEventTime = _timing.CurTime + TimeSpan.FromSeconds(eventScheduler.TimeUntilNextEvent);
if (!_event.TryGenerateRandomEvent(eventScheduler.ScheduledGameRules, out string? generatedEvent, nextEventTime) || generatedEvent == null)
continue;
Expand Down
5 changes: 2 additions & 3 deletions Content.Server/StationEvents/EventManagerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public bool TryGenerateRandomEvent(EntityTableSelector limitedEventsTable, out s
}
// DeltaV - end overloaded for backwards compatiblity

// DeltaV - seperate event generation method
// DeltaV - separate event generation method
public bool TryGenerateRandomEvent(EntityTableSelector limitedEventsTable, out string? randomLimitedEvent, TimeSpan? eventRunTime) // Event time checks compared to eventRunTime
// unless its null in which case current time is used
{
Expand All @@ -93,11 +93,10 @@ public bool TryGenerateRandomEvent(EntityTableSelector limitedEventsTable, out s
Log.Warning("A requested event is not available!");
return false;
}
// End snippet from upstreams RunRandomEvent

return true;
}
// DeltaV - end seperate event generation method
// DeltaV - end separate event generation method

// DeltaV - overloaded for backwards compatiblity
public bool TryBuildLimitedEvents(EntityTableSelector limitedEventsTable, out Dictionary<EntityPrototype, StationEventComponent> limitedEvents)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.StationEvents.Components;
using Content.Shared.DeltaV.StationEvents;
using Content.Shared.DeltaV.StationEvents; // DeltaV
using Content.Shared.GameTicking.Components;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Timing; // DeltaV

namespace Content.Server.StationEvents;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared.Abilities.Psionics
namespace Content.Shared.Abilities.Psionics;

[RegisterComponent]
public sealed partial class PrecognitionPowerComponent : Component
{
[RegisterComponent]
public sealed partial class PrecognitionPowerComponent : Component
{
[DataField("randomResultChance")]
public float RandomResultChance = 0.2F;
[DataField("randomResultChance")]
public float RandomResultChance = 0.2F;

[DataField("doAfter")]
public DoAfterId? DoAfter;
[DataField("doAfter")]
public DoAfterId? DoAfter;

[DataField("useDelay")]
public TimeSpan UseDelay = TimeSpan.FromSeconds(5);
[DataField("useDelay")]
public TimeSpan UseDelay = TimeSpan.FromSeconds(5);

[DataField("PrecognitionActionId",
customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? PrecognitionActionId = "ActionPrecognition";
[DataField("PrecognitionActionId",
customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? PrecognitionActionId = "ActionPrecognition";

[DataField("PrecognitionActionEntity")]
public EntityUid? PrecognitionActionEntity;
}
[DataField("PrecognitionActionEntity")]
public EntityUid? PrecognitionActionEntity;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace Content.Shared.Abilities.Psionics
namespace Content.Shared.Abilities.Psionics;

[RegisterComponent]
public sealed partial class PrecognitionResultComponent : Component
{
[RegisterComponent]
public sealed partial class PrecognitionResultComponent : Component
{
[DataField("message")]
public string Message = default!;
[DataField("message")]
public string Message = default!;

[DataField("randomResultWeight")]
public float Weight = default!;
}
[DataField("randomResultWeight")]
public float Weight = default!;
}
6 changes: 3 additions & 3 deletions Resources/Prototypes/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
id: BasicStationEventScheduler
parent: BaseGameRule
components:
- type: NextEvent # Deltav
- type: NextEvent # DeltaV: Queue Event
- type: BasicStationEventScheduler
minMaxEventTiming: # DeltaV
min: 300 # DeltaV - 5 mins, was 3
Expand All @@ -320,7 +320,7 @@
id: SpaceTrafficControlEventScheduler # iff we make a selector for EntityTables that can respect StationEventComp restrictions, or somehow impliment them otherwise in said tables,
parent: BaseGameRule # we can remerge this with the other schedulers, but it will silently fail due to that limitation without a separate scheduler to balance atm.
components:
- type: NextEvent # Deltav
- type: NextEvent # DeltaV: Queue Event
- type: BasicStationEventScheduler
minimumTimeUntilFirstEvent: 2700 # 45 mins #shows up like half way through shift.
minMaxEventTiming:
Expand All @@ -333,7 +333,7 @@
id: SpaceTrafficControlFriendlyEventScheduler
parent: BaseGameRule
components:
- type: NextEvent # Deltav
- type: NextEvent # DeltaV: Queue Event
- type: BasicStationEventScheduler
minimumTimeUntilFirstEvent: 1200 # 20 mins
minMaxEventTiming:
Expand Down

0 comments on commit 64d873e

Please sign in to comment.