MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / init

Method init

source/game/StarPlayerDeployment.cpp:27–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void 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
49bool PlayerDeployment::canDeploy() {
50 Maybe<bool> res = m_scriptComponent.invoke<bool>("canDeploy");

Callers

nothing calls this directly

Calls 8

jsonToStringListFunction · 0.85
setScriptsMethod · 0.80
getArrayMethod · 0.80
setUpdateDeltaMethod · 0.80
getIntMethod · 0.80
addCallbacksMethod · 0.45
statusControllerMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected