Skip to content

Commit

Permalink
Merge Stable 22/10/24 (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
LankLTE authored Oct 23, 2024
2 parents a34ec6a + 0afe14a commit 956f38b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
10 changes: 6 additions & 4 deletions Content.Server/Ninja/Systems/SpiderChargeSystem.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Mind;
using Content.Server.Objectives.Components;
using Content.Server.Popups;
using Content.Server.Roles;
using Content.Shared.Interaction;
using Content.Shared.Ninja.Components;
using Content.Shared.Ninja.Systems;
using Content.Shared.Roles;
using Content.Shared.Sticky;
using Robust.Shared.GameObjects;

namespace Content.Server.Ninja.Systems;

Expand All @@ -19,6 +17,7 @@ public sealed class SpiderChargeSystem : SharedSpiderChargeSystem
{
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedRoleSystem _role = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SpaceNinjaSystem _ninja = default!;

Expand All @@ -41,7 +40,10 @@ private void OnAttemptStick(EntityUid uid, SpiderChargeComponent comp, ref Attem

var user = args.User;

if (!_mind.TryGetRole<NinjaRoleComponent>(user, out var _))
if (!_mind.TryGetMind(args.User, out var mind, out _))
return;

if (!_role.MindHasRole<NinjaRoleComponent>(mind))
{
_popup.PopupEntity(Loc.GetString("spider-charge-not-ninja"), user, user);
args.Cancelled = true;
Expand Down
13 changes: 0 additions & 13 deletions Content.Shared/Mind/SharedMindSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,6 @@ public bool TryGetMind(
return false;
}

/// <summary>
/// Gets a role component from a player's mind.
/// </summary>
/// <returns>Whether a role was found</returns>
public bool TryGetRole<T>(EntityUid user, [NotNullWhen(true)] out T? role) where T : IComponent
{
role = default;
if (!TryComp<MindContainerComponent>(user, out var mindContainer) || mindContainer.Mind == null)
return false;

return TryComp(mindContainer.Mind, out role);
}

/// <summary>
/// Sets the Mind's UserId, Session, and updates the player's PlayerData. This should have no direct effect on the
/// entity that any mind is connected to, except as a side effect of the fact that it may change a player's
Expand Down
28 changes: 22 additions & 6 deletions Content.Shared/Storage/EntitySystems/SecretStashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using Content.Shared.IdentityManagement;
using Content.Shared.Tools.EntitySystems;
using Content.Shared.Whitelist;
using Content.Shared.Materials;
using Robust.Shared.Map;

namespace Content.Shared.Storage.EntitySystems;

Expand All @@ -35,6 +37,7 @@ public override void Initialize()
base.Initialize();
SubscribeLocalEvent<SecretStashComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<SecretStashComponent, DestructionEventArgs>(OnDestroyed);
SubscribeLocalEvent<SecretStashComponent, GotReclaimedEvent>(OnReclaimed);
SubscribeLocalEvent<SecretStashComponent, InteractUsingEvent>(OnInteractUsing, after: new[] { typeof(ToolOpenableSystem) });
SubscribeLocalEvent<SecretStashComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<SecretStashComponent, GetVerbsEvent<InteractionVerb>>(OnGetVerb);
Expand All @@ -47,12 +50,12 @@ private void OnInit(Entity<SecretStashComponent> entity, ref ComponentInit args)

private void OnDestroyed(Entity<SecretStashComponent> entity, ref DestructionEventArgs args)
{
var storedInside = _containerSystem.EmptyContainer(entity.Comp.ItemContainer);
if (storedInside != null && storedInside.Count >= 1)
{
var popup = Loc.GetString("comp-secret-stash-on-destroyed-popup", ("stashname", GetStashName(entity)));
_popupSystem.PopupEntity(popup, storedInside[0], PopupType.MediumCaution);
}
DropContentsAndAlert(entity);
}

private void OnReclaimed(Entity<SecretStashComponent> entity, ref GotReclaimedEvent args)
{
DropContentsAndAlert(entity, args.ReclaimerCoordinates);
}

private void OnInteractUsing(Entity<SecretStashComponent> entity, ref InteractUsingEvent args)
Expand Down Expand Up @@ -211,5 +214,18 @@ private bool HasItemInside(Entity<SecretStashComponent> entity)
return entity.Comp.ItemContainer.ContainedEntity != null;
}

/// <summary>
/// Drop the item stored in the stash and alert all nearby players with a popup.
/// </summary>
private void DropContentsAndAlert(Entity<SecretStashComponent> entity, EntityCoordinates? cords = null)
{
var storedInside = _containerSystem.EmptyContainer(entity.Comp.ItemContainer, true, cords);
if (storedInside != null && storedInside.Count >= 1)
{
var popup = Loc.GetString("comp-secret-stash-on-destroyed-popup", ("stashname", GetStashName(entity)));
_popupSystem.PopupPredicted(popup, storedInside[0], null, PopupType.MediumCaution);
}
}

#endregion
}
2 changes: 1 addition & 1 deletion RobustToolbox
Submodule RobustToolbox updated 27 files
+1 −1 MSBuild/Robust.Engine.Version.props
+32 −0 RELEASE-NOTES.md
+8 −1 Resources/Locale/en-US/custom-controls.ftl
+3 −0 Robust.Client/Graphics/Clyde/Clyde.Events.cs
+13 −1 Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
+1 −1 Robust.Client/Graphics/Clyde/ClydeHeadless.cs
+9 −0 Robust.Client/Graphics/Clyde/Windowing/Glfw.WindowThread.cs
+14 −0 Robust.Client/Graphics/Clyde/Windowing/Glfw.Windows.cs
+1 −0 Robust.Client/Graphics/Clyde/Windowing/IWindowingImpl.cs
+9 −0 Robust.Client/Graphics/Clyde/Windowing/Sdl2.WindowThread.cs
+11 −0 Robust.Client/Graphics/Clyde/Windowing/Sdl2.Windows.cs
+1 −1 Robust.Client/Graphics/IClydeWindow.cs
+1 −1 Robust.Client/Replays/Loading/ReplayLoadManager.Read.cs
+36 −10 Robust.Client/UserInterface/Controllers/Implementations/TileSpawningUIController.cs
+22 −8 Robust.Client/UserInterface/Controls/OSWindow.cs
+1 −1 Robust.Client/UserInterface/CustomControls/EntitySpawnWindow.xaml
+4 −1 Robust.Client/UserInterface/CustomControls/TileSpawnWindow.xaml
+4 −2 Robust.Client/UserInterface/UserInterfaceManager.Roots.cs
+1 −1 Robust.Server/BaseServer.cs
+1 −0 Robust.Server/ServerIoC.cs
+80 −0 Robust.Server/ServerStatus/IWatchdogApi.cs
+55 −8 Robust.Server/ServerStatus/WatchdogApi.cs
+25 −9 Robust.Shared.Scripting/ScriptGlobalsShared.cs
+21 −3 Robust.Shared.Scripting/ScriptInstanceShared.cs
+6 −1 Robust.Shared/Console/IConsoleShell.cs
+55 −67 Robust.Shared/Serialization/RobustSerializer.cs
+1 −7 Robust.Shared/Utility/UniqueIndexHkm.cs

0 comments on commit 956f38b

Please sign in to comment.