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

summaryrefslogtreecommitdiff
path: root/source/game/StarObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarObject.cpp')
-rw-r--r--source/game/StarObject.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp
index fe1f3f3..3172c97 100644
--- a/source/game/StarObject.cpp
+++ b/source/game/StarObject.cpp
@@ -110,6 +110,8 @@ Object::Object(ObjectConfigConstPtr config, Json const& parameters) {
m_netGroup.setNeedsLoadCallback(bind(&Object::getNetStates, this, _1));
m_netGroup.setNeedsStoreCallback(bind(&Object::setNetStates, this));
+
+ m_clientEntityMode = ClientEntityModeNames.getLeft(configValue("clientEntityMode", "ClientSlaveOnly").toString());
}
Json Object::diskStore() const {
@@ -127,6 +129,10 @@ EntityType Object::entityType() const {
return EntityType::Object;
}
+ClientEntityMode Object::clientEntityMode() const {
+ return m_clientEntityMode;
+}
+
void Object::init(World* world, EntityId entityId, EntityMode mode) {
Entity::init(world, entityId, mode);
// Only try and find a new orientation if we do not already have one,
@@ -182,7 +188,8 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
setKeepAlive(configValue("keepAlive", false).toBool());
- m_scriptComponent.setScripts(m_config->scripts);
+ auto scripts = jsonToStringList(configValue("scripts", JsonArray()).toArray());
+ m_scriptComponent.setScripts(scripts.transformed(bind(AssetPath::relativeTo, m_config->path, _1)));
m_scriptComponent.setUpdateDelta(configValue("scriptDelta", 5).toInt());
m_scriptComponent.addCallbacks("object", makeObjectCallbacks());