Gateway destinations (#21040)

* Gateway generation

* Gateway stuff

* gatewehs

* mercenaries

* play area

* Range fixes and tweaks

* weh

* Gateway UI polish

* Lots of fixes

* Knock some items off

* Fix dungeon spawning

Realistically we should probably be using a salvage job.

* wahwah

* wehvs

* expression

* weh

* eee

* a

* a

* WEH

* frfr

* Gatwey

* Fix gateway windows

* Fix gateway windows

* a

* a

* Better layer masking

* a

* a

* Noise fixes

* a

* Fix fractal calculations

* a

* More fixes

* Fixes

* Add layers back in

* Fixes

* namespaces and ftl

* Other TODO

* Fix distance

* Cleanup

* Fix test
This commit is contained in:
metalgearsloth
2023-11-15 13:23:40 +11:00
committed by GitHub
parent 67a3c3a6a3
commit 816ee2e1ab
51 changed files with 1562 additions and 959 deletions

View File

@@ -1,6 +1,7 @@
using Content.Server.Gateway.Systems;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Utility;
namespace Content.Server.Gateway.Components;
@@ -10,6 +11,25 @@ namespace Content.Server.Gateway.Components;
[RegisterComponent, Access(typeof(GatewaySystem))]
public sealed partial class GatewayComponent : Component
{
/// <summary>
/// Whether this destination is shown in the gateway ui.
/// If you are making a gateway for an admeme set this once you are ready for players to select it.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Enabled;
/// <summary>
/// Can the gateway be interacted with? If false then only settable via admins / mappers.
/// </summary>
[DataField]
public bool Interactable = true;
/// <summary>
/// Name as it shows up on the ui of station gateways.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FormattedMessage Name = new();
/// <summary>
/// Sound to play when opening the portal.
/// </summary>
@@ -32,24 +52,14 @@ public sealed partial class GatewayComponent : Component
public SoundSpecifier AccessDeniedSound = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
/// <summary>
/// Every other gateway destination on the server.
/// Cooldown between opening portal / closing.
/// </summary>
/// <remarks>
/// Added on startup and when a new destination portal is created.
/// </remarks>
[DataField]
public HashSet<EntityUid> Destinations = new();
public TimeSpan Cooldown = TimeSpan.FromSeconds(30);
/// <summary>
/// The time at which the portal will be closed.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextClose;
/// <summary>
/// The time at which the portal was last opened.
/// Only used for UI.
/// The time at which the portal can next be opened.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan LastOpen;
public TimeSpan NextReady;
}

View File

@@ -1,48 +0,0 @@
using Content.Server.Gateway.Systems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Gateway.Components;
/// <summary>
/// A gateway destination linked to by station gateway(s).
/// </summary>
[RegisterComponent, Access(typeof(GatewaySystem))]
public sealed partial class GatewayDestinationComponent : Component
{
/// <summary>
/// Whether this destination is shown in the gateway ui.
/// If you are making a gateway for an admeme set this once you are ready for players to select it.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Enabled;
/// <summary>
/// Name as it shows up on the ui of station gateways.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string Name = string.Empty;
/// <summary>
/// Time at which this destination is ready to be linked to.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextReady;
/// <summary>
/// How long the portal will be open for after linking.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan OpenTime = TimeSpan.FromSeconds(600);
/// <summary>
/// How long the destination is not ready for after the portal closes.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Cooldown = TimeSpan.FromSeconds(60);
/// <summary>
/// If true, the portal can be closed by alt clicking it.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Closeable;
}

View File

@@ -0,0 +1,68 @@
using Content.Shared.Parallax.Biomes.Markers;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Gateway.Components;
/// <summary>
/// Generates gateway destinations at a regular interval.
/// </summary>
[RegisterComponent]
public sealed partial class GatewayGeneratorComponent : Component
{
/// <summary>
/// Prototype to spawn on the generated map if applicable.
/// </summary>
[DataField]
public EntProtoId? Proto = "Gateway";
/// <summary>
/// Next time another seed unlocks.
/// </summary>
[DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextUnlock;
/// <summary>
/// How long it takes to unlock another destination once one is taken.
/// </summary>
[DataField]
public TimeSpan UnlockCooldown = TimeSpan.FromMinutes(45);
/// <summary>
/// Maps we've generated.
/// </summary>
[DataField]
public List<EntityUid> Generated = new();
[DataField]
public int MobLayerCount = 1;
/// <summary>
/// Mob layers to pick from.
/// </summary>
[DataField]
public List<ProtoId<BiomeMarkerLayerPrototype>> MobLayers = new()
{
"Carps",
"Xenos",
};
[DataField]
public int LootLayerCount = 3;
/// <summary>
/// Loot layers to pick from.
/// </summary>
public List<ProtoId<BiomeMarkerLayerPrototype>> LootLayers = new()
{
"OreTin",
"OreQuartz",
"OreGold",
"OreSilver",
"OrePlasma",
"OreUranium",
"OreBananium",
"OreArtifactFragment",
};
}

View File

@@ -0,0 +1,37 @@
namespace Content.Server.Gateway.Components;
/// <summary>
/// Destination created by <see cref="GatewayGeneratorComponent"/>
/// </summary>
[RegisterComponent]
public sealed partial class GatewayGeneratorDestinationComponent : Component
{
/// <summary>
/// Generator that created this destination.
/// </summary>
[DataField]
public EntityUid Generator;
/// <summary>
/// Is the map locked from being used still or unlocked.
/// Used in conjunction with the attached generator's NextUnlock.
/// </summary>
[DataField]
public bool Locked = true;
[DataField]
public bool Loaded;
/// <summary>
/// Seed used for this destination.
/// </summary>
[DataField]
public int Seed;
/// <summary>
/// Origin of the gateway.
/// </summary>
[DataField]
public Vector2i Origin;
}