From 0634ae78fc20194ab594ca61a26b8bf8ac94c564 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Thu, 25 Jul 2024 07:04:21 +1000 Subject: [PATCH] Object::init - avoid throwing if 'scripts' parameter isn't an array for some reason --- source/game/StarCommandProcessor.cpp | 2 +- source/game/StarObject.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/game/StarCommandProcessor.cpp b/source/game/StarCommandProcessor.cpp index 46222ce..14413b4 100644 --- a/source/game/StarCommandProcessor.cpp +++ b/source/game/StarCommandProcessor.cpp @@ -209,7 +209,7 @@ String CommandProcessor::timewarp(ConnectionId connectionId, String const& argum return "Great Scott! We can't go back in time!"; m_universe->universeClock()->adjustTime(time); - return strf("It's just a jump to the {}...", time > 0.0 ? "left" : "right"); + return time > 0.0 ? "It's just a jump to the left..." : "And then a step to the right..."; } catch (BadLexicalCast const&) { return strf("Could not parse the argument {} as a time adjustment", arguments[0]); } diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp index 3172c97..847f7c5 100644 --- a/source/game/StarObject.cpp +++ b/source/game/StarObject.cpp @@ -188,7 +188,7 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) { setKeepAlive(configValue("keepAlive", false).toBool()); - auto scripts = jsonToStringList(configValue("scripts", JsonArray()).toArray()); + StringList scripts = configValue("scripts", JsonArray()).optArray().apply(jsonToStringList).value(m_config->scripts); m_scriptComponent.setScripts(scripts.transformed(bind(AssetPath::relativeTo, m_config->path, _1))); m_scriptComponent.setUpdateDelta(configValue("scriptDelta", 5).toInt());