Skip to content

Commit

Permalink
Merge branch 'master' into 2024-11-22-AjustedMerc
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 authored Jan 4, 2025
2 parents d9dc7a8 + 079c63c commit 8acc34b
Show file tree
Hide file tree
Showing 437 changed files with 6,104 additions and 2,325 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class GuidebookUIController : UIController, IOnStateEntered<LobbyS
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly JobRequirementsManager _jobRequirements = default!;

private const int PlaytimeOpenGuidebook = 60;
private const int PlaytimeOpenGuidebook = 180; // Frontier 60<180

private GuidebookWindow? _guideWindow;
private MenuButton? GuidebookButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.GuidebookButton;
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers; // Frontier
using Content.Server.Cargo.Systems; // Frontier
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Ghost.Components;
Expand Down Expand Up @@ -93,6 +94,7 @@ public override void Initialize()
SubscribeLocalEvent<GhostComponent, BooActionEvent>(OnActionPerform);
SubscribeLocalEvent<GhostComponent, ToggleGhostHearingActionEvent>(OnGhostHearingAction);
SubscribeLocalEvent<GhostComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
SubscribeLocalEvent<GhostComponent, PriceCalculationEvent>(OnPriceCalculation); // Frontier

SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
SubscribeLocalEvent<ToggleGhostVisibilityToAllEvent>(OnToggleGhostVisibilityToAll);
Expand Down Expand Up @@ -592,6 +594,14 @@ public bool OnGhostAttempt(EntityUid mindId, bool canReturnGlobal, bool viaComma

return true;
}

// Frontier: worthless ghosts
private void OnPriceCalculation(Entity<GhostComponent> ent, ref PriceCalculationEvent args)
{
args.Price = 0;
args.Handled = true;
}
// End Frontier
}

public sealed class GhostAttemptHandleEvent(MindComponent mind, bool canReturnGlobal) : HandledEntityEventArgs
Expand Down
10 changes: 0 additions & 10 deletions Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using Content.Server.StationRecords.Systems;
using Content.Shared.Database;
using Content.Shared.Preferences;
using Content.Shared.Shuttles.Components;
using static Content.Shared.Shipyard.Components.ShuttleDeedComponent;
using Content.Server.Shuttles.Components;
using Content.Server.Station.Components;
Expand All @@ -38,7 +37,6 @@
using Content.Shared.UserInterface;
using Robust.Shared.Audio.Systems;
using Content.Shared.Access;
using Content.Shared.Tiles;
using Content.Server._NF.Smuggling.Components;
using Content.Shared._NF.ShuttleRecords;
using Content.Server.StationEvents.Components;
Expand Down Expand Up @@ -203,14 +201,6 @@ private void OnPurchaseMessage(EntityUid shipyardConsoleUid, ShipyardConsoleComp
shuttleStation = _station.InitializeNewStation(stationProto.Stations[vessel.ID], gridUids);
var metaData = MetaData((EntityUid)shuttleStation);
name = metaData.EntityName;
_shuttle.SetIFFColor(shuttleUid, new Color
{
R = 10,
G = 50,
B = 100,
A = 100
});
_shuttle.AddIFFFlag(shuttleUid, IFFFlags.IsPlayerShuttle);
}

if (TryComp<AccessComponent>(targetId, out var newCap))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Server._NF.Shuttles.Components; // Frontier: NPC knockdown immunity
using Content.Server._NF.Shuttles.Components; // Frontier: FTL knockdown immunity
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Events;
Expand Down Expand Up @@ -637,11 +637,9 @@ private void DoTheDinosaur(TransformComponent xform)
{
if (!_statusQuery.TryGetComponent(child, out var status))
continue;

if (HasComp<FTLKnockdownImmuneComponent>(child)) // Frontier: NPC knockdown immunity
continue; // Frontier: NPC knockdown immunity

_stuns.TryParalyze(child, _hyperspaceKnockdownTime, true, status);
if (!HasComp<FTLKnockdownImmuneComponent>(child)) // Frontier: FTL knockdown immunity
_stuns.TryParalyze(child, _hyperspaceKnockdownTime, true, status);

// If the guy we knocked down is on a spaced tile, throw them too
if (grid != null)
Expand Down
32 changes: 32 additions & 0 deletions Content.Server/_CD/Engraving/EngraveableComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Content.Server._CD.Engraving;

/// <summary>
/// Allows an items' description to be modified with an engraving
/// </summary>
[RegisterComponent, Access(typeof(EngraveableSystem))]
public sealed partial class EngraveableComponent : Component
{
/// <summary>
/// Message given to user to notify them a message was sent
/// </summary>
[DataField]
public string EngravedMessage = string.Empty;

/// <summary>
/// The inspect text to use when there is no engraving
/// </summary>
[DataField]
public LocId NoEngravingText = "engraving-generic-no-message"; // Frontier: "dogtags"<"generic"

/// <summary>
/// The message to use when successfully engraving the item
/// </summary>
[DataField]
public LocId EngraveSuccessMessage = "engraving-generic-succeed"; // Frontier: "dogtags"<"generic"

/// <summary>
/// The inspect text to use when there is an engraving. The message will be shown seperately afterwards.
/// </summary>
[DataField]
public LocId HasEngravingText = "engraving-generic-has-message"; // Frontier: "dogtags"<"generic"
}
83 changes: 83 additions & 0 deletions Content.Server/_CD/Engraving/EngraveableSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using Content.Server.Administration;
using Content.Server.Administration.Logs;
using Content.Server.Popups;
using Content.Shared.Database;
using Content.Shared.Popups;
using Content.Shared.Examine;
using Content.Shared.Verbs;
using Robust.Shared.Player;
using Robust.Shared.Utility;

namespace Content.Server._CD.Engraving;

public sealed class EngraveableSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly QuickDialogSystem _dialog = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<EngraveableComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<EngraveableComponent, GetVerbsEvent<ActivationVerb>>(AddEngraveVerb);
}

private void OnExamined(Entity<EngraveableComponent> ent, ref ExaminedEvent args)
{
var msg = new FormattedMessage();
// Frontier: don't localize the message, use args in fluent entries
if (ent.Comp.EngravedMessage == string.Empty)
msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.NoEngravingText, ("object", ent)));
else
msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.HasEngravingText, ("object", ent), ("message", ent.Comp.EngravedMessage)));
// End Frontier

args.PushMessage(msg, 1);
}

private void AddEngraveVerb(Entity<EngraveableComponent> ent, ref GetVerbsEvent<ActivationVerb> args)
{
// First check if it's already been engraved. If it has, don't let them do it again.
if (ent.Comp.EngravedMessage != string.Empty)
return;

// We need an actor to give the verb.
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

// Make sure ghosts can't engrave stuff.
if (!args.CanInteract)
return;

var engraveVerb = new ActivationVerb
{
Text = Loc.GetString("engraving-verb-engrave"),
Act = () =>
{
_dialog.OpenDialog(actor.PlayerSession,
Loc.GetString("engraving-verb-engrave"),
Loc.GetString("engraving-popup-ui-message"),
(string message) =>
{
// If either the actor or comp have magically vanished
if (actor.PlayerSession.AttachedEntity == null || !HasComp<EngraveableComponent>(ent))
return;

ent.Comp.EngravedMessage = message;
_popup.PopupEntity(Loc.GetString(ent.Comp.EngraveSuccessMessage, ("object", ent)), // Frontier: add object argument
actor.PlayerSession.AttachedEntity.Value,
actor.PlayerSession,
PopupType.Medium);
_adminLogger.Add(LogType.Action,
LogImpact.Low,
$"{ToPrettyString(actor.PlayerSession.AttachedEntity):player} engraved an item with message: {message}");
});
},
Impact = LogImpact.Low,
};
engraveVerb.Impact = LogImpact.Low;
args.Verbs.Add(engraveVerb);
}
}
42 changes: 26 additions & 16 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Content.Server._NF.Bank;
using Content.Server._NF.GameRule.Components;
using Content.Server._NF.GameTicking.Events;
using Content.Shared.GameTicking.Components;
using Robust.Shared.Prototypes;
using Content.Server.Cargo.Components;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules;
using Content.Shared._NF.CCVar; // Frontier
using Robust.Shared.Configuration;
using Content.Shared._NF.Bank;
using Content.Server._NF.GameRule.Components;
using Content.Server._NF.Bank;
using Robust.Shared.Player;
using Robust.Shared.Network;
using Content.Shared._NF.CCVar;
using Content.Shared.GameTicking;
using Robust.Shared.Enums;
using Content.Shared.GameTicking.Components;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Server._NF.GameRule;

Expand All @@ -28,14 +29,17 @@ namespace Content.Server._NF.GameRule;
/// </summary>
public sealed class NFAdventureRuleSystem : GameRuleSystem<NFAdventureRuleComponent>
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly BankSystem _bank = default!;
[Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly PointOfInterestSystem _poi = default!;

private readonly HttpClient _httpClient = new();

private readonly ProtoId<GamePresetPrototype> _fallbackPresetID = "NFPirates";

public sealed class PlayerRoundBankInformation
{
// Initial balance, obtained on spawn
Expand Down Expand Up @@ -68,7 +72,7 @@ public override void Initialize()
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawningEvent);
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetachedEvent);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
_playerManager.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged;
_player.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged;
}

protected override void AppendRoundEndText(EntityUid uid, NFAdventureRuleComponent component, GameRuleComponent gameRule, ref RoundEndTextAppendEvent ev)
Expand Down Expand Up @@ -196,8 +200,14 @@ protected override void Started(EntityUid uid, NFAdventureRuleComponent componen
List<PointOfInterestPrototype> optionalProtos = new();
Dictionary<string, List<PointOfInterestPrototype>> remainingUniqueProtosBySpawnGroup = new();

foreach (var location in _prototypeManager.EnumeratePrototypes<PointOfInterestPrototype>())
var currentPreset = _ticker.CurrentPreset?.ID ?? _fallbackPresetID;

foreach (var location in _proto.EnumeratePrototypes<PointOfInterestPrototype>())
{
// Check if any preset is accepted (empty) or if current preset is supported.
if (location.SpawnGamePreset.Length > 0 && !location.SpawnGamePreset.Contains(currentPreset))
continue;

if (location.SpawnGroup == "CargoDepot")
depotProtos.Add(location);
else if (location.SpawnGroup == "MarketStation")
Expand Down Expand Up @@ -228,7 +238,7 @@ protected override void Started(EntityUid uid, NFAdventureRuleComponent componen
private async Task ReportRound(string message, int color = 0x77DDE7)
{
Logger.InfoS("discord", message);
string webhookUrl = _configurationManager.GetCVar(NFCCVars.DiscordLeaderboardWebhook);
string webhookUrl = _cfg.GetCVar(NFCCVars.DiscordLeaderboardWebhook);
if (webhookUrl == string.Empty)
return;

Expand All @@ -249,7 +259,7 @@ private async Task ReportRound(string message, int color = 0x77DDE7)

private async Task ReportLedger(int color = 0xBF863F)
{
string webhookUrl = _configurationManager.GetCVar(NFCCVars.DiscordLeaderboardWebhook);
string webhookUrl = _cfg.GetCVar(NFCCVars.DiscordLeaderboardWebhook);
if (webhookUrl == string.Empty)
return;

Expand Down
14 changes: 12 additions & 2 deletions Content.Server/_NF/GameRule/PointOfInterestPrototype.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
using Content.Server.GameTicking.Presets;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Utility;

namespace Content.Server._NF.GameRule;

/// <summary>
/// Describes information for a single point of interest to be spawned in the world
/// </summary>
[Prototype("pointOfInterest")]
[Prototype]
[Serializable]
public sealed partial class PointOfInterestPrototype : IPrototype
public sealed partial class PointOfInterestPrototype : IPrototype, IInheritingPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;

[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<PointOfInterestPrototype>))]
public string[]? Parents { get; private set; }

[NeverPushInheritance]
[AbstractDataField]
public bool Abstract { get; private set; }

/// <summary>
/// The name of this point of interest
/// </summary>
Expand Down Expand Up @@ -48,10 +56,12 @@ public sealed partial class PointOfInterestPrototype : IPrototype
/// Components to be added to any spawned grids.
/// </summary>
[DataField]
[AlwaysPushInheritance]
public ComponentRegistry AddComponents { get; set; } = new();

/// <summary>
/// What gamepresets ID this POI is allowed to spawn on.
/// If left empty, all presets are allowed.
/// </summary>
[DataField]
public ProtoId<GamePresetPrototype>[] SpawnGamePreset { get; private set; } = [];
Expand Down
Loading

0 comments on commit 8acc34b

Please sign in to comment.