summaryrefslogtreecommitdiff
path: root/lib/Properties.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/Properties.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs
index e6a3384..50fec53 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -15,7 +15,7 @@ import Tiled2 (HasProperties (adjustProperties, getProperties),
import Util (layerIsEmpty, prettyprint)
import Data.Maybe (fromMaybe)
-import LintConfig (LintConfig (configAssemblyTag))
+import LintConfig (LintConfig (..))
import LintWriter (LintWriter, adjust, askContext, askFileDepth,
complain, dependsOn, forbid, lintConfig,
offersEntrypoint, suggest, warn)
@@ -62,7 +62,18 @@ checkMap = do
-- longer function same as checkLayerProperty.
checkMapProperty :: Property -> LintWriter Tiledmap
checkMapProperty (Property name _value) = case name of
- "script" -> isForbidden
+ "script" -> do
+ -- this is kind of stupid, since if we also inject script this
+ -- will be overriden anyways, but it also doesn't really hurt I guess
+ -- TODO: perhaps include an explanation in the lint, or allow
+ -- exactly that one value?
+ lintConfig configAllowScripts >>= \case
+ False -> isForbidden
+ True -> pure ()
+ lintConfig configScriptInject >>= \case
+ Nothing -> pure ()
+ Just url -> setProperty "script" url
+
_ -> complain $ "unknown map property " <> prettyprint name
where
-- | this property is forbidden and should not be used