Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Fix upstream bugs #379

Merged
merged 7 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
</BoxContainer>
</PanelContainer>
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public PlayerTabEntry(PlayerInfo player, StyleBoxFlat styleBoxFlat)
BackgroundColorPanel.PanelOverride = styleBoxFlat;
OverallPlaytimeLabel.Text = player.PlaytimeString;
PlayerEntity = player.NetEntity;
BalanceLabel.Text = player.Balance.ToString();
}
}
118 changes: 45 additions & 73 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private void SendEntitySpeak(
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
return;

var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage));
var message = FormattedMessage.RemoveMarkupOrThrow(originalMessage);

var msg = _language.GetLanguageMessage(source, message, language, TransformSpeech(source, message));

Expand Down Expand Up @@ -452,61 +452,37 @@ private void SendEntitySpeak(
if (color is not null)
wrappedMessage = InjectTagInsideTag(wrappedMessage, "Message", "color", color.Value.ToHex());

foreach (var (session, data) in GetRecipients(source, VoiceRange))
{
var entRange = MessageRangeCheck(session, data, range);
var wrappedLanguageMessage = Loc.GetString(
speech.Bold ? "chat-manager-entity-say-bold-wrap-message" : "chat-manager-entity-say-wrap-message",
("entityName", name),
("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))),
("fontType", speech.FontId),
("fontSize", speech.FontSize),
("message", FormattedMessage.EscapeText(msg.Message)));

if (entRange == MessageRangeCheckResult.Disallowed)
continue;
SendInVoiceRange(ChatChannel.Local, msg, wrappedMessage, wrappedLanguageMessage, source, range);

var understand = _language.IsUnderstandLanguage(session, msg);
var ev = new EntitySpokeEvent(source, msg, null, null);
RaiseLocalEvent(source, ev, true);

var wrappedLanguageMessage = Loc.GetString(
speech.Bold ? "chat-manager-entity-say-bold-wrap-message" : "chat-manager-entity-say-wrap-message",
("entityName", name),
("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))),
("fontType", speech.FontId),
("fontSize", speech.FontSize),
("message", FormattedMessage.EscapeText(understand ? msg.OriginalMessage : msg.Message)));

SendInVoiceRange(ChatChannel.Local,
understand ? msg.OriginalMessage : msg.Message,
wrappedMessage: wrappedLanguageMessage,
source,
range,
session,
data);

var ev = new EntitySpokeEvent(source, message, null, null);
RaiseLocalEvent(source, ev, true);

// To avoid logging any messages sent by entities that are not players, like vendors, cloning, etc.
// Also doesn't log if hideLog is true.
if (!HasComp<ActorComponent>(source) || hideLog == true)
return;
// To avoid logging any messages sent by entities that are not players, like vendors, cloning, etc.
// Also doesn't log if hideLog is true.
if (!HasComp<ActorComponent>(source) || hideLog == true)
return;

if (originalMessage == msg.OriginalMessage)
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat,
LogImpact.Low,
$"Say from {ToPrettyString(source):user} as {name}: {originalMessage}.");
else
_adminLogger.Add(LogType.Chat,
LogImpact.Low,
$"Say from {ToPrettyString(source):user}: {originalMessage}.");
}
if (originalMessage == msg.OriginalMessage)
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user} as {name}: {originalMessage}.");
else
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat,
LogImpact.Low,
$"Say from {ToPrettyString(source):user} as {name}, original: {originalMessage}, transformed: {message}.");
else
_adminLogger.Add(LogType.Chat,
LogImpact.Low,
$"Say from {ToPrettyString(source):user}, original: {originalMessage}, transformed: {message}.");
}
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}: {originalMessage}.");
}
else
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user} as {name}, original: {originalMessage}, transformed: {msg.OriginalMessage}.");
else
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}, original: {originalMessage}, transformed: {msg.OriginalMessage}.");
}
}

Expand All @@ -524,7 +500,7 @@ void SendEntityWhisper(
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
return;

var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage));
var message = FormattedMessage.RemoveMarkupOrThrow(originalMessage);

var msg = _language.GetLanguageMessage(source, message, language, TransformSpeech(source, message));

Expand All @@ -551,7 +527,7 @@ void SendEntityWhisper(
name = FormattedMessage.EscapeText(name);

var wrappedMessage = Loc.GetString("chat-manager-entity-whisper-wrap-message",
("entityName", name), ("message", FormattedMessage.EscapeText(message)));
("entityName", name), ("message", FormattedMessage.EscapeText(msg.OriginalMessage)));

var wrappedObfuscatedMessage = Loc.GetString("chat-manager-entity-whisper-wrap-message",
("entityName", nameIdentity), ("message", FormattedMessage.EscapeText(obfuscatedMessage)));
Expand Down Expand Up @@ -606,7 +582,7 @@ void SendEntityWhisper(
var ev = new EntitySpokeEvent(source, msg, channel, new(obfuscatedMessage, language, obfuscatedLanguageMessage));
RaiseLocalEvent(source, ev, true);
if (!hideLog)
if (originalMessage == message)
if (originalMessage == msg.OriginalMessage)
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Whisper from {ToPrettyString(source):user} as {name}: {originalMessage}.");
Expand All @@ -617,10 +593,10 @@ void SendEntityWhisper(
{
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low,
$"Whisper from {ToPrettyString(source):user} as {name}, original: {originalMessage}, transformed: {message}.");
$"Whisper from {ToPrettyString(source):user} as {name}, original: {originalMessage}, transformed: {msg.OriginalMessage}.");
else
_adminLogger.Add(LogType.Chat, LogImpact.Low,
$"Whisper from {ToPrettyString(source):user}, original: {originalMessage}, transformed: {message}.");
$"Whisper from {ToPrettyString(source):user}, original: {originalMessage}, transformed: {msg.OriginalMessage}.");
}
}

Expand All @@ -646,14 +622,11 @@ private void SendEntityEmote(
var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
("entityName", name),
("entity", ent),
("message", FormattedMessage.RemoveMarkup(action)));
("message", FormattedMessage.RemoveMarkupOrThrow(action)));

if (checkEmote)
TryEmoteChatInput(source, action);
foreach (var (session, data) in GetRecipients(source, VoiceRange))
{
SendInVoiceRange(ChatChannel.Emotes, action, wrappedMessage, source, range, session, data, author);
}
SendInVoiceRange(ChatChannel.Emotes, action, wrappedMessage, wrappedMessage, source, range, author);
if (!hideLog)
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user} as {name}: {action}");
Expand All @@ -679,10 +652,7 @@ private void SendLOOC(EntityUid source, ICommonSession player, string message, b
var wrappedMessage = Loc.GetString("chat-manager-entity-looc-wrap-message",
("entityName", name),
("message", FormattedMessage.EscapeText(message)));
foreach (var (session, data) in GetRecipients(source, VoiceRange))
{
SendInVoiceRange(ChatChannel.LOOC, message, wrappedMessage, source, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, session, data, player.UserId);
}
SendInVoiceRange(ChatChannel.LOOC, message, wrappedMessage, wrappedMessage, source, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, player.UserId);
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}");
}

Expand Down Expand Up @@ -768,15 +738,17 @@ private MessageRangeCheckResult MessageRangeCheck(ICommonSession session, ICChat
/// <summary>
/// Sends a chat message to the given players in range of the source entity.
/// </summary>
private void SendInVoiceRange(ChatChannel channel, LanguageMessage message, string wrappedMessage, EntityUid source, ChatTransmitRange range, ICommonSession session, ICChatRecipientData data, NetUserId? author = null)
private void SendInVoiceRange(ChatChannel channel, LanguageMessage message, string wrappedMessage, string wrappedLanguageMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null)
{
var entRange = MessageRangeCheck(session, data, range);
if (entRange == MessageRangeCheckResult.Disallowed)
return;

var understand = _language.IsUnderstandLanguage(session, message);
var entHideChat = entRange == MessageRangeCheckResult.HideChat;
_chatManager.ChatMessageToOne(channel, understand ? message.OriginalMessage : message.Message, wrappedMessage, source, entHideChat, session.Channel, author: author);
foreach (var (session, data) in GetRecipients(source, VoiceRange))
{
var entRange = MessageRangeCheck(session, data, range);
if (entRange == MessageRangeCheckResult.Disallowed)
continue;
var understand = _language.IsUnderstandLanguage(session, message);
var entHideChat = entRange == MessageRangeCheckResult.HideChat;
_chatManager.ChatMessageToOne(channel, understand ? message.OriginalMessage : message.Message, understand ? wrappedMessage : wrappedLanguageMessage, source, entHideChat, session.Channel, author: author);
}

_replay.RecordServerMessage(new ChatMessage(channel, message.OriginalMessage, wrappedMessage, GetNetEntity(source), null, MessageRangeHideChatForReplay(range)));
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Medical/SuitSensors/SuitSensorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ public void SetSensor(EntityUid uid, SuitSensorMode mode, EntityUid? userUid = n
userJob = card.Comp.JobTitle;
if (card.Comp.JobIcon != null)
userJobIcon = card.Comp.JobIcon;
if (card.Comp.JobPrototype is not null)
userJobPrototype = card.Comp.JobPrototype;

foreach (var department in card.Comp.JobDepartments)
userJobDepartments.Add(Loc.GetString(department));
Expand Down
25 changes: 13 additions & 12 deletions Content.Shared/Execution/ExecutionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ExecutionComponent, GetVerbsEvent<UtilityVerb>>(OnGetInteractionsVerbs);
SubscribeLocalEvent<ExecutionComponent, ExecutionDoAfterEvent>(OnExecutionDoAfter);
//SubscribeLocalEvent<ExecutionComponent, GetVerbsEvent<UtilityVerb>>(OnGetInteractionsVerbs);
//SubscribeLocalEvent<ExecutionComponent, ExecutionDoAfterEvent>(OnExecutionDoAfter);
//SubscribeLocalEvent<ExecutionComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
SubscribeLocalEvent<ProjectileComponent, ProjectileHitEvent>(OnProjectileHit);
//SubscribeLocalEvent<ProjectileComponent, ProjectileHitEvent>(OnProjectileHit);
}

private void OnGetInteractionsVerbs(EntityUid uid, ExecutionComponent comp, GetVerbsEvent<UtilityVerb> args)
Expand Down Expand Up @@ -172,15 +172,16 @@ private void OnExecutionDoAfter(EntityUid uid, ExecutionComponent component, Exe

// TODO: This should just be an event or something instead to get this.
// TODO: Handle clumsy.
var toCoordinates = gun.ShootCoordinates;

if (toCoordinates == null)
return;

_gunSystem.AttemptShoot(args.User, weapon, gun, toCoordinates.Value);

internalMsg = DefaultCompleteInternalGunExecutionMessage;
externalMsg = DefaultCompleteExternalGunExecutionMessage;
if (!_gunSystem.AttemptDirectShoot(args.User, uid, args.Target.Value, gun))
{
internalMsg = null;
externalMsg = null;
}
else
{
internalMsg = DefaultCompleteInternalGunExecutionMessage;
externalMsg = DefaultCompleteExternalGunExecutionMessage;
}

args.Handled = true;
}
Expand Down
Loading
Loading