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

summaryrefslogtreecommitdiff
path: root/source/game
diff options
context:
space:
mode:
Diffstat (limited to 'source/game')
-rw-r--r--source/game/StarObject.cpp8
-rw-r--r--source/game/StarObject.hpp3
2 files changed, 10 insertions, 1 deletions
diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp
index fe1f3f3..269181e 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,7 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
setKeepAlive(configValue("keepAlive", false).toBool());
- m_scriptComponent.setScripts(m_config->scripts);
+ m_scriptComponent.setScripts(jsonToStringList(configValue("scripts", JsonArray()).toArray()));
m_scriptComponent.setUpdateDelta(configValue("scriptDelta", 5).toInt());
m_scriptComponent.addCallbacks("object", makeObjectCallbacks());
diff --git a/source/game/StarObject.hpp b/source/game/StarObject.hpp
index 6483a27..a797842 100644
--- a/source/game/StarObject.hpp
+++ b/source/game/StarObject.hpp
@@ -40,6 +40,7 @@ public:
ByteArray netStore();
virtual EntityType entityType() const override;
+ virtual ClientEntityMode clientEntityMode() const override;
virtual void init(World* world, EntityId entityId, EntityMode mode) override;
virtual void uninit() override;
@@ -267,6 +268,8 @@ private:
NetElementHashMap<String, Json> m_scriptedAnimationParameters;
NetElementData<List<DamageSource>> m_damageSources;
+
+ ClientEntityMode m_clientEntityMode;
};
}