Skip to content
Snippets Groups Projects

Extended scripts support

All threads resolved!
1 file
+ 15
15
Compare changes
  • Side-by-side
  • Inline
+ 15
15
@@ -228,7+228,7 @@
@@ -228,7+228,7 @@
checkObjectProperty :: Object -> Property -> LintWriter Layer
checkObjectProperty :: Object -> Property -> LintWriter Layer
checkObjectProperty obj p@(Property name _) = case name of
checkObjectProperty obj p@(Property name _) = case name of
"url" -> do
"url" -> do
pure ()
pure ()
unless (objectType obj == "website")
unless (objectType obj == "website")
$ complain "\"url\" can only be set for objects of type \"website\""
$ complain "\"url\" can only be set for objects of type \"website\""
"allowApi" -> forbidProperty name
"allowApi" -> forbidProperty name
@@ -261,7+261,7 @@
@@ -261,7+261,7 @@
"default" -> do
"default" -> do
isBool p
isBool p
requireProperty "door"
suggestProperty "door"
"persist" -> do
"persist" -> do
isBool p
isBool p
requireProperty "door"
suggestProperty "door"
"openLayer" -> do
"openLayer" -> do
isString p
isString p
requireProperty "door"
suggestProperty "door"
"closeLayer" -> do
"closeLayer" -> do
isString p
isString p
requireProperty "door"
suggestProperty "door"
"openSound" -> do
"openSound" -> do
isString p
isString p
@@ -278,10 +278,10 @@ checkObjectProperty obj p@(Property name _) = case name of
@@ -278,10 +278,10 @@ checkObjectProperty obj p@(Property name _) = case name of
(dependsOn . Link)
(dependsOn . Link)
(dependsOn . Local)
(dependsOn . Local)
unless (containsProperty obj "soundRadius")
unless (containsProperty obj "soundRadius") $
$ suggest "set \"soundRadius\" to a limit the door sound to a certain area\"."
suggest "set \"soundRadius\" to a limit the door sound to a certain area\"."
requireProperty "door"
suggestProperty "door"
"closeSound" -> do
"closeSound" -> do
isString p
isString p
@@ -289,21 +289,21 @@ checkObjectProperty obj p@(Property name _) = case name of
@@ -289,21 +289,21 @@ checkObjectProperty obj p@(Property name _) = case name of
(dependsOn . Link)
(dependsOn . Link)
(dependsOn . Local)
(dependsOn . Local)
requireProperty "door"
unless (containsProperty obj "soundRadius") $
 
-- Do not suggest again if already suggested for openSound
 
unless (containsProperty obj "openSound") $
 
suggest "set \"soundRadius\" to a limit the door sound to a certain area\"."
 
 
suggestProperty "door"
"soundRadius" -> do
"soundRadius" -> do
isInt p
isInt p
unless (containsProperty obj "soundRadius")
$ suggest "set \"soundRadius\" to a limit the door sound to a certain area\"."
requireProperty "door"
_ -> warn $ "unknown object property " <> prettyprint name <> "."
_ -> warn $ "unknown object property " <> prettyprint name <> "."
where
where
requireProperty req = do
suggestProperty req = do
unless (containsProperty obj req) $
unless (containsProperty obj req) $
complain( "property " <> prettyprint req <> " is required by property " <> prettyprint name <> ".")
suggest( "property " <> prettyprint req <> " is suggested for property " <> prettyprint name <> ".")
-- | Checks a single (custom) property of an objectgroup layer
-- | Checks a single (custom) property of an objectgroup layer
checkObjectGroupProperty :: Property -> LintWriter Layer
checkObjectGroupProperty :: Property -> LintWriter Layer
Loading