]> git.lizzy.rs Git - dragonblocks.git/blobdiff - engine/map_node.js
Code style overhaul
[dragonblocks.git] / engine / map_node.js
index fb17cdc0b55206de19bc6c32e54b1c0c33e36ab7..5bde9c125964234e6451676b65c27ed2fc389f3f 100644 (file)
@@ -1,51 +1,63 @@
 /*
  * map_node.js
- * 
+ *
  * Copyright 2020 Elias Fleckenstein <eliasfleckenstein@web.de>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA 02110-1301, USA.
- * 
- * 
+ *
+ *
  */
-dragonblocks.MapNode = class{
-       constructor(node){
-               if(! node)
+
+dragonblocks.MapNode = class
+{
+       constructor(node)
+       {
+               if (! node)
                        return;
-               if(dragonblocks.nodes[node])
+
+               if (dragonblocks.nodes[node])
                        this.createFromNode(dragonblocks.nodes[node]);
-               else if(node instanceof dragonblocks.Node)
-                       this.createFromNode(node)
-               else if(node instanceof dragonblocks.MapNode)
+               else if (node instanceof dragonblocks.Node)
+                       this.createFromNode(node);
+               else if (node instanceof dragonblocks.MapNode)
                        this.createFromMapNode(node);
                else
-                       dragonblocks.error("Can not create Map Node: Invalid argument.");
+                       dragonblocks.error("Cannot create Map Node: Invalid argument.");
+
                this.tmp = {};
        }
-       createFromNode(node){
+
+       createFromNode(node)
+       {
                this.meta = {};
                this.name = node.name;
                this.stable = node.stable;
                this.mobstable = node.mobstable;
+
                return this;
        }
-       createFromMapNode(mapnode){
+
+       createFromMapNode(mapnode)
+       {
                dblib.copy(this, mapnode);
                return this;
        }
-       toNode(){
+
+       toNode()
+       {
                return dragonblocks.nodes[this.name];
        }
-}
+};