| 25 | } |
| 26 | |
| 27 | void PlayerDeployment::init(Entity* player, World* world) { |
| 28 | m_world = world; |
| 29 | |
| 30 | if (m_deploying) { |
| 31 | m_deployed = true; |
| 32 | m_deploying = false; |
| 33 | } else { |
| 34 | m_deployed = false; |
| 35 | } |
| 36 | |
| 37 | m_scriptComponent.setScripts(jsonToStringList(m_config.getArray("scripts", JsonArray()))); |
| 38 | m_scriptComponent.setUpdateDelta(m_config.getInt("scriptDelta", 10)); |
| 39 | |
| 40 | m_scriptComponent.addCallbacks("entity", LuaBindings::makeEntityCallbacks(player)); |
| 41 | m_scriptComponent.addCallbacks("player", LuaBindings::makePlayerCallbacks(as<Player>(player))); |
| 42 | m_scriptComponent.addCallbacks("status", LuaBindings::makeStatusControllerCallbacks(as<Player>(player)->statusController())); |
| 43 | m_scriptComponent.addCallbacks("config", |
| 44 | LuaBindings::makeConfigCallbacks([this](String const& name, Json const& def) { return m_config.query(name, def); })); |
| 45 | |
| 46 | m_scriptComponent.init(world); |
| 47 | } |
| 48 | |
| 49 | bool PlayerDeployment::canDeploy() { |
| 50 | Maybe<bool> res = m_scriptComponent.invoke<bool>("canDeploy"); |
nothing calls this directly
no test coverage detected