]> git.lizzy.rs Git - dragonblocks.git/blobdiff - engine/map.js
Implement per-map sky
[dragonblocks.git] / engine / map.js
index 7dff2bc09ead0d5b997cf27519aa272ab0e50b49..48c16790a9c434f767ddbd9940a0f3c50b1eaf93 100644 (file)
@@ -37,21 +37,21 @@ dragonblocks.Map = class
        serialize()
        {
                return {
-                       data: this.data,
                        width: this.width,
                        height: this.height,
-                       structures: this.structures,
+                       sky: this.sky,
+                       data: this.data,
                        entities: dblib.removeTmp(this.entities),
+                       structures: this.structures,
                };
        }
 
        deserialize(data)
        {
-               this.data = [];
-
                this.width = data.width;
                this.height = data.height;
-
+               this.sky = data.sky;
+               this.data = [];
                this.entities = [];
                this.structures = data.structures || {};
 
@@ -139,6 +139,13 @@ dragonblocks.Map = class
                        return new dragonblocks.SpawnedEntity(def, this, x, y);
        }
 
+       setSky(sky)
+       {
+               this.sky = sky;
+
+               if (this.active)
+                       dragonblocks.mapMgr.setSky(this.sky);
+       }
 };
 
 dragonblocks.mapMgr = new dragonblocks.ContentMgr(dragonblocks.Map);