Update chat schtuff

This commit is contained in:
John Gross
2019-01-17 15:52:16 -08:00
parent b66db19c0a
commit ae3edd67da
4 changed files with 19 additions and 18 deletions

View File

@@ -120,7 +120,13 @@ namespace Torch.Server.ViewModels
public bool EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); } public bool EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); }
[Torch.Views.Display(Description = "Enables respawn screen.", Name = "Enable Respawn Screen in the Game", GroupName = "Players")] [Torch.Views.Display(Description = "Enables respawn screen.", Name = "Enable Respawn Screen in the Game", GroupName = "Players")]
public bool EnableRespawnScreen { get => _settings.EnableRespawnScreen; set => SetValue(ref _settings.EnableRespawnScreen, value); } public bool StartInRespawnScreen { get => _settings.StartInRespawnScreen; set => SetValue(ref _settings.StartInRespawnScreen, value); }
[Torch.Views.Display(Description = "Enables research.", Name = "Enable Research", GroupName = "Players")]
public bool EnableResearch { get => _settings.EnableResearch; set => SetValue(ref _settings.EnableResearch, value); }
[Torch.Views.Display(Description = "Enables Good.bot hints.", Name = "Enable Good.bot hints", GroupName = "Players")]
public bool EnableGoodBotHints { get => _settings.EnableGoodBotHints; set => SetValue(ref _settings.EnableGoodBotHints, value); }
[Torch.Views.Display(Description = "Enables infinite ammunition in survival game mode.", Name = "Enable Infinite Ammunition in Survival", GroupName = "Others")] [Torch.Views.Display(Description = "Enables infinite ammunition in survival game mode.", Name = "Enable Infinite Ammunition in Survival", GroupName = "Others")]
public bool InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); } public bool InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); }

View File

@@ -48,7 +48,8 @@ namespace Torch.Managers.ChatManager
MyMultiplayerBase.SendScriptedChatMessage(ref scripted); MyMultiplayerBase.SendScriptedChatMessage(ref scripted);
} }
else else
MyMultiplayer.Static.SendChatMessage(message); throw new NotImplementedException("Chat system changes broke this");
//MyMultiplayer.Static.SendChatMessage(message);
} }
else if (HasHud) else if (HasHud)
MyHud.Chat.ShowMessage(MySession.Static.LocalHumanPlayer?.DisplayName ?? "Player", message); MyHud.Chat.ShowMessage(MySession.Static.LocalHumanPlayer?.DisplayName ?? "Player", message);
@@ -59,12 +60,6 @@ namespace Torch.Managers.ChatManager
{ {
if (HasHud) if (HasHud)
MyHud.Chat?.ShowMessage(author, message, font); MyHud.Chat?.ShowMessage(author, message, font);
MySession.Static.GlobalChatHistory.GlobalChatHistory.Chat.Enqueue(new MyGlobalChatItem()
{
Author = author,
AuthorFont = font,
Text = message
});
} }
/// <inheritdoc/> /// <inheritdoc/>
@@ -76,7 +71,7 @@ namespace Torch.Managers.ChatManager
{ {
_chatMessageRecievedReplacer = _chatMessageReceivedFactory.Invoke(); _chatMessageRecievedReplacer = _chatMessageReceivedFactory.Invoke();
_scriptedChatMessageRecievedReplacer = _scriptedChatMessageReceivedFactory.Invoke(); _scriptedChatMessageRecievedReplacer = _scriptedChatMessageReceivedFactory.Invoke();
_chatMessageRecievedReplacer.Replace(new Action<ulong, string>(Multiplayer_ChatMessageReceived), _chatMessageRecievedReplacer.Replace(new Action<ulong, string, ChatChannel, long, string>(Multiplayer_ChatMessageReceived),
MyMultiplayer.Static); MyMultiplayer.Static);
_scriptedChatMessageRecievedReplacer.Replace( _scriptedChatMessageRecievedReplacer.Replace(
new Action<string, string, string>(Multiplayer_ScriptedChatMessageReceived), MyMultiplayer.Static); new Action<string, string, string>(Multiplayer_ScriptedChatMessageReceived), MyMultiplayer.Static);
@@ -130,12 +125,12 @@ namespace Torch.Managers.ChatManager
} }
private void Multiplayer_ChatMessageReceived(ulong steamUserId, string message) private void Multiplayer_ChatMessageReceived(ulong steamUserId, string messageText, ChatChannel channel, long targetId, string customAuthorName)
{ {
var torchMsg = new TorchChatMessage(steamUserId, message, var torchMsg = new TorchChatMessage(steamUserId, $"[{channel}] {messageText}",
(steamUserId == MyGameService.UserId) ? MyFontEnum.DarkBlue : MyFontEnum.Blue); (steamUserId == MyGameService.UserId) ? MyFontEnum.DarkBlue : MyFontEnum.Blue);
if (!RaiseMessageRecieved(torchMsg) && HasHud) if (!RaiseMessageRecieved(torchMsg) && HasHud)
_hudChatMessageReceived.Invoke(MyHud.Chat, steamUserId, message); _hudChatMessageReceived.Invoke(MyHud.Chat, steamUserId, $"[{channel}] {messageText}");
} }
private void Multiplayer_ScriptedChatMessageReceived(string message, string author, string font) private void Multiplayer_ScriptedChatMessageReceived(string message, string author, string font)

View File

@@ -137,13 +137,13 @@ namespace Torch.Managers.ChatManager
return consumed; return consumed;
} }
private void MpStaticChatMessageReceived(ulong a, string b) private void MpStaticChatMessageReceived(ulong steamUserId, string messageText, ChatChannel channel, long targetId, string customAuthorName)
{ {
var tmp = false; var tmp = false;
RaiseMessageRecieved(new ChatMsg() RaiseMessageRecieved(new ChatMsg
{ {
Author = a, Author = steamUserId,
Text = b Text = messageText
}, ref tmp); }, ref tmp);
} }

View File

@@ -277,7 +277,7 @@ namespace Torch
MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out checkpointSize); MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out checkpointSize);
if (MySession.IsCompatibleVersion(checkpoint)) if (MySession.IsCompatibleVersion(checkpoint))
{ {
if (MyWorkshop.DownloadWorldModsBlocking(checkpoint.Mods).Success) if (MyWorkshop.DownloadWorldModsBlocking(checkpoint.Mods, null).Success)
{ {
// MySpaceAnalytics.Instance.SetEntry(MyGameEntryEnum.Load); // MySpaceAnalytics.Instance.SetEntry(MyGameEntryEnum.Load);
MySession.Load(sessionPath, checkpoint, checkpointSize); MySession.Load(sessionPath, checkpoint, checkpointSize);