quantum-space-buddies/QSB/ConversationSync/Messages/ConversationStartEndMessage.cs

28 lines
948 B
C#
Raw Normal View History

using QSB.ConversationSync.WorldObjects;
2021-12-26 00:29:00 +00:00
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;
2020-10-24 14:31:20 +00:00
2022-03-03 03:46:33 +00:00
namespace QSB.ConversationSync.Messages;
public class ConversationStartEndMessage : QSBWorldObjectMessage<QSBCharacterDialogueTree, (uint playerId, bool start)>
2020-10-24 14:31:20 +00:00
{
public ConversationStartEndMessage(uint playerId, bool start) : base((playerId, start)) { }
2021-12-26 00:29:00 +00:00
2022-03-03 03:46:33 +00:00
public override void OnReceiveRemote()
{
if (Data.start)
2021-12-26 00:29:00 +00:00
{
QSBPlayerManager.GetPlayer(Data.playerId).CurrentCharacterDialogueTree = WorldObject;
WorldObject.AttachedObject.GetInteractVolume().DisableInteraction();
WorldObject.AttachedObject.RaiseEvent(nameof(CharacterDialogueTree.OnStartConversation));
2021-12-26 00:29:00 +00:00
}
2022-03-03 03:46:33 +00:00
else
{
QSBPlayerManager.GetPlayer(Data.playerId).CurrentCharacterDialogueTree = null;
WorldObject.AttachedObject.GetInteractVolume().EnableInteraction();
WorldObject.AttachedObject.RaiseEvent(nameof(CharacterDialogueTree.OnEndConversation));
}
2020-12-02 21:23:01 +00:00
}
}