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

summaryrefslogtreecommitdiff
path: root/source/game/StarObject.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-25 14:00:20 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-25 14:00:20 +1000
commit25b021c0cb8f2748d7676a744e82d796d90dfb8e (patch)
treea5b06a1eedbb9854b92daae406cd6e652df509a8 /source/game/StarObject.cpp
parent7783fc7310e53e8f722356935887f1d44406649d (diff)
More improvements to directives
Error logging is back where it should be
Diffstat (limited to 'source/game/StarObject.cpp')
-rw-r--r--source/game/StarObject.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp
index 0441262..df3ecdf 100644
--- a/source/game/StarObject.cpp
+++ b/source/game/StarObject.cpp
@@ -145,7 +145,19 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
if (isMaster()) {
auto colorName = configValue("color", "default").toString();
- setImageKey("color", colorName);
+ auto colorEnd = colorName.find('?');
+ if (colorEnd != NPos) {
+ setImageKey("color", colorName);
+ m_colorDirectives = colorName.substr(colorEnd);
+ }
+ else
+ m_colorDirectives = "";
+
+ m_directives = "";
+ if (auto directives = configValue("")) {
+ if (directives.isType(Json::Type::String))
+ m_directives.parse(directives.toString());
+ }
if (m_config->lightColors.contains(colorName))
m_lightSourceColor.set(m_config->lightColors.get(colorName));
@@ -1205,10 +1217,15 @@ List<Drawable> Object::orientationDrawables(size_t orientationIndex) const {
m_orientationDrawablesCache = make_pair(orientationIndex, List<Drawable>());
for (auto const& layer : orientation->imageLayers) {
Drawable drawable = layer;
- auto& image = drawable.imagePart().image;
- image = AssetPath::join(image).replaceTags(m_imageKeys, true, "default");
+ auto& imagePart = drawable.imagePart();
+ imagePart.image.directives.clear();
+ imagePart.image = AssetPath::join(imagePart.image).replaceTags(m_imageKeys, true, "default");
+ imagePart.image.directives = layer.imagePart().image.directives;
+ imagePart.addDirectives(m_colorDirectives).addDirectives(m_directives);
+
if (orientation->flipImages)
drawable.scale(Vec2F(-1, 1), drawable.boundBox(false).center() - drawable.position);
+
m_orientationDrawablesCache->second.append(move(drawable));
}
}