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

28 lines
948 B
C#
Raw Normal View History

using QSB.ConversationSync.WorldObjects;
2021-12-25 16:29:00 -08:00
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;
2020-10-24 15:31:20 +01:00
2022-03-02 19:46:33 -08:00
namespace QSB.ConversationSync.Messages;
public class ConversationStartEndMessage : QSBWorldObjectMessage<QSBCharacterDialogueTree, (uint playerId, bool start)>
2020-10-24 15:31:20 +01:00
{
public ConversationStartEndMessage(uint playerId, bool start) : base((playerId, start)) { }
2021-12-25 16:29:00 -08:00
2022-03-02 19:46:33 -08:00
public override void OnReceiveRemote()
{
if (Data.start)
2021-12-25 16:29:00 -08:00
{
QSBPlayerManager.GetPlayer(Data.playerId).CurrentCharacterDialogueTree = WorldObject;
WorldObject.AttachedObject.GetInteractVolume().DisableInteraction();
WorldObject.AttachedObject.RaiseEvent(nameof(CharacterDialogueTree.OnStartConversation));
2021-12-25 16:29:00 -08:00
}
2022-03-02 19:46:33 -08: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
}
}