From: HimbeerserverDE Date: Tue, 19 May 2020 13:36:36 +0000 (+0200) Subject: Added more detailed info about some methods to the documentation X-Git-Tag: 3.0~1^2~2 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=8b0e916ca740e27eb64c004951fc9587dc2342c2;p=dragonblocks.git Added more detailed info about some methods to the documentation --- diff --git a/doc/API.md b/doc/API.md index 6a0d109..7f21f95 100644 --- a/doc/API.md +++ b/doc/API.md @@ -6,13 +6,15 @@ TODO: This Documentation is unfull and partly deprecated! dragonblocks.chatMessage(message : String) : void Write something into the chatconsole. (alias for dragonblocks.chat.write) dragonblocks.checkWorldExistance(worldname : String) : Boolean - Check if a world exists or not + Check if a world exists or not (secure check) dragonblocks.checkWorldOwnership(worldname : String) : Boolean - Check if a world is owned by the user + Check if a world is owned by the current user (secure check) dragonblocks.checkWorldSpelling(worldname : String) : Boolean Check if a worldname is OK (e.g. does not contain special chacters) dragonblocks.clearTimer(name : String, meta : Object) : void Clear a timer set using dragonblocks.setTimer + meta is the variable the timer is stored in + name is the timer's name (also stored in meta[name] while the timer is running) dragonblocks.createItemstack(itemstring : String) : dragonblocks.Itemstack Create an Itemstack object and immediately parse the provided itemstring. dragonblocks.createWorld(properties : Object) : void @@ -23,6 +25,8 @@ TODO: This Documentation is unfull and partly deprecated! Execute the final steps added using dragonblocks.addFinalStep. Not to be used! dragonblocks.finishTimer(name : String, meta : Object) : void Immediately finish a timer set using dragonblocks.setTimer + meta is the variable the timer is stored in + name is the timer's name (also stored in meta[name] while the timer is running) dragonblocks.generateMap() : void Run the Mapgen selected in the mainmenu. Not to be used. dragonblocks.getEmptyWorld() : Object @@ -31,8 +35,11 @@ TODO: This Documentation is unfull and partly deprecated! Returns the path of an Mod or Gamemod. Use this instead of e.g. "mods/" + modname + "/" + ... dragonblocks.getNode(x, y) : dragonblocks.MapNode Returns the MapNode at x, y. + You can use the object to read its properties. dragonblocks.getPixelManipulator(manip : Array) : dragonblocks.PixelManipulator Returns an Pixel Manipulator. Same as new dragonblocks.PixelManipulator(manip) + You have to provide a Pixel Manipulator which is then made usable by this function. + For further information on how to use Pixel Manipulators, consult Pixel_Manipulator.md dragonblocks.getSavestring() : String Return the save string for the world dragonblocks.getSound(filename : String) : String @@ -41,6 +48,7 @@ TODO: This Documentation is unfull and partly deprecated! Same as dragonblocks.getSound, exept for Textures and, if the file is found, it will surrond it with url() so you can do elem.style.background = dragonblocks.getTexture(...) dragonblocks.getToken() : String Returns a unique string starting with # + Useful when working with entities as they all need an ID dragonblocks.getTool(name : String) : dragonblocks.Tool Returns the tool with the id "name". dragonblocks.getVersion() : String @@ -50,11 +58,13 @@ TODO: This Documentation is unfull and partly deprecated! dragonblocks.log(message : String) : void Add a message to the backlog. dragonblocks.gui.toggleLayer() : void - Toggle the Layer. + Toggle (show or hide) the Layer. dragonblocks.gui.openLayer() : void + Not implemented yet dragonblocks.gui.showLayer() : void - Open the Layer + Show the Layer dragonblocks.gui.closeLayer() : void + Not implemented yet dragonblocks.gui.hideLayer() : void Hide the Layer dragonblocks.gui.createBox(properties : Object) : Element @@ -100,36 +110,3 @@ TODO: This Documentation is unfull and partly deprecated! List of saved worlds of logged-in user ## Classes -## Modding tutorial -### dragonblocks.register method -#### dragonblocks.registerEntity - dragonblocks.registerEntity({ - name: "mod_tutorial:entity", // Entitystring - desc: "Tutorial entity", // Entity description - texture: "entity.png", // Entity texture - width: 1, // Entity width - height: 2, // Entity height - verticalSpeed: 6.5, // Entity jump speed (affects height) - horizontalSpeed: 4, // Entity walk speed - gravity: true, // Enable or disable gravity - onspawn: self => { - alert("Entity spawned!"); - } - onpunch: self => { - alert("Entity punched!"); - self.despawn(); // Let entity despawn - } - onclick: self => { - alert("Entity clicked!"); - self.jumpOnce(); // Make entity jump once - } - }); -#### dragonblocks.registerItem - dragonblocks.registerItem({ - name: "mod_tutorial:item", // Itemstring - desc: "Tutorial entity spawner", // Item description - texture: "item.png", // Item texture - onuse: (x, y) => { - let entity = dragonblocks.spawnEntity("mod_tutorial:entity", x, y); // Spawn entity and save it to a variable (for later access) - } - });