From 7978d855b0739e50a61c7f3eb834471a1eec0bfa Mon Sep 17 00:00:00 2001 From: riperiperi Date: Wed, 31 Mar 2021 22:21:14 +0100 Subject: [PATCH] Add chat disable flag, invisible outfit type --- TSOClient/tso.client/UI/Panels/UIChatPanel.cs | 28 ++++++++++++------- .../Engine/Scopes/VMSuitScope.cs | 2 ++ .../tso.simantics/Engine/VMSuitProvider.cs | 2 ++ TSOClient/tso.simantics/Entities/VMEntity.cs | 2 +- .../Primitives/VMChangeSuitOrAccessory.cs | 1 + 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/TSOClient/tso.client/UI/Panels/UIChatPanel.cs b/TSOClient/tso.client/UI/Panels/UIChatPanel.cs index f9466b348..fdff7fc18 100644 --- a/TSOClient/tso.client/UI/Panels/UIChatPanel.cs +++ b/TSOClient/tso.client/UI/Panels/UIChatPanel.cs @@ -23,6 +23,7 @@ using FSO.Common; using FSO.SimAntics.Model.TSOPlatform; using FSO.Common.Rendering.Framework.IO; +using FSO.SimAntics.Model; namespace FSO.Client.UI.Panels { @@ -161,23 +162,30 @@ private void SendMessage(string message) message = message.Replace("\n", ""); if (message != "" && Owner.ActiveEntity != null) { - if (message[0] == '!') + if ((Owner.ActiveEntity.GetValue(VMStackObjectVariable.FlagField2) & (short)VMEntityFlags2.FSODisableChat) != 0) { - Owner.Cheats.SubmitCommand(message); + HistoryDialog.ReceiveEvent(new VMChatEvent(null, VMChatEventType.Generic, "You can't speak right now.")); } else { - if (message == "/trace") + if (message[0] == '!') { - vm.UseSchedule = false; - vm.Trace = new SimAntics.Engine.Debug.VMSyncTrace(); + Owner.Cheats.SubmitCommand(message); } - vm.SendCommand(new VMNetChatCmd + else { - ActorUID = Owner.ActiveEntity.PersistID, - Message = message, - ChannelID = (byte)ActiveChannel - }); + if (message == "/trace") + { + vm.UseSchedule = false; + vm.Trace = new SimAntics.Engine.Debug.VMSyncTrace(); + } + vm.SendCommand(new VMNetChatCmd + { + ActorUID = Owner.ActiveEntity.PersistID, + Message = message, + ChannelID = (byte)ActiveChannel + }); + } } } } diff --git a/TSOClient/tso.simantics/Engine/Scopes/VMSuitScope.cs b/TSOClient/tso.simantics/Engine/Scopes/VMSuitScope.cs index 23a49afac..1a28fa3ae 100644 --- a/TSOClient/tso.simantics/Engine/Scopes/VMSuitScope.cs +++ b/TSOClient/tso.simantics/Engine/Scopes/VMSuitScope.cs @@ -53,6 +53,8 @@ public enum VMPersonSuits DynamicCostume = 25, signnotepad = 26, + FSOInvisible = 128, + Head = 65535 //internal } diff --git a/TSOClient/tso.simantics/Engine/VMSuitProvider.cs b/TSOClient/tso.simantics/Engine/VMSuitProvider.cs index 2f1d9508e..cb401297c 100644 --- a/TSOClient/tso.simantics/Engine/VMSuitProvider.cs +++ b/TSOClient/tso.simantics/Engine/VMSuitProvider.cs @@ -232,6 +232,8 @@ public static object GetSuit(VMStackFrame context, VMSuitScope scope, ushort id) return (ulong)(0x5740000000D); case VMPersonSuits.TeleporterMishap: return (ulong)(male ? 0x2900000000D : 0x4A0000000D); + case VMPersonSuits.FSOInvisible: + return (ulong)0x00000000000; case VMPersonSuits.DynamicDaywear: diff --git a/TSOClient/tso.simantics/Entities/VMEntity.cs b/TSOClient/tso.simantics/Entities/VMEntity.cs index bcfe2160f..033a54a9c 100644 --- a/TSOClient/tso.simantics/Entities/VMEntity.cs +++ b/TSOClient/tso.simantics/Entities/VMEntity.cs @@ -1788,7 +1788,7 @@ public enum VMEntityFlags2 GeneratesLight = 1 << 10, CanGetDirty = 1 << 11, ContributesToAsthetic = 1 << 12, - unused14 = 1 << 13, + FSODisableChat = 1 << 13, ArchitectualWindow = 1 << 14, ArchitectualDoor = 1 << 15 } diff --git a/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs b/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs index 3443260e1..39d884f5f 100644 --- a/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs +++ b/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs @@ -149,6 +149,7 @@ private OutfitType GetOutfitType(VMChangeSuitOrAccessoryOperand operand) case VMPersonSuits.SkeletonMinus: case VMPersonSuits.SkeletonPlus: case VMPersonSuits.TeleporterMishap: + case VMPersonSuits.FSOInvisible: return OutfitType.BODY; default: