diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-06-17 20:22:26 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-06-17 20:22:26 +1000 |
commit | f7d2303fe0b6ca1198c23af7b8e1c809d803d142 (patch) | |
tree | ef2866bba9564a1453dca47faa9746dd0395791b /source/game/StarObject.cpp | |
parent | 6ded71d9eb0690fd55a38d9c7b7582c55ef38ccb (diff) |
add Object::clientEntityMode, & read scripts from params
Suggested by Bott
Diffstat (limited to 'source/game/StarObject.cpp')
-rw-r--r-- | source/game/StarObject.cpp | 8 |
1 files changed, 7 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()); |