From 8864421f321dc74242f0167b85203765e662d0ce Mon Sep 17 00:00:00 2001 From: Tsubasa6848 Date: Mon, 4 Mar 2024 18:07:30 +0800 Subject: [PATCH] feat: leave bed event --- src/EventAPI.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/EventAPI.cpp b/src/EventAPI.cpp index 35151d5..8a6a98f 100644 --- a/src/EventAPI.cpp +++ b/src/EventAPI.cpp @@ -117,6 +117,21 @@ void Export_Event_API() { ); return true; } + case do_hash("onLeaveBed"): { + auto Call = RemoteCall::importAs(eventName, eventId); + eventBus->emplaceListener( + [Call](GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) { + bool result = true; + try { + result = Call(&ev.self()); + } catch (...) {} + if (!result) { + ev.cancel(); + } + } + ); + return true; + } default: return false; }