Skip to content

Commit

Permalink
Fix The Game 🎉 (#130)
Browse files Browse the repository at this point in the history
# TODO

- [x] Give Boxers no shirt/socks
- [x] Bring back the good roundend sounds (currently I chose a couple of
the new ones that I thought were *okay*)

# Changelog

:cl:
- fix: Prescription glasses won't be given to people who aren't
nearsighted
- fix: Cabbages and Science crates won't sell for more than they cost
- fix: Chargers won't give you the wrong circuit board when
deconstructed
- fix: Power outage will send an announcement when complete
- fix: Shadowkin plushies are no longer pacified
- fix: Happy Honk boxes should have items in them now
- fix: Spells make you speak again
- fix: Chemistry guidebookbook works
- fix: Bluespace crystals use item space properly
- fix: Round end announcements work
  • Loading branch information
DEATHB4DEFEAT authored Oct 5, 2023
1 parent 190ee20 commit b0db4a2
Show file tree
Hide file tree
Showing 87 changed files with 342 additions and 27,972 deletions.
12 changes: 1 addition & 11 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,9 @@ public sealed class PostMapInitTest

private static readonly string[] GameMaps =
{
"Angle",
"Arena",
"CentComm",
"Dev",
"Glacier",
"Hammurabi",
"Lighthouse",
"Northway",
"Ovni",
"Pebble",
"Shoukou",
"TheHive",
"Tortuga",
"ParkStation",
};

/// <summary>
Expand Down
48 changes: 42 additions & 6 deletions Content.IntegrationTests/Tests/PrototypeSaveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,51 @@ public sealed class PrototypeSaveTest
// Don't add to this list unless you have a good reason
// Or it is just temporary because tests stopped working and now master has too many broken entities.

// Sorry, I'm adding to the list :)
"ClothingOuterPurpleCoat",
"MagicMedipen",
"Sleeper",
// TODO: I don't want to figure out what's wrong with these right now - Death
"SleeperPod",
"SleeperParty",
"SurveillanceCameraService",
"BenchParkMiddle",
"MobRevenant",
"SurveillanceCameraEngineering",
"ChairCarp",
"SurveillanceCameraConstructed",
"BenchParkRight",
"SiliconChargerIndustrial",
"Sleeper",
"SurveillanceCameraGeneral",
"BenchSofaCorpLeft",
"BenchSofaMiddle",
"WeaponFlamethrower",
"SurveillanceCameraCommand",
"BenchSofaCorpCorner",
"BenchPewLeft",
"BenchParkBambooMiddle",
"SleeperClockwork",
"ChairBrass",
"BenchSteelMiddle",
"BenchParkBambooLeft",
"SurveillanceCameraSecurity",
"BenchSteelLeft",
"BenchPewRight",
"BenchParkLeft",
"ClothingOuterPurpleCoat",
"BenchSteelWhiteMiddle",
"BenchSteelWhiteRight",
"BenchSofaCorner",
"SleeperParty",
"SurveillanceCameraScience",
"BenchSofaLeft",
"BenchPewMiddle",
"BenchSofaCorpRight",
"BenchSteelRight",
"BenchSteelWhiteLeft",
"BenchSofaRight",
"BenchParkBambooRight",
"SurveillanceCameraMedical",
"SurveillanceCameraSupply",
"SleeperSyndicate",
"WeaponFlamethrower",
"BenchSofaCorpMiddle",
"MobObserverTelegnostic",
};

[Test]
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Administration/UI/AdminAnnounceEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public sealed class AdminAnnounceEui : BaseEui
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
private readonly AnnouncerSystem _announcerSystem;
private readonly AnnouncerSystem _announcerSystem; // Parkstation-RandomAnnouncers
private readonly ChatSystem _chatSystem;

public AdminAnnounceEui()
{
IoCManager.InjectDependencies(this);
_chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
_announcerSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AnnouncerSystem>();
_announcerSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AnnouncerSystem>(); // Parkstation-RandomAnnouncers
}

public override void Opened()
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/AlertLevel/AlertLevelSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class AlertLevelSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!; // Parkstation-RandomAnnouncers
[Dependency] private readonly IConfigurationManager _cfg = default!;

// Until stations are a prototype, this is how it's going to have to be.
Expand Down Expand Up @@ -173,6 +173,7 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
// var playDefault = false;
if (playSound)
{
// Parkstation-RandomAnnouncers Start
// if (detail.Sound != null)
// {
// var filter = _stationSystem.GetInOwningStation(station);
Expand All @@ -184,14 +185,17 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
// }

_announcerSystem.SendAnnouncementAudio($"alert{level}", _stationSystem.GetInOwningStation(station));
// Parkstation-RandomAnnouncers End
}

if (announce)
{
// Parkstation-RandomAnnouncers Start
// _chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault,
// colorOverride: detail.Color, sender: stationName);

_announcerSystem.SendAnnouncementMessage($"alert{level}", announcementFull, stationName, detail.Color, station);
// Parkstation-RandomAnnouncers End
}

RaiseLocalEvent(new AlertLevelChangedEvent(station, level));
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public sealed class CommunicationsConsoleSystem : EntitySystem
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!; // Parkstation-RandomAnnouncers
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;

private const int MaxMessageLength = 256;
Expand Down Expand Up @@ -273,16 +273,20 @@ private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent com
msg += "\n" + Loc.GetString("comms-console-announcement-sent-by") + " " + author;
if (comp.AnnounceGlobal)
{
// Parkstation-RandomAnnouncers Start
// _chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.AnnouncementSound, colorOverride: comp.AnnouncementColor);
_announcerSystem.SendAnnouncement("announce", Filter.Broadcast(), msg, title, comp.AnnouncementColor);
// Parkstation-RandomAnnouncers End

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following global announcement: {msg}");

return;
}
// Parkstation-RandomAnnouncers Start
// _chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
_announcerSystem.SendAnnouncement("announce", Filter.Broadcast(), msg, title, comp.AnnouncementColor);
// Parkstation-RandomAnnouncers End

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following station announcement: {msg}");
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Entry/IgnoredComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public static class IgnoredComponents
"ItemStatus",
"Marker",
"GuidebookControlsTest",
"GuidebookBook",
"GuideHelp",
"Clickable",
"Icon",
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/GameTicking/GameTicker.RoundFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Content.Server.GameTicking
public sealed partial class GameTicker
{
[Dependency] private readonly ITaskManager _taskManager = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!; // Parkstation-RandomAnnouncers

private static readonly Counter RoundNumberMetric = Metrics.CreateCounter(
"ss14_round_number",
Expand Down Expand Up @@ -563,13 +563,15 @@ private void AnnounceRound()

var proto = _robustRandom.Pick(options);

// Parkstation-RandomAnnouncers Start
// if (proto.Message != null)
// _chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
//
// if (proto.Sound != null)
// SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());

_announcerSystem.SendAnnouncement(proto.ID, Filter.Broadcast(), Loc.GetString(proto.Message ?? "game-ticker-welcome-to-the-station"));
// Parkstation-RandomAnnouncers End
}
}

Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Nyanotrasen/Fugitive/FugitiveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public sealed class FugitiveSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly StunSystem _stun = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcerSystem = default!; // Parkstation-RandomAnnouncers
[Dependency] private readonly MindSystem _mindSystem = default!;

public override void Initialize()
Expand All @@ -63,8 +63,10 @@ public override void Update(float frameTime)
{
if (cd.AnnounceTime != null && _timing.CurTime > cd.AnnounceTime)
{
// Parkstation-RandomAnnouncers Start
// _chat.DispatchGlobalAnnouncement(Loc.GetString("station-event-fugitive-hunt-announcement"), sender: Loc.GetString("fugitive-announcement-GALPOL"), colorOverride: Color.Yellow);
_announcerSystem.SendAnnouncement("commandreport", Filter.Broadcast(), Loc.GetString("station-event-fugitive-hunt-announcement"), Loc.GetString("fugitive-announcement-GALPOL"), Color.Yellow);
// Parkstation-RandomAnnouncers End

foreach (var console in EntityQuery<CommunicationsConsoleComponent>())
{
Expand Down
48 changes: 27 additions & 21 deletions Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!; // Parkstation-RandomAnnouncers

private ISawmill _sawmill = default!;

Expand Down Expand Up @@ -188,15 +188,17 @@ public void CallEmergencyShuttle(EntityUid stationUid, StationEmergencyShuttleCo
if (targetGrid == null)
{
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} unable to dock with station {ToPrettyString(stationUid)}");
// Parkstation-RandomAnnouncers Start
// _chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-good-luck"), playDefaultSound: false);
// // TODO: Need filter extensions or something don't blame me.
// _audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true);
// // TODO: Need filter extensions or something don't blame me.
// _audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true);

_announcer.SendAnnouncement("shuttledock", Filter.Broadcast(),
Loc.GetString("emergency-shuttle-good-luck"),
Loc.GetString("comms-console-announcement-title-centcom"));
return;
}
_announcer.SendAnnouncement("shuttledock", Filter.Broadcast(),
Loc.GetString("emergency-shuttle-good-luck"),
Loc.GetString("comms-console-announcement-title-centcom"));
// Parkstation-RandomAnnouncers End
return;
}

var xformQuery = GetEntityQuery<TransformComponent>();

Expand All @@ -205,24 +207,28 @@ public void CallEmergencyShuttle(EntityUid stationUid, StationEmergencyShuttleCo
if (TryComp<TransformComponent>(targetGrid.Value, out var targetXform))
{
var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery);
// Parkstation-RandomAnnouncers Start
// _chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())), playDefaultSound: false);
_announcer.SendAnnouncementMessage("shuttledock",
Loc.GetString("emergency-shuttle-docked",("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())),
Loc.GetString("comms-console-announcement-title-centcom"));
}
_announcer.SendAnnouncementMessage("shuttledock",
Loc.GetString("emergency-shuttle-docked",("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())),
Loc.GetString("comms-console-announcement-title-centcom"));
// Parkstation-RandomAnnouncers End
}

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} docked with stations");
// TODO: Need filter extensions or something don't blame me.
// Parkstation-RandomAnnouncers Start
// _audio.PlayGlobal("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast(), true);
_announcer.SendAnnouncementAudio("shuttledock", Filter.Broadcast());
}
else
{
if (TryComp<TransformComponent>(targetGrid.Value, out var targetXform))
{
var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery);
_chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-nearby", ("direction", angle.GetDir())), playDefaultSound: false);
}
_announcer.SendAnnouncementAudio("shuttledock", Filter.Broadcast());
// Parkstation-RandomAnnouncers End
}
else
{
if (TryComp<TransformComponent>(targetGrid.Value, out var targetXform))
{
var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery);
_chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-nearby", ("direction", angle.GetDir())), playDefaultSound: false);
}

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} unable to find a valid docking port for {ToPrettyString(stationUid)}");
// TODO: Need filter extensions or something don't blame me.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.GameTicking;
using Content.Shared.SimpleStation14.CCVar;
using Content.Shared.Slippery;
using Content.Shared.StepTrigger.Components;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;

Expand All @@ -28,14 +29,14 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SlipperyComponent, SlipEvent>(OnSlip);
SubscribeLocalEvent<StepTriggerComponent, SlipEvent>(OnSlip);

SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
}


private void OnSlip(EntityUid uid, SlipperyComponent slipComp, ref SlipEvent args)
private void OnSlip(EntityUid uid, StepTriggerComponent component, ref SlipEvent args)
{
string? username = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ public override void Initialize()

private void OnBatteryInit(EntityUid uid, RandomBatteryChargeComponent component, ComponentInit args)
{
var batteryComp = Comp<BatteryComponent>(uid);
DebugTools.AssertNotNull(batteryComp);

if (batteryComp == null)
if (!TryComp<BatteryComponent>(uid, out var batteryComp))
return;

var (minMaxMod, maxMaxMod) = component.BatteryMaxMinMax;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component,
args.Performer,
!hasComp,
!hasComp,
!hasComp,
true,
args.StaminaCostOn,
args.PowerCostOn,
Expand All @@ -94,6 +95,7 @@ public void SetDarkened(
EntityUid performer,
bool addComp,
bool invisible,
bool pacify,
bool darken,
float staminaCostOn,
float powerCostOn,
Expand All @@ -115,6 +117,7 @@ public void SetDarkened(
{
var comp = _entity.EnsureComponent<ShadowkinDarkSwappedComponent>(performer);
comp.Invisible = invisible;
comp.Pacify = pacify;
comp.Darken = darken;

RaiseNetworkEvent(new ShadowkinDarkSwappedEvent(performer, true));
Expand Down Expand Up @@ -142,7 +145,8 @@ public void SetDarkened(

private void OnInvisStartup(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentStartup args)
{
EnsureComp<PacifiedComponent>(uid);
if (component.Pacify)
EnsureComp<PacifiedComponent>(uid);

if (component.Invisible)
SetCanSeeInvisibility(uid, true);
Expand Down Expand Up @@ -172,7 +176,8 @@ private void OnInvisShutdown(EntityUid uid, ShadowkinDarkSwappedComponent compon

public void SetCanSeeInvisibility(EntityUid uid, bool set)
{
var visibility = _entity.EnsureComponent<VisibilityComponent>(uid);
if (!TryComp<VisibilityComponent>(uid, out var visibility))
return;

if (set)
{
Expand All @@ -185,7 +190,7 @@ public void SetCanSeeInvisibility(EntityUid uid, bool set)
_visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
_visibility.RefreshVisibility(uid);

if (!_entity.TryGetComponent<GhostComponent>(uid, out var _))
if (!_entity.TryGetComponent<GhostComponent>(uid, out _))
_stealth.SetVisibility(uid, 0.8f, _entity.EnsureComponent<StealthComponent>(uid));
}
else
Expand All @@ -199,7 +204,7 @@ public void SetCanSeeInvisibility(EntityUid uid, bool set)
_visibility.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
_visibility.RefreshVisibility(uid);

if (!_entity.TryGetComponent<GhostComponent>(uid, out var _))
if (!_entity.TryGetComponent<GhostComponent>(uid, out _))
_entity.RemoveComponent<StealthComponent>(uid);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ private void Startup(EntityUid uid, HeightAdjustedComponent component, Component
// Set density of the entity using SetDensity
if (_entityManager.TryGetComponent<FixturesComponent>(uid, out var fixtures))
{
if (fixtures.FixtureCount == 0)
return;

var density = fixtures.Fixtures.Values.First().Density;
component.OriginalDensity = density;
var newDensity = density * (component.Width + component.Height) / 2;
Expand Down
Loading

0 comments on commit b0db4a2

Please sign in to comment.