Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bus Routes #2852

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public override void Init()
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider");
_prototypeManager.RegisterIgnore("gasDeposit"); // Frontier
_prototypeManager.RegisterIgnore("pointOfInterest"); // Frontier: worldgen-related, server-only
_prototypeManager.RegisterIgnore("publicTransitRoute"); // Frontier: worldgen-related, server-only

_componentFactory.GenerateNetIds();
_adminManager.Initialize();
Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public sealed class PostMapInitTest
// Admin
"/Maps/_NF/Shuttles/Admin/fishbowl.yml",
// Bus
"/Maps/_NF/Shuttles/Bus/publicts.yml",
"/Maps/_NF/Shuttles/Bus/cheetah.yml",
};

private static readonly string[] GameMaps = FrontierConstants.GameMapPrototypes; // Frontier: not inline constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public sealed partial class ShuttleSystem
/// <summary>
/// Space between grids within hyperspace.
/// </summary>
private const float Buffer = 5f;
private const float Buffer = 500f; // Frontier: 5 < 500

/// <summary>
/// How many times we try to proximity warp close to something before falling back to map-wideAABB.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._NF.PublicTransit.Components;

/// <summary>
/// A component that adds all existing bus routes to this station.
/// </summary>
[RegisterComponent, Access(typeof(PublicTransitSystem))]
public sealed partial class StationBusDepotComponent : Component;
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
using Content.Server._NF.PublicTransit.Prototypes;
using Robust.Shared.Prototypes;

namespace Content.Server._NF.PublicTransit.Components;

/// <summary>
/// Added to a station that is available for public transit.
/// Added to a grid that is stopped at by public transit.
/// </summary>
[RegisterComponent, Access(typeof(PublicTransitSystem))]
public sealed partial class StationTransitComponent : Component
{
/// <summary>
/// The list of routes that will service this station and the relative stop order along that route.
/// Stops are ordered in increasing value (lower numbers, earlier on the list)
/// </summary>
[DataField]
public Dictionary<ProtoId<PublicTransitRoutePrototype>, int> Routes = new();
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Server._NF.PublicTransit.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server._NF.PublicTransit.Components;
Expand All @@ -7,18 +9,19 @@ namespace Content.Server._NF.PublicTransit.Components;
/// Public Transit system will add this procedurally to any grid designated as a 'bus' through the CVAR
/// Mappers may add it to their shuttle if they wish, but this is going to force it's use and function as a public transit bus
/// </summary>
[RegisterComponent, Access(typeof(PublicTransitSystem))]
[RegisterComponent, Access(typeof(PublicTransitSystem)), AutoGenerateComponentPause]
public sealed partial class TransitShuttleComponent : Component
{
/// <summary>
/// The name for the bus
/// </summary>
[DataField]
public LocId Name = "public-transit-shuttle-name";
public EntityUid CurrentGrid;

[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextTransfer;

[DataField]
public EntityUid NextStation;
public string? DockTag;

[DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextTransfer;
[DataField]
public ProtoId<PublicTransitRoutePrototype> RouteID;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Shared._NF.Shipyard.Prototypes;
using Robust.Shared.Prototypes;

namespace Content.Server._NF.PublicTransit.Prototypes;

[Prototype]
public sealed partial class PublicTransitRoutePrototype : IPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;

/// <summary>
/// Bus route number. Buses will receive this name.
/// </summary>
[DataField(required: true)]
public int RouteNumber { get; private set; } = default!;

/// <summary>
/// The number of stations to spawn an additional bus on this route. Non-positive numbers will imply there is only one bus on the route.
/// </summary>
[DataField]
public int StationsPerBus { get; private set; } = 0;

/// <summary>
/// The amount of time to spend in FTL between stations.
/// </summary>
[DataField]
public TimeSpan TravelTime { get; private set; } = TimeSpan.FromSeconds(80);

/// <summary>
/// The amount of time to spend in FTL between stations.
/// </summary>
[DataField]
public TimeSpan WaitTime { get; private set; } = TimeSpan.FromSeconds(60);

/// <summary>
/// The string to use as a dock tag.
/// </summary>
[DataField]
public string? DockTag { get; private set; } = null;

/// <summary>
/// The
/// </summary>
[DataField]
public EntProtoId? SignEntity { get; private set; } = null;

/// <summary>
/// The bus type to spawn on this route.
/// </summary>
[DataField(required: true)]
public ProtoId<VesselPrototype> BusVessel { get; private set; } = default!;
}
Loading