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

summaryrefslogtreecommitdiff
path: root/source/game/StarObject.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-25 07:21:17 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-25 07:21:17 +1000
commit0638127721a2c5327be65824266f3bb677a89f20 (patch)
tree5b15ba8ea4028ff765106be0c7bddfaa496a87b9 /source/game/StarObject.cpp
parent0634ae78fc20194ab594ca61a26b8bf8ac94c564 (diff)
Update StarObject.cpp
Diffstat (limited to 'source/game/StarObject.cpp')
-rw-r--r--source/game/StarObject.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp
index 847f7c5..753dafc 100644
--- a/source/game/StarObject.cpp
+++ b/source/game/StarObject.cpp
@@ -187,9 +187,12 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
m_liquidCheckTimer.setDone();
setKeepAlive(configValue("keepAlive", false).toBool());
-
- StringList scripts = configValue("scripts", JsonArray()).optArray().apply(jsonToStringList).value(m_config->scripts);
- m_scriptComponent.setScripts(scripts.transformed(bind(AssetPath::relativeTo, m_config->path, _1)));
+
+ auto jScripts = configValue("scripts", JsonArray());
+ StringList scripts = jScripts.isType(Json::Type::Array)
+ ? jsonToStringList(jScripts).transformed(bind(AssetPath::relativeTo, m_config->path, _1))
+ : m_config->scripts;
+ m_scriptComponent.setScripts(scripts);
m_scriptComponent.setUpdateDelta(configValue("scriptDelta", 5).toInt());
m_scriptComponent.addCallbacks("object", makeObjectCallbacks());