Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarTechController.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-08-19 15:54:52 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-08-19 15:54:52 +1000
commitf22eed8304c90418314e254f2569bb87ee5d72fc (patch)
tree237e46e7c155f3b11343b0878cd62611427d9e81 /source/game/StarTechController.cpp
parentb7cddf4f0e3ea7e852782b4200d24b0407797bc0 (diff)
Add player table to tech scripts
Diffstat (limited to 'source/game/StarTechController.cpp')
-rw-r--r--source/game/StarTechController.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/game/StarTechController.cpp b/source/game/StarTechController.cpp
index d62fe14..44c1f37 100644
--- a/source/game/StarTechController.cpp
+++ b/source/game/StarTechController.cpp
@@ -6,6 +6,8 @@
#include "StarWorldLuaBindings.hpp"
#include "StarConfigLuaBindings.hpp"
#include "StarEntityLuaBindings.hpp"
+#include "StarPlayerLuaBindings.hpp"
+#include "StarPlayer.hpp"
#include "StarNetworkedAnimatorLuaBindings.hpp"
#include "StarStatusControllerLuaBindings.hpp"
#include "StarRoot.hpp"
@@ -438,6 +440,7 @@ void TechController::unloadModule(TechModule& techModule) {
techModule.scriptComponent.removeCallbacks("entity");
techModule.scriptComponent.removeCallbacks("animator");
techModule.scriptComponent.removeCallbacks("status");
+ techModule.scriptComponent.removeCallbacks("player");
techModule.scriptComponent.removeActorMovementCallbacks();
}
@@ -450,6 +453,8 @@ void TechController::initializeModules() {
module.scriptComponent.addCallbacks("entity", LuaBindings::makeEntityCallbacks(m_parentEntity));
module.scriptComponent.addCallbacks("animator", LuaBindings::makeNetworkedAnimatorCallbacks(&m_techAnimators.getNetElement(module.animatorId)->animator));
module.scriptComponent.addCallbacks("status", LuaBindings::makeStatusControllerCallbacks(m_statusController));
+ if (auto player = as<Player>(m_parentEntity))
+ module.scriptComponent.addCallbacks("player", LuaBindings::makePlayerCallbacks(player));
module.scriptComponent.addActorMovementCallbacks(m_movementController);
module.scriptComponent.init(m_parentEntity->world());