From 86f6dbf302fa79593b1e979c8d1924486db48375 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Wed, 10 Apr 2024 14:40:45 +0200 Subject: [PATCH] added Pocket --- src/kernel/pocket/Pocket.hx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/kernel/pocket/Pocket.hx diff --git a/src/kernel/pocket/Pocket.hx b/src/kernel/pocket/Pocket.hx new file mode 100644 index 0000000..c2d63e7 --- /dev/null +++ b/src/kernel/pocket/Pocket.hx @@ -0,0 +1,34 @@ +package kernel.pocket; + +using tink.CoreApi; + +class Pocket { + public static function isPocket():Bool { + return cc.Pocket != null; + } + + /** + Search the player's inventory for another upgrade, replacing the existing one with that item if found. + This inventory search starts from the player's currently selected slot, allowing you to prioritise upgrades. + **/ + public static function equipBack():Outcome { + var r = cc.Pocket.equipBack(); + if (r.successful) { + return Success(Noise); + } + + return Failure(r.error); + } + + /** + Remove the pocket computer's current upgrade. + **/ + public static function unequipBack():Outcome { + var r = cc.Pocket.unequipBack(); + if (r.successful) { + return Success(Noise); + } + + return Failure(r.error); + } +}