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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-25 07:04:21 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-25 07:04:21 +1000
commit0634ae78fc20194ab594ca61a26b8bf8ac94c564 (patch)
tree06efdb76858b2016687f93d13954e3710bff6c3e
parent6dd49fb69ac6c3d7db78f7edd7d9ccd445e674d5 (diff)
Object::init - avoid throwing if 'scripts' parameter isn't an array for some reason
-rw-r--r--source/game/StarCommandProcessor.cpp2
-rw-r--r--source/game/StarObject.cpp2
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());