Skip to content

Commit

Permalink
Merge pull request #2348 from space-syndicate/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Morb0 authored Jun 27, 2024
2 parents 434a56d + 44a22c9 commit 13620a0
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
using Content.Client.Administration.Managers;
using Content.Client.Administration.Managers;
using Content.Shared.CCVar;
using Robust.Client;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;


namespace Content.Client.DebugMon;

/// <summary>
/// This handles preventing certain debug monitors from appearing.
/// This handles preventing certain debug monitors from being usable by non-admins.
/// </summary>
public sealed class DebugMonitorSystem : EntitySystem
internal sealed class DebugMonitorManager
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;
[Dependency] private readonly IBaseClient _baseClient = default!;

public override void FrameUpdate(float frameTime)
public void FrameUpdate()
{
if (!_admin.IsActive() && _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly))
if (_baseClient.RunLevel == ClientRunLevel.InGame
&& !_admin.IsActive()
&& _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly))
{
_userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, false);
}
}
}
11 changes: 11 additions & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.Administration.Managers;
using Content.Client.Changelog;
using Content.Client.Chat.Managers;
using Content.Client.DebugMon;
using Content.Client.Corvax.TTS;
using Content.Client.Options;
using Content.Client.Eui;
Expand Down Expand Up @@ -35,6 +36,7 @@
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Replays;
using Robust.Shared.Timing;

namespace Content.Client.Entry
{
Expand Down Expand Up @@ -70,6 +72,7 @@ public sealed class EntryPoint : GameClient
[Dependency] private readonly IReplayLoadManager _replayLoad = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
[Dependency] private readonly DebugMonitorManager _debugMonitorManager = default!;

public override void Init()
{
Expand Down Expand Up @@ -208,5 +211,13 @@ private void SwitchToDefaultState(bool disconnected = false)
_stateManager.RequestStateChange<MainScreen>();
}
}

public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
{
if (level == ModUpdateLevel.FramePreEngine)
{
_debugMonitorManager.FrameUpdate();
}
}
}
}
2 changes: 2 additions & 0 deletions Content.Client/IoC/ClientContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Chat.Managers;
using Content.Client.Clickable;
using Content.Client.Corvax.TTS;
using Content.Client.DebugMon;
using Content.Client.Eui;
using Content.Client.GhostKick;
using Content.Client.Launcher;
Expand Down Expand Up @@ -49,6 +50,7 @@ public static void Register()
collection.Register<DocumentParsingManager>();
collection.Register<ContentReplayPlaybackManager, ContentReplayPlaybackManager>();
collection.Register<ISharedPlaytimeManager, JobRequirementsManager>();
collection.Register<DebugMonitorManager>();
}
}
}
6 changes: 6 additions & 0 deletions Content.Server/Tabletop/TabletopSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Popups;
using Content.Server.Tabletop.Components;
using Content.Shared.CCVar;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Item;
Expand All @@ -9,6 +10,7 @@
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Player;
Expand All @@ -23,6 +25,7 @@ public sealed partial class TabletopSystem : SharedTabletopSystem
[Dependency] private readonly EyeSystem _eye = default!;
[Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -73,6 +76,9 @@ private void OnTabletopRequestTakeOut(TabletopRequestTakeOut msg, EntitySessionE

private void OnInteractUsing(EntityUid uid, TabletopGameComponent component, InteractUsingEvent args)
{
if (!_cfg.GetCVar(CCVars.GameTabletopPlace))
return;

if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands))
return;

Expand Down
5 changes: 5 additions & 0 deletions Content.Shared.Database/LogType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,9 @@ public enum LogType
/// This is a default value used by <c>PlayerRateLimitManager</c>, though users can use different log types.
/// </remarks>
RateLimited = 91,

/// <summary>
/// A player did an item-use interaction of an item they were holding onto another object.
/// </summary>
InteractUsing = 92,
}
10 changes: 10 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ public static readonly CVarDef<bool>
public static readonly CVarDef<bool> RoundEndPVSOverrides =
CVarDef.Create("game.round_end_pvs_overrides", true, CVar.SERVERONLY);

/// <summary>
/// If true, players can place objects onto tabletop games like chess boards.
/// </summary>
/// <remarks>
/// This feature is currently highly abusable and can easily be used to crash the server,
/// so it's off by default.
/// </remarks>
public static readonly CVarDef<bool> GameTabletopPlace =
CVarDef.Create("game.tabletop_place", false, CVar.SERVERONLY);

/*
* Discord
*/
Expand Down
20 changes: 20 additions & 0 deletions Content.Shared/Interaction/SharedInteractionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,21 @@ public void InteractHand(EntityUid user, EntityUid target)
public void InteractUsingRanged(EntityUid user, EntityUid used, EntityUid? target,
EntityCoordinates clickLocation, bool inRangeUnobstructed)
{
if (target != null)
{
_adminLogger.Add(
LogType.InteractUsing,
LogImpact.Low,
$"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target} using {ToPrettyString(used):used}");
}
else
{
_adminLogger.Add(
LogType.InteractUsing,
LogImpact.Low,
$"{ToPrettyString(user):user} interacted with *nothing* using {ToPrettyString(used):used}");
}

if (RangedInteractDoBefore(user, used, target, clickLocation, inRangeUnobstructed))
return;

Expand Down Expand Up @@ -926,6 +941,11 @@ public void InteractUsing(
if (checkCanUse && !_actionBlockerSystem.CanUseHeldEntity(user, used))
return;

_adminLogger.Add(
LogType.InteractUsing,
LogImpact.Low,
$"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target} using {ToPrettyString(used):used}");

if (RangedInteractDoBefore(user, used, target, clickLocation, true))
return;

Expand Down
30 changes: 15 additions & 15 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
Entries:
- author: Killerqu00
changes:
- message: Quartermasters can now skip a single bounty in the list once every 15
minutes.
type: Add
id: 6325
time: '2024-04-09T22:18:07.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26537
- author: SkaldetSkaeg
changes:
- message: The Flippo lighter is now quieter and has a delay on use.
type: Tweak
id: 6326
time: '2024-04-09T22:20:57.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26846
- author: notquitehadouken
changes:
- message: Gave botanists droppers for easier chemical moving.
Expand Down Expand Up @@ -3831,3 +3816,18 @@
id: 6824
time: '2024-06-27T02:08:57.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29499
- author: PJB3005
changes:
- message: You can no longer place items onto tabletop games. The feature could
be easily abused to crash the server.
type: Remove
id: 6825
time: '2024-06-27T14:57:55.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29513
- author: KonstantinAngelov
changes:
- message: Chef's Cookbook has a more IC name.
type: Tweak
id: 6826
time: '2024-06-27T15:11:33.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29467
2 changes: 1 addition & 1 deletion Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
orGroup: BookPool
- id: BookBartendersManual
orGroup: BookPool
- id: BookChefGaming
- id: BookHowToCookForFortySpaceman
orGroup: BookPool
- id: BookLeafLoversSecret
orGroup: BookPool
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Catalog/Fills/Crates/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
- id: BookSpaceEncyclopedia
- id: BookTheBookOfControl
- id: BookBartendersManual
- id: BookChefGaming
- id: BookHowToCookForFortySpaceman
- id: BookLeafLoversSecret
- id: BookEngineersHandbook
- id: BookScientistsGuidebook
Expand Down
6 changes: 3 additions & 3 deletions Resources/Prototypes/Entities/Objects/Misc/books.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
- Bartender

- type: entity
id: BookChefGaming
id: BookHowToCookForFortySpaceman
parent: BaseItem
name: chef gaming
description: A book about cooking written by a gamer chef.
name: How To Cook For Forty Spacemen
description: A book about cooking written by a space chef.
components:
- type: Sprite
sprite: Objects/Misc/books.rsi
Expand Down
4 changes: 4 additions & 0 deletions Resources/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,7 @@ ClothingOuterCoatInspector: ClothingOuterCoatDetectiveLoadout

# 2024-06-23
FloorTileItemReinforced: PartRodMetal1


#2024-06-25
BookChefGaming: BookHowToCookForFortySpaceman

0 comments on commit 13620a0

Please sign in to comment.