add Object::clientEntityMode, & read scripts from params
Suggested by Bott
This commit is contained in:
parent
6ded71d9eb
commit
f7d2303fe0
@ -110,6 +110,8 @@ Object::Object(ObjectConfigConstPtr config, Json const& parameters) {
|
|||||||
|
|
||||||
m_netGroup.setNeedsLoadCallback(bind(&Object::getNetStates, this, _1));
|
m_netGroup.setNeedsLoadCallback(bind(&Object::getNetStates, this, _1));
|
||||||
m_netGroup.setNeedsStoreCallback(bind(&Object::setNetStates, this));
|
m_netGroup.setNeedsStoreCallback(bind(&Object::setNetStates, this));
|
||||||
|
|
||||||
|
m_clientEntityMode = ClientEntityModeNames.getLeft(configValue("clientEntityMode", "ClientSlaveOnly").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Object::diskStore() const {
|
Json Object::diskStore() const {
|
||||||
@ -127,6 +129,10 @@ EntityType Object::entityType() const {
|
|||||||
return EntityType::Object;
|
return EntityType::Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientEntityMode Object::clientEntityMode() const {
|
||||||
|
return m_clientEntityMode;
|
||||||
|
}
|
||||||
|
|
||||||
void Object::init(World* world, EntityId entityId, EntityMode mode) {
|
void Object::init(World* world, EntityId entityId, EntityMode mode) {
|
||||||
Entity::init(world, entityId, mode);
|
Entity::init(world, entityId, mode);
|
||||||
// Only try and find a new orientation if we do not already have one,
|
// 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());
|
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.setUpdateDelta(configValue("scriptDelta", 5).toInt());
|
||||||
|
|
||||||
m_scriptComponent.addCallbacks("object", makeObjectCallbacks());
|
m_scriptComponent.addCallbacks("object", makeObjectCallbacks());
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
ByteArray netStore();
|
ByteArray netStore();
|
||||||
|
|
||||||
virtual EntityType entityType() const override;
|
virtual EntityType entityType() const override;
|
||||||
|
virtual ClientEntityMode clientEntityMode() const override;
|
||||||
|
|
||||||
virtual void init(World* world, EntityId entityId, EntityMode mode) override;
|
virtual void init(World* world, EntityId entityId, EntityMode mode) override;
|
||||||
virtual void uninit() override;
|
virtual void uninit() override;
|
||||||
@ -267,6 +268,8 @@ private:
|
|||||||
NetElementHashMap<String, Json> m_scriptedAnimationParameters;
|
NetElementHashMap<String, Json> m_scriptedAnimationParameters;
|
||||||
|
|
||||||
NetElementData<List<DamageSource>> m_damageSources;
|
NetElementData<List<DamageSource>> m_damageSources;
|
||||||
|
|
||||||
|
ClientEntityMode m_clientEntityMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user