diff --git a/src/nat/Lib.kiss b/src/nat/Lib.kiss index 2bcd3a8..fe76a2e 100644 --- a/src/nat/Lib.kiss +++ b/src/nat/Lib.kiss @@ -20,6 +20,11 @@ (print (+ "adding " (the nat.components ,componentType ,c) " as " ,(symbolName componentType) " for " .id ,e)) (dictSet .components ,e ,(symbolName componentType) (tink.Json.stringify (the nat.components ,componentType ,c))))) +(defMacro removeComponent [archive e componentType] + `(withWritableEntry ,archive ,e + (print (+ "removing " ,(symbolName componentType) " component from " .id ,e)) + (.remove .components ,e ,(symbolName componentType)))) + // Retrieve multiple components from an Entity with mutable access. // All components will be serialized after the block is done. (defMacro withWritableComponents [archive e bindings &body body] diff --git a/src/nat/systems/WikipediaImageSystem.kiss b/src/nat/systems/WikipediaImageSystem.kiss index e4f3708..19f7dac 100644 --- a/src/nat/systems/WikipediaImageSystem.kiss +++ b/src/nat/systems/WikipediaImageSystem.kiss @@ -21,7 +21,10 @@ (.urlDecode (url.withoutDirectory)) // Some symbols shouldn't be decoded because they're invalid in file systems! "\"" "%22"))] + // TODO do this with ui.displayMessage (print url "downloading") (assertProcess "curl" ["--output" filePath url]) filePath))) + // Trigger the creation of a new Images component including the wikipedia images + (removeComponent archive e Images) (addTags archive e ["wikipediaProcessed"])))