From 94c09bf2951bf340bc9332e02b81b950bf8ba08e Mon Sep 17 00:00:00 2001 From: Charlese2 Date: Tue, 25 Jan 2022 02:29:11 -0700 Subject: [PATCH 1/4] Fix wallmount constrution ghost rotation check. (#6272) --- .../Construction/Conditions/WallmountCondition.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Content.Shared/Construction/Conditions/WallmountCondition.cs b/Content.Shared/Construction/Conditions/WallmountCondition.cs index e9b4866c62..aaec9a2233 100644 --- a/Content.Shared/Construction/Conditions/WallmountCondition.cs +++ b/Content.Shared/Construction/Conditions/WallmountCondition.cs @@ -21,14 +21,17 @@ namespace Content.Shared.Construction.Conditions var entManager = IoCManager.Resolve(); // get blueprint and user position - var userWorldPosition = IoCManager.Resolve().GetComponent(user).WorldPosition; + var userWorldPosition = entManager.GetComponent(user).WorldPosition; var objWorldPosition = location.ToMap(entManager).Position; // find direction from user to blueprint var userToObject = (objWorldPosition - userWorldPosition); + // get direction of the grid being placed on as an offset. + var gridRotation = entManager.GetComponent(location.EntityId).WorldRotation; + var directionWithOffset = gridRotation.RotateVec(direction.ToVec()); // dot product will be positive if user direction and blueprint are co-directed - var dotProd = Vector2.Dot(direction.ToVec(), userToObject); + var dotProd = Vector2.Dot(directionWithOffset.Normalized, userToObject.Normalized); if (dotProd > 0) return false; @@ -36,7 +39,7 @@ namespace Content.Shared.Construction.Conditions var physics = EntitySystem.Get(); var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable); var length = userToObject.Length; - var userToObjRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user).MapID, rUserToObj, maxLength: length, + var userToObjRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent(user).MapID, rUserToObj, maxLength: length, predicate: (e) => !e.HasTag("Wall")); if (!userToObjRaycastResults.Any()) return false; @@ -45,8 +48,8 @@ namespace Content.Shared.Construction.Conditions var targetWall = userToObjRaycastResults.First().HitEntity; // check that we didn't try to build wallmount that facing another adjacent wall - var rAdjWall = new CollisionRay(objWorldPosition, direction.ToVec(), (int) CollisionGroup.Impassable); - var adjWallRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user).MapID, rAdjWall, maxLength: 0.5f, + var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized, (int) CollisionGroup.Impassable); + var adjWallRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent(user).MapID, rAdjWall, maxLength: 0.5f, predicate: (e) => e == targetWall || !e.HasTag("Wall")); return !adjWallRaycastResults.Any(); } From 5a32c14216adb3b51da94ed96c234eb442b38186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Ueti?= <52474532+Mirino97@users.noreply.github.com> Date: Tue, 25 Jan 2022 06:29:31 -0300 Subject: [PATCH 2/4] Fixes RandomTraitorAliveCondition icon (#6300) --- .../Objectives/Conditions/RandomTraitorAliveCondition.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Objectives/Conditions/RandomTraitorAliveCondition.cs b/Content.Server/Objectives/Conditions/RandomTraitorAliveCondition.cs index 5f4c982f21..f6557afcdf 100644 --- a/Content.Server/Objectives/Conditions/RandomTraitorAliveCondition.cs +++ b/Content.Server/Objectives/Conditions/RandomTraitorAliveCondition.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Server.Mind.Components; using Content.Server.Objectives.Interfaces; using JetBrains.Annotations; @@ -53,7 +53,7 @@ namespace Content.Server.Objectives.Conditions public string Description => Loc.GetString("objective-condition-other-traitor-alive-description"); - public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/bureaucracy.rsi"), "folder_red"); + public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/bureaucracy.rsi"), "folder-white"); public float Progress => (!Target?.CharacterDeadIC ?? true) ? 1f : 0f; From ddcd4d267d9f0384ba9bb550e411c9427211ddd6 Mon Sep 17 00:00:00 2001 From: PJBot Date: Tue, 25 Jan 2022 04:30:34 -0500 Subject: [PATCH 3/4] Automatic changelog update --- Resources/Changelog/Changelog.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Resources/Changelog/Changelog.yml b/Resources/Changelog/Changelog.yml index 57ca439c24..0cfa3909dd 100644 --- a/Resources/Changelog/Changelog.yml +++ b/Resources/Changelog/Changelog.yml @@ -1,9 +1,4 @@ Entries: -- author: Zumorica - changes: - - {message: Fixed mobs that die or go into crit not being downed., type: Fix} - id: 430 - time: '2021-10-11T23:44:30.123871+00:00' - author: moony changes: - {message: Central Command has installed a bluespace railgun. Pray they do not @@ -2925,3 +2920,8 @@ Entries: - {message: Blue tiles now obey the laws of physics., type: Fix} id: 930 time: '2022-01-25T07:03:48.0000000+00:00' +- author: Mirino97 + changes: + - {message: Fixes Random Traitor Alive Objective's icon!, type: Fix} + id: 931 + time: '2022-01-25T09:29:31.0000000+00:00' From 107806775e22019bd2ab92539e07d699a1cb02d1 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Tue, 25 Jan 2022 10:38:52 +0100 Subject: [PATCH 4/4] Apply smiley filter on me-command (#6153) --- Content.Server/Chat/Commands/MeCommand.cs | 34 +++++++------------- Content.Server/Chat/Managers/ChatManager.cs | 27 ++++++++++++++-- Content.Server/Chat/Managers/IChatManager.cs | 2 ++ 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Content.Server/Chat/Commands/MeCommand.cs b/Content.Server/Chat/Commands/MeCommand.cs index 3103ffe83a..a07fa09e54 100644 --- a/Content.Server/Chat/Commands/MeCommand.cs +++ b/Content.Server/Chat/Commands/MeCommand.cs @@ -18,39 +18,29 @@ namespace Content.Server.Chat.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - var player = shell.Player as IPlayerSession; - if (player == null) + if (shell.Player is not IPlayerSession player) { - shell.WriteLine("This command cannot be run from the server."); + shell.WriteError("This command cannot be run from the server."); return; } - if (player.Status != SessionStatus.InGame || player.AttachedEntity == null) + if (player.Status != SessionStatus.InGame) return; - if (args.Length < 1) - return; - - var action = string.Join(" ", args).Trim(); - if (string.IsNullOrEmpty(action)) - return; - - var chat = IoCManager.Resolve(); - var mindComponent = player.ContentData()?.Mind; - - if (mindComponent == null) - { - shell.WriteError("You don't have a mind!"); - return; - } - - if (mindComponent.OwnedEntity == null) + if (player.AttachedEntity is not {} playerEntity) { shell.WriteError("You don't have an entity!"); return; } - chat.EntityMe(mindComponent.OwnedEntity.Value, action); + if (args.Length < 1) + return; + + var message = string.Join(" ", args).Trim(); + if (string.IsNullOrEmpty(message)) + return; + + IoCManager.Resolve().TryEmote(playerEntity, message, shell, player); } } } diff --git a/Content.Server/Chat/Managers/ChatManager.cs b/Content.Server/Chat/Managers/ChatManager.cs index 0424d519c6..ac03a3a3a1 100644 --- a/Content.Server/Chat/Managers/ChatManager.cs +++ b/Content.Server/Chat/Managers/ChatManager.cs @@ -169,15 +169,38 @@ namespace Content.Server.Chat.Managers var isEmote = _sanitizer.TrySanitizeOutSmilies(message, owned, out var sanitized, out var emoteStr); if (sanitized.Length != 0) - { SendEntityChatType(owned, sanitized, isWhisper); - } if (isEmote) EntityMe(owned, emoteStr!); } } + public void TryEmote(EntityUid source, string message, IConsoleShell? shell = null, IPlayerSession? player = null) + { + var mindComponent = player?.ContentData()?.Mind; + + if (mindComponent == null) + { + shell?.WriteError("You don't have a mind!"); + return; + } + + if (mindComponent.OwnedEntity is not {Valid: true} owned) + { + shell?.WriteError("You don't have an entity!"); + return; + } + + var isEmote = _sanitizer.TrySanitizeOutSmilies(message, mindComponent.OwnedEntity.Value, out var sanitized, out var emoteStr); + + if (sanitized.Length != 0) + EntityMe(mindComponent.OwnedEntity.Value, sanitized); + + if (isEmote) + EntityMe(mindComponent.OwnedEntity.Value, emoteStr!); + } + public void EntitySay(EntityUid source, string message, bool hideChat=false) { if (!EntitySystem.Get().CanSpeak(source)) diff --git a/Content.Server/Chat/Managers/IChatManager.cs b/Content.Server/Chat/Managers/IChatManager.cs index 1793f3a7c1..d14e7dd253 100644 --- a/Content.Server/Chat/Managers/IChatManager.cs +++ b/Content.Server/Chat/Managers/IChatManager.cs @@ -29,6 +29,8 @@ namespace Content.Server.Chat.Managers /// void TrySpeak(EntityUid source, string message, bool whisper = false, IConsoleShell? shell = null, IPlayerSession? player = null); + void TryEmote(EntityUid source, string message, IConsoleShell? shell = null, IPlayerSession? player = null); + /// If true, message will not be logged to chat boxes but will still produce a speech bubble. void EntitySay(EntityUid source, string message, bool hideChat=false); void EntityWhisper(EntityUid source, string message, bool hideChat = false);