2021-03-29 22:36:51 +00:00
|
|
|
|
using QSB.CampfireSync.WorldObjects;
|
|
|
|
|
using QSB.Events;
|
|
|
|
|
using QSB.Patches;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.CampfireSync.Patches
|
|
|
|
|
{
|
2021-03-29 22:37:36 +00:00
|
|
|
|
internal class CampfirePatches : QSBPatch
|
2021-03-29 22:36:51 +00:00
|
|
|
|
{
|
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
|
|
2021-06-18 20:54:32 +00:00
|
|
|
|
public override void DoPatches() => Prefix(nameof(Campfire_OnPressInteract));
|
2021-03-29 22:36:51 +00:00
|
|
|
|
|
|
|
|
|
public static bool Campfire_OnPressInteract(Campfire __instance, Campfire.State ____state)
|
|
|
|
|
{
|
|
|
|
|
var qsbCampfire = QSBWorldSync.GetWorldFromUnity<QSBCampfire, Campfire>(__instance);
|
|
|
|
|
if (____state == Campfire.State.LIT)
|
|
|
|
|
{
|
|
|
|
|
qsbCampfire.StartRoasting();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
qsbCampfire.SetState(Campfire.State.LIT);
|
|
|
|
|
QSBEventManager.FireEvent(EventNames.QSBCampfireState, qsbCampfire.ObjectId, Campfire.State.LIT);
|
|
|
|
|
Locator.GetFlashlight().TurnOff(false);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|