* simple expedition generation * add simple test key * expedition map component * some funny procedural testing * refactor expeditions from planetbiome to islanddungeons * some work * fix: grid dungeon, not map planet dungeon * unhardcode map components * finish T1 expedition generation * Update preset.yml * indestructable stone * mob water occlusion * caves T1 expedition * Update CP14SpawnExpeditionJob.cs * Delete shared MissionParams * rename to demiplans * pass mapid into job * demiplan connections * demiplan exits * random entry points * Update config.yml * some cleanup and renaming * radius one-time teleport * rename connections to exitPoint * merge entry and exit point into rift component * demipan closing - all rifts deletion * demiplanEEEEEE * fixes * delete floating visuals * Update CP14DemiplaneTravelingSystem.cs * intro and outro demiplan music * rift cores and flashing * pulling support * pulling fix + generatordata fix? * auto destrot demiplans??
77 lines
2.3 KiB
C#
77 lines
2.3 KiB
C#
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared._CP14.DayCycle.Components;
|
|
|
|
/// <summary>
|
|
/// Stores all the necessary data for the day and night cycle system to work.
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(CP14SharedDayCycleSystem))]
|
|
public sealed partial class CP14DayCycleComponent : Component
|
|
{
|
|
[ViewVariables]
|
|
public int NextTimeEntryIndex => CurrentTimeEntryIndex + 1 >= TimeEntries.Count ? 0 : CurrentTimeEntryIndex + 1;
|
|
|
|
[ViewVariables]
|
|
public DayCycleEntry CurrentTimeEntry => TimeEntries[CurrentTimeEntryIndex];
|
|
|
|
[ViewVariables]
|
|
public DayCycleEntry NextCurrentTimeEntry => TimeEntries[NextTimeEntryIndex];
|
|
|
|
[ViewVariables]
|
|
public Color StartColor => CurrentTimeEntry.Color;
|
|
|
|
[ViewVariables]
|
|
public Color EndColor => NextCurrentTimeEntry.Color;
|
|
|
|
[ViewVariables]
|
|
public ProtoId<CP14DayCyclePeriodPrototype> CurrentPeriod => CurrentTimeEntry.Period;
|
|
|
|
[DataField(required: true), ViewVariables, AutoNetworkedField]
|
|
public List<DayCycleEntry> TimeEntries = new();
|
|
|
|
[DataField, ViewVariables, AutoNetworkedField]
|
|
public int CurrentTimeEntryIndex;
|
|
|
|
[DataField, ViewVariables, AutoNetworkedField]
|
|
public TimeSpan EntryStartTime;
|
|
|
|
[DataField, ViewVariables, AutoNetworkedField]
|
|
public TimeSpan EntryEndTime;
|
|
|
|
[DataField]
|
|
public bool StartWithRandomEntry = true;
|
|
}
|
|
|
|
[DataDefinition, NetSerializable, Serializable]
|
|
public readonly partial record struct DayCycleEntry()
|
|
{
|
|
public DayCycleEntry(Color _color, TimeSpan _duration, string _period) : this()
|
|
{
|
|
Color = _color;
|
|
Duration = _duration;
|
|
Period = _period;
|
|
}
|
|
/// <summary>
|
|
/// The color of the world's lights at the beginning of this time of day
|
|
/// </summary>
|
|
[DataField]
|
|
public Color Color { get; init; } = Color.White;
|
|
|
|
/// <summary>
|
|
/// Duration of color shift to the next time of day
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan Duration { get; init; } = TimeSpan.FromSeconds(60);
|
|
|
|
[DataField]
|
|
public ProtoId<CP14DayCyclePeriodPrototype> Period { get; init; } = "Day";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event raised on map entity, wen day cycle changed.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct DayCycleChangedEvent(DayCycleEntry Entry);
|