mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-16 22:01:12 +03:00
Merge remote-tracking branch 'upstream/master' into upstream-sync
This commit is contained in:
commit
ba706abea0
6 changed files with 54 additions and 36 deletions
|
|
@ -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<IChatManager>();
|
||||
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<IChatManager>().TryEmote(playerEntity, message, shell, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ActionBlockerSystem>().CanSpeak(source))
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ namespace Content.Server.Chat.Managers
|
|||
/// </summary>
|
||||
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);
|
||||
|
||||
/// <param name="hideChat">If true, message will not be logged to chat boxes but will still produce a speech bubble.</param>
|
||||
void EntitySay(EntityUid source, string message, bool hideChat=false);
|
||||
void EntityWhisper(EntityUid source, string message, bool hideChat = false);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ namespace Content.Shared.Construction.Conditions
|
|||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
// get blueprint and user position
|
||||
var userWorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).WorldPosition;
|
||||
var userWorldPosition = entManager.GetComponent<TransformComponent>(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<TransformComponent>(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<SharedPhysicsSystem>();
|
||||
var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable);
|
||||
var length = userToObject.Length;
|
||||
var userToObjRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapID, rUserToObj, maxLength: length,
|
||||
var userToObjRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent<TransformComponent>(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<IEntityManager>().GetComponent<TransformComponent>(user).MapID, rAdjWall, maxLength: 0.5f,
|
||||
var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized, (int) CollisionGroup.Impassable);
|
||||
var adjWallRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent<TransformComponent>(user).MapID, rAdjWall, maxLength: 0.5f,
|
||||
predicate: (e) => e == targetWall || !e.HasTag("Wall"));
|
||||
return !adjWallRaycastResults.Any();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue