From a48bbb877429b9fcb9013387ed4475bdc49a0600 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 29 Mar 2021 23:41:12 +0100 Subject: [PATCH] add late-player catchup thingy --- QSB/CampfireSync/WorldObjects/QSBCampfire.cs | 3 +++ QSB/Player/Events/PlayerStatesRequestEvent.cs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/QSB/CampfireSync/WorldObjects/QSBCampfire.cs b/QSB/CampfireSync/WorldObjects/QSBCampfire.cs index 0bdb9bee..f06bba91 100644 --- a/QSB/CampfireSync/WorldObjects/QSBCampfire.cs +++ b/QSB/CampfireSync/WorldObjects/QSBCampfire.cs @@ -17,6 +17,9 @@ namespace QSB.CampfireSync.WorldObjects .GetMethod("StartRoasting", BindingFlags.NonPublic | BindingFlags.Instance) .Invoke(AttachedObject, null); + public Campfire.State GetState() + => AttachedObject.GetState(); + public void SetState(Campfire.State newState) => AttachedObject.SetState(newState); } diff --git a/QSB/Player/Events/PlayerStatesRequestEvent.cs b/QSB/Player/Events/PlayerStatesRequestEvent.cs index 78e8cb01..74fec7ee 100644 --- a/QSB/Player/Events/PlayerStatesRequestEvent.cs +++ b/QSB/Player/Events/PlayerStatesRequestEvent.cs @@ -1,4 +1,5 @@ using OWML.Utils; +using QSB.CampfireSync.WorldObjects; using QSB.Events; using QSB.Messaging; using QSB.QuantumSync; @@ -81,6 +82,11 @@ namespace QSB.Player.Events { QSBEventManager.FireEvent(EventNames.QSBQuantumAuthority, i, list[i].ControllingPlayer); } + + foreach (var campfire in QSBWorldSync.GetWorldObjects()) + { + QSBEventManager.FireEvent(EventNames.QSBCampfireState, campfire.ObjectId, campfire.GetState()); + } } } } \ No newline at end of file