2020-10-12 15:48:14 +00:00
|
|
|
(local util (require :lib.util))
|
|
|
|
(local lume (require :lib.lume))
|
|
|
|
|
|
|
|
(fn loadtiles []
|
|
|
|
(lume.map
|
|
|
|
(util.readjson "game/tiles.json")
|
|
|
|
#($1:fromhex)))
|
|
|
|
|
|
|
|
(fn savetiles [tiles]
|
|
|
|
(util.writejson
|
|
|
|
"game/tiles.json"
|
|
|
|
(lume.map tiles #($1:tohex))))
|
|
|
|
|
|
|
|
(fn appendtiles [tiles org]
|
|
|
|
(each [_ tile (ipairs tiles)]
|
|
|
|
(org:append [:bytes tile])))
|
|
|
|
|
2020-10-19 00:13:26 +00:00
|
|
|
(fn appendmaps [org]
|
|
|
|
(local map (: (util.readjson "game/map00001.json") :fromhex))
|
|
|
|
(org:append :map [:bytes map]))
|
|
|
|
|
|
|
|
{: loadtiles : savetiles : appendtiles : appendmaps}
|
2020-10-12 15:48:14 +00:00
|
|
|
|