From dab179e3551e0eb051af53c747e460a6a28262a3 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 13 Apr 2024 15:49:37 +1000 Subject: [PATCH] add player.mode, player.setMode removed two unnecessary (not from vanilla) functions, use root.(get/get)ConfigurationPath instead. --- source/game/scripting/StarPlayerLuaBindings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/game/scripting/StarPlayerLuaBindings.cpp b/source/game/scripting/StarPlayerLuaBindings.cpp index 749b61d..d303c94 100644 --- a/source/game/scripting/StarPlayerLuaBindings.cpp +++ b/source/game/scripting/StarPlayerLuaBindings.cpp @@ -117,6 +117,9 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { player->setPersonality(parsePersonality(newPersonality, personalityConfig)); }); + callbacks.registerCallback( "mode", [player]() { return PlayerModeNames.getRight(player->modeType()); }); + callbacks.registerCallback("setMode", [player](String const& modeName) { player->setModeType(PlayerModeNames.getLeft(modeName)); }); + callbacks.registerCallback( "interactRadius", [player]() { return player->interactRadius(); }); callbacks.registerCallback("setInteractRadius", [player](float radius) { player->setInteractRadius(radius); }); @@ -207,9 +210,6 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { auto itemDatabase = Root::singleton().itemDatabase(); player->inventory()->setItem(slot, itemDatabase->item(ItemDescriptor(item))); }); - - callbacks.registerCallback("pickupToActionBar", []() { return Root::singleton().configuration()->getPath("inventory.pickupToActionBar").toBool(); }); - callbacks.registerCallback("setPickupToActionBar", [](bool b) { Root::singleton().configuration()->setPath("inventory.pickupToActionBar", b); }); callbacks.registerCallback("setDamageTeam", [player](String const& typeName, Maybe teamNumber) { player->setTeam(EntityDamageTeam(TeamTypeNames.getLeft(typeName), teamNumber.value(0)));