mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-15 03:31:44 +01:00
МбКульт & Gambling^3 (#279)
* refmbcult * fixrule * minich * yeee * linter * somefixes * cultext&gamb * linterfix * fixtarot
This commit is contained in:
@@ -21,6 +21,7 @@ using Content.Shared.Chat;
|
||||
using Content.Shared.Damage.ForceSay;
|
||||
using Content.Shared.Decals;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Mind; // Corvax-Wega-MindChat
|
||||
using Content.Shared.Radio;
|
||||
using Content.Shared.Roles.RoleCodeword;
|
||||
using Robust.Client.GameObjects;
|
||||
@@ -84,7 +85,8 @@ public sealed partial class ChatUIController : UIController
|
||||
{SharedChatSystem.EmotesAltPrefix, ChatSelectChannel.Emotes},
|
||||
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
|
||||
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
|
||||
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead}
|
||||
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
|
||||
{SharedChatSystem.MindPrefix, ChatSelectChannel.Mind} // Corvax-Wega-MindChat
|
||||
};
|
||||
|
||||
public static readonly Dictionary<ChatSelectChannel, char> ChannelPrefixes = new()
|
||||
@@ -97,7 +99,8 @@ public sealed partial class ChatUIController : UIController
|
||||
{ChatSelectChannel.Emotes, SharedChatSystem.EmotesPrefix},
|
||||
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
|
||||
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
|
||||
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix}
|
||||
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
|
||||
{ChatSelectChannel.Mind, SharedChatSystem.MindPrefix} // Corvax-Wega-MindChat
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -534,6 +537,7 @@ public sealed partial class ChatUIController : UIController
|
||||
FilterableChannels |= ChatChannel.Whisper;
|
||||
FilterableChannels |= ChatChannel.Radio;
|
||||
FilterableChannels |= ChatChannel.Emotes;
|
||||
FilterableChannels |= ChatChannel.Mind; // Corvax-Wega-MindChat
|
||||
FilterableChannels |= ChatChannel.Notifications;
|
||||
|
||||
// Can only send local / radio / emote when attached to a non-ghost entity.
|
||||
@@ -545,6 +549,8 @@ public sealed partial class ChatUIController : UIController
|
||||
CanSendChannels |= ChatSelectChannel.Radio;
|
||||
CanSendChannels |= ChatSelectChannel.Emotes;
|
||||
}
|
||||
|
||||
CanSendChannels |= ChatSelectChannel.Mind; // Corvax-Wega-MindChat
|
||||
}
|
||||
|
||||
// Only ghosts and admins can send / see deadchat.
|
||||
@@ -692,46 +698,66 @@ public sealed partial class ChatUIController : UIController
|
||||
&& _chatSys.TryProcessRadioMessage(uid, text, out _, out radioChannel, quiet: true);
|
||||
}
|
||||
|
||||
// Corvax-Wega-MindChat-start
|
||||
private bool TryGetMindChannel(string text, out MindChannelPrototype? mindChannel)
|
||||
{
|
||||
mindChannel = null;
|
||||
return _player.LocalEntity is EntityUid { Valid: true } uid
|
||||
&& _chatSys != null
|
||||
&& _chatSys.TryProcessMindMessage(uid, text, out _, out mindChannel, quiet: true);
|
||||
}
|
||||
// Corvax-Wega-MindChat-end
|
||||
|
||||
public void UpdateSelectedChannel(ChatBox box)
|
||||
{
|
||||
var (prefixChannel, _, radioChannel) = SplitInputContents(box.ChatInput.Input.Text.ToLower());
|
||||
var (prefixChannel, text, radioChannel, mindChannel) = SplitInputContents(box.ChatInput.Input.Text.ToLower()); // Corvax-Wega-MindChat-Edit
|
||||
|
||||
if (prefixChannel == ChatSelectChannel.None)
|
||||
box.ChatInput.ChannelSelector.UpdateChannelSelectButton(box.SelectedChannel, null);
|
||||
box.ChatInput.ChannelSelector.UpdateChannelSelectButton(box.SelectedChannel, null, null); // Corvax-Wega-MindChat-Edit
|
||||
else
|
||||
box.ChatInput.ChannelSelector.UpdateChannelSelectButton(prefixChannel, radioChannel);
|
||||
box.ChatInput.ChannelSelector.UpdateChannelSelectButton(prefixChannel, radioChannel, mindChannel); // Corvax-Wega-MindChat-Edit
|
||||
}
|
||||
|
||||
public (ChatSelectChannel chatChannel, string text, RadioChannelPrototype? radioChannel) SplitInputContents(string text)
|
||||
public (ChatSelectChannel chatChannel, string text, RadioChannelPrototype? radioChannel, MindChannelPrototype? mindChannel) SplitInputContents(string text) // Corvax-Wega-MindChat-Edit
|
||||
{
|
||||
text = text.Trim();
|
||||
if (text.Length == 0)
|
||||
return (ChatSelectChannel.None, text, null);
|
||||
return (ChatSelectChannel.None, text, null, null); // Corvax-Wega-MindChat-Edit
|
||||
|
||||
// We only cut off prefix only if it is not a radio or local channel, which both map to the same /say command
|
||||
// because ????????
|
||||
|
||||
// Corvax-Wega-MindChat-Edit-start
|
||||
ChatSelectChannel chatChannel;
|
||||
if (TryGetRadioChannel(text, out var radioChannel))
|
||||
RadioChannelPrototype? radioChannel = null;
|
||||
MindChannelPrototype? mindChannel = null;
|
||||
|
||||
if (TryGetRadioChannel(text, out radioChannel))
|
||||
chatChannel = ChatSelectChannel.Radio;
|
||||
else if (TryGetMindChannel(text, out mindChannel))
|
||||
chatChannel = ChatSelectChannel.Mind;
|
||||
else
|
||||
chatChannel = PrefixToChannel.GetValueOrDefault(text[0]);
|
||||
|
||||
if ((CanSendChannels & chatChannel) == 0)
|
||||
return (ChatSelectChannel.None, text, null);
|
||||
return (ChatSelectChannel.None, text, null, null);
|
||||
|
||||
if (chatChannel == ChatSelectChannel.Radio)
|
||||
return (chatChannel, text, radioChannel);
|
||||
return (chatChannel, text, radioChannel, null);
|
||||
|
||||
if (chatChannel == ChatSelectChannel.Mind)
|
||||
return (chatChannel, text, null, mindChannel);
|
||||
|
||||
if (chatChannel == ChatSelectChannel.Local)
|
||||
{
|
||||
if (_ghost?.IsGhost != true)
|
||||
return (chatChannel, text, null);
|
||||
return (chatChannel, text, null, null);
|
||||
else
|
||||
chatChannel = ChatSelectChannel.Dead;
|
||||
}
|
||||
|
||||
return (chatChannel, text[1..].TrimStart(), null);
|
||||
return (chatChannel, text[1..].TrimStart(), null, null);
|
||||
// Corvax-Wega-MindChat-Edit-end
|
||||
}
|
||||
|
||||
public void SendMessage(ChatBox box, ChatSelectChannel channel)
|
||||
@@ -746,7 +772,7 @@ public sealed partial class ChatUIController : UIController
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
|
||||
(var prefixChannel, text, var _) = SplitInputContents(text);
|
||||
(var prefixChannel, text, var _, var _) = SplitInputContents(text); // Corvax-Wega-MindChat-Edit
|
||||
|
||||
// Check if message is longer than the character limit
|
||||
if (text.Length > MaxMessageLength)
|
||||
@@ -764,6 +790,12 @@ public sealed partial class ChatUIController : UIController
|
||||
// radio must have prefix as it goes through the say command.
|
||||
text = $";{text}";
|
||||
}
|
||||
// Corvax-Wega-MindChat-start
|
||||
else if (channel == ChatSelectChannel.Mind)
|
||||
{
|
||||
text = $"+{text}";
|
||||
}
|
||||
// Corvax-Wega-MindChat-end
|
||||
|
||||
_manager.SendMessage(text, prefixChannel == 0 ? channel : prefixChannel);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public sealed partial class ChannelFilterPopup : Popup
|
||||
ChatChannel.LOOC,
|
||||
ChatChannel.OOC,
|
||||
ChatChannel.Dead,
|
||||
ChatChannel.Mind, // Corvax-Wega-MindChat
|
||||
ChatChannel.Admin,
|
||||
ChatChannel.AdminAlert,
|
||||
ChatChannel.AdminChat,
|
||||
|
||||
@@ -63,14 +63,30 @@ public sealed class ChannelSelectorButton : ChatPopupButton<ChannelSelectorPopup
|
||||
ChatSelectChannel.LOOC => Color.MediumTurquoise,
|
||||
ChatSelectChannel.OOC => Color.LightSkyBlue,
|
||||
ChatSelectChannel.Dead => Color.MediumPurple,
|
||||
ChatSelectChannel.Mind => Color.Peru, // Corvax-Wega-MindChat
|
||||
ChatSelectChannel.Admin => Color.HotPink,
|
||||
_ => Color.DarkGray
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdateChannelSelectButton(ChatSelectChannel channel, Shared.Radio.RadioChannelPrototype? radio)
|
||||
// Corvax-Wega-MindChat-Edit-start
|
||||
public void UpdateChannelSelectButton(ChatSelectChannel channel, Shared.Radio.RadioChannelPrototype? radio, Shared.Mind.MindChannelPrototype? mind)
|
||||
{
|
||||
Text = radio != null ? Loc.GetString(radio.Name) : ChannelSelectorName(channel);
|
||||
Modulate = radio?.Color ?? ChannelSelectColor(channel);
|
||||
if (radio != null)
|
||||
{
|
||||
Text = Loc.GetString(radio.Name);
|
||||
Modulate = radio.Color;
|
||||
}
|
||||
else if (mind != null)
|
||||
{
|
||||
Text = Loc.GetString(mind.Name);
|
||||
Modulate = mind.Color;
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = ChannelSelectorName(channel);
|
||||
Modulate = ChannelSelectColor(channel);
|
||||
}
|
||||
}
|
||||
// Corvax-Wega-MindChat-Edit-end
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public sealed class ChannelSelectorPopup : Popup
|
||||
ChatSelectChannel.LOOC,
|
||||
ChatSelectChannel.OOC,
|
||||
ChatSelectChannel.Dead,
|
||||
ChatSelectChannel.Mind, // Corvax-Wega-MindChat
|
||||
ChatSelectChannel.Admin
|
||||
// NOTE: Console is not in there and it can never be permanently selected.
|
||||
// You can, however, still submit commands as console by prefixing with /.
|
||||
|
||||
Reference in New Issue
Block a user