Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
blackknight954 authored Nov 1, 2024
2 parents 3044eb9 + 7aa4e12 commit 9c6023f
Show file tree
Hide file tree
Showing 42 changed files with 1,359 additions and 475 deletions.
22 changes: 8 additions & 14 deletions Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Robust.Shared.Map;
using Robust.Shared.Random;
using Robust.Shared.Audio;
using Content.Shared.Mind.Components; // Frontier

namespace Content.Server.Cargo.Systems;

Expand Down Expand Up @@ -319,15 +320,14 @@ private void GetPalletGoods(EntityUid consoleUid, EntityUid gridUid, out HashSet

private bool CanSell(EntityUid uid, TransformComponent xform)
{
if (_mobQuery.HasComponent(uid))
{
if (_mobQuery.GetComponent(uid).CurrentState == MobState.Alive)
{
return false;
}
// Frontier: Look for blacklisted items and stop the selling of the container.
if (_blacklistQuery.HasComponent(uid))
return false;

return true;
}
// Frontier: allow selling dead mobs
if (_mobQuery.TryComp(uid, out var mob) && mob.CurrentState != MobState.Dead)
return false;
// End Frontier

var complete = IsBountyComplete(uid, out var bountyEntities);

Expand All @@ -342,12 +342,6 @@ private bool CanSell(EntityUid uid, TransformComponent xform)
return false;
}

// Look for blacklisted items and stop the selling of the container.
if (_blacklistQuery.HasComponent(uid))
{
return false;
}

return true;
}

Expand Down
43 changes: 43 additions & 0 deletions Content.Server/StationEvents/Components/StationEventComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.Radio; // Frontier
using Content.Shared.Roles; // Frontier
using Robust.Shared.Audio;
using Robust.Shared.Prototypes; // Frontier
Expand All @@ -23,21 +24,51 @@ public sealed partial class StationEventComponent : Component
[DataField]
public string? StartAnnouncement;

[DataField]
public string? WarningAnnouncement; // Frontier

[DataField]
public string? EndAnnouncement;

[DataField]
public Color StartAnnouncementColor = Color.Gold;

[DataField]
public Color WarningAnnouncementColor = Color.Gold; // Frontier

[DataField]
public Color EndAnnouncementColor = Color.Gold;

[DataField]
public SoundSpecifier? StartAudio;

[DataField]
public SoundSpecifier? WarningAudio; // Frontier

[DataField]
public SoundSpecifier? EndAudio;

/// <summary>
/// Frontier: Radio channels on which announcements are transmitted
/// </summary>
[DataField]
public string? StartRadioAnnouncement; // Frontier

[DataField]
public string? WarningRadioAnnouncement; // Frontier

[DataField]
public string? EndRadioAnnouncement; // Frontier

[DataField]
public ProtoId<RadioChannelPrototype> StartRadioAnnouncementChannel = "Supply"; // Frontier

[DataField]
public ProtoId<RadioChannelPrototype> WarningRadioAnnouncementChannel = "Supply"; // Frontier

[DataField]
public ProtoId<RadioChannelPrototype> EndRadioAnnouncementChannel = "Supply"; // Frontier

/// <summary>
/// In minutes, when is the first round time this event can start
/// </summary>
Expand Down Expand Up @@ -101,4 +132,16 @@ public sealed partial class StationEventComponent : Component
/// </summary>
[DataField]
public Dictionary<ProtoId<JobPrototype>, int> RequiredJobs = new();

/// <summary>
/// Frontier: Warning timer.
/// </summary>
[DataField]
public int WarningDurationLeft = 300; // 5 minutes

/// <summary>
/// Frontier: True if the warning has already been sent off.
/// </summary>
[DataField]
public bool WarningAnnounced;
}
20 changes: 20 additions & 0 deletions Content.Server/StationEvents/Events/StationEventSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.Radio.EntitySystems; // Frontier
using Content.Server.Station.Systems;
using Content.Server.StationEvents.Components;
using Content.Shared.Database;
Expand All @@ -22,6 +23,7 @@ public abstract class StationEventSystem<T> : GameRuleSystem<T> where T : ICompo
[Dependency] protected readonly ChatSystem ChatSystem = default!;
[Dependency] protected readonly SharedAudioSystem Audio = default!;
[Dependency] protected readonly StationSystem StationSystem = default!;
[Dependency] protected readonly RadioSystem RadioSystem = default!; // Frontier

protected ISawmill Sawmill = default!;

Expand All @@ -48,6 +50,9 @@ protected override void Added(EntityUid uid, T component, GameRuleComponent game
if (stationEvent.StartAnnouncement != null)
ChatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(stationEvent.StartAnnouncement), playSound: false, colorOverride: stationEvent.StartAnnouncementColor);

if (stationEvent.StartRadioAnnouncement != null) // Frontier
RadioSystem.SendRadioMessage(uid, stationEvent.StartRadioAnnouncement, stationEvent.StartRadioAnnouncementChannel, uid, escapeMarkup: false); // Frontier

Audio.PlayGlobal(stationEvent.StartAudio, allPlayersInGame, true);
}

Expand Down Expand Up @@ -87,6 +92,9 @@ protected override void Ended(EntityUid uid, T component, GameRuleComponent game
if (stationEvent.EndAnnouncement != null)
ChatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(stationEvent.EndAnnouncement), playSound: false, colorOverride: stationEvent.EndAnnouncementColor);

if (stationEvent.EndRadioAnnouncement != null) // Frontier
RadioSystem.SendRadioMessage(uid, stationEvent.EndRadioAnnouncement, stationEvent.EndRadioAnnouncementChannel, uid, escapeMarkup: false); // Frontier

Audio.PlayGlobal(stationEvent.EndAudio, allPlayersInGame, true);
}

Expand All @@ -113,6 +121,18 @@ public override void Update(float frameTime)
{
GameTicker.EndGameRule(uid, ruleData);
}
// Frontier: Added Warning for events ending soon
else if (!stationEvent.WarningAnnounced && stationEvent.EndTime != null && (stationEvent.EndTime.Value - Timing.CurTime).TotalSeconds <= stationEvent.WarningDurationLeft && GameTicker.IsGameRuleActive(uid, ruleData))
{
Filter allPlayersInGame = Filter.Empty().AddWhere(GameTicker.UserHasJoinedGame); // we don't want to send to players who aren't in game (i.e. in the lobby)
if (stationEvent.WarningAnnouncement != null)
ChatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(stationEvent.WarningAnnouncement), playSound: false, colorOverride: stationEvent.WarningAnnouncementColor);
if (stationEvent.WarningRadioAnnouncement != null)
RadioSystem.SendRadioMessage(uid, stationEvent.WarningRadioAnnouncement, stationEvent.WarningRadioAnnouncementChannel, uid, escapeMarkup: false);
Audio.PlayGlobal(stationEvent.WarningAudio, allPlayersInGame, true);
stationEvent.WarningAnnounced = true;
}
// End Frontier
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Server.Worldgen.Systems.Debris;

namespace Content.Server.Worldgen.Components.Debris;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public sealed partial class AdventureRuleComponent : Component
public List<EntityUid> OptionalPois = new();
public List<EntityUid> UniquePois = new();

[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<DungeonConfigPrototype>))]
[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<DungeonConfigPrototype>))] // TODO: Remove this for new system
public List<string> SpaceDungeons = new();
}
1 change: 1 addition & 0 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component,
// Using invalid entity, we don't have a relevant entity to reference here.
RaiseLocalEvent(EntityUid.Invalid, new StationsGeneratedEvent(), broadcast: true); // TODO: attach this to a meaningful entity.

// TODO: Remove this for new system
foreach (var dungeonProto in component.SpaceDungeons)
{
if (!_prototypeManager.TryIndex<DungeonConfigPrototype>(dungeonProto, out var dunGen))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,129 @@
using Content.Server.StationEvents.Events;
using Content.Server.StationEvents.Events;
using Content.Shared.Storage;
using Content.Server.Shuttles.Systems;
using Content.Shared.Dataset;
using Content.Shared.Procedural;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(BluespaceErrorRule))]
[RegisterComponent, Access(typeof(BluespaceErrorRule), typeof(ShuttleSystem))]
public sealed partial class BluespaceErrorRuleComponent : Component
{
/// <summary>
/// List of paths to the grids that can be bluespaced in.
/// Dictionary of groups where each group will have entries selected.
/// String is just an identifier to make yaml easier.
/// </summary>
[DataField("gridPaths")]
public List<string> GridPaths = new();
[DataField(required: true)] public Dictionary<string, IBluespaceSpawnGroup> Groups = new();

/// <summary>
/// The color of your thing. The name should be set by the mapper when mapping.
/// The grid in question, set after starting the event
/// </summary>
[DataField("color")]
public Color Color = new Color(225, 15, 155);
[DataField]
public List<EntityUid> GridsUid = new();

/// <summary>
/// Multiplier to apply to the remaining value of a grid, to be deposited in the station account for defending
/// If true, the grids are deleted at the end of the event. If false, the grids are left in the map.
/// </summary>
[DataField("rewardFactor")]
public float RewardFactor = 0f;
[DataField]
public bool DeleteGridsOnEnd = true;

/// <summary>
/// The grid in question, set after starting the event
/// Multiplier to apply to the remaining value of a grid, to be deposited in the station account for defending the grids.
/// Note:
/// </summary>
[DataField("gridUid")]
public EntityUid? GridUid = null;
[DataField]
public float NfsdRewardFactor = 0f;

/// <summary>
/// How much the grid is appraised at upon entering into existence, set after starting the event
/// </summary>
[DataField("startingValue")]
public double startingValue = 0;
[DataField]
public double StartingValue = 0;
}

public interface IBluespaceSpawnGroup
{
/// <summary>
/// Minimum distance to spawn away from the station.
/// </summary>
public float MinimumDistance { get; }

/// <summary>
/// Maximum distance to spawn away from the station.
/// </summary>
public float MaximumDistance { get; }

/// <inheritdoc />
public List<LocId> NameLoc { get; }

/// <inheritdoc />
public ProtoId<DatasetPrototype>? NameDataset { get; }

/// <inheritdoc />
int MinCount { get; set; }

/// <inheritdoc />
int MaxCount { get; set; }

/// <summary>
/// Components to be added to any spawned grids.
/// </summary>
public ComponentRegistry AddComponents { get; set; }

/// <summary>
/// Should we set the metadata name of a grid. Useful for admin purposes.
/// </summary>
public bool NameGrid { get; set; }
}

[DataRecord]
public sealed class BluespaceDungeonSpawnGroup : IBluespaceSpawnGroup
{
/// <summary>
/// Prototypes we can choose from to spawn.
/// </summary>
public List<ProtoId<DungeonConfigPrototype>> Protos = new();

/// <inheritdoc />
public float MinimumDistance { get; }

public float MaximumDistance { get; }

/// <inheritdoc />
public List<LocId> NameLoc { get; } = new();

/// <inheritdoc />
public ProtoId<DatasetPrototype>? NameDataset { get; }

/// <inheritdoc />
public int MinCount { get; set; } = 1;

/// <inheritdoc />
public int MaxCount { get; set; } = 1;

/// <inheritdoc />
public ComponentRegistry AddComponents { get; set; } = new();

/// <inheritdoc />
public bool NameGrid { get; set; } = false;
}

[DataRecord]
public sealed class BluespaceGridSpawnGroup : IBluespaceSpawnGroup
{
public List<ResPath> Paths = new();

/// <inheritdoc />
public float MinimumDistance { get; }

/// <inheritdoc />
public float MaximumDistance { get; }
public List<LocId> NameLoc { get; } = new();
public ProtoId<DatasetPrototype>? NameDataset { get; }
public int MinCount { get; set; } = 1;
public int MaxCount { get; set; } = 1;
public ComponentRegistry AddComponents { get; set; } = new();
public bool NameGrid { get; set; } = true;
}
Loading

0 comments on commit 9c6023f

Please sign in to comment.