]> git.lizzy.rs Git - dragonblocks.git/blob - doc/API.md
Added more detailed info about some methods to the documentation
[dragonblocks.git] / doc / API.md
1 TODO: This Documentation is unfull and partly deprecated!
2 # API Documentation
3 ##      Methods
4                 dragonblocks.addFinalStep(function() : void) : void
5                         Execute the function after all mods are loaded, the player is spawned and the map is generated.
6                 dragonblocks.chatMessage(message : String) : void
7                         Write something into the chatconsole. (alias for dragonblocks.chat.write)
8                 dragonblocks.checkWorldExistance(worldname : String) : Boolean
9                         Check if a world exists or not (secure check)
10                 dragonblocks.checkWorldOwnership(worldname : String) : Boolean
11                         Check if a world is owned by the current user (secure check)
12                 dragonblocks.checkWorldSpelling(worldname : String) : Boolean
13                         Check if a worldname is OK (e.g. does not contain special chacters)
14                 dragonblocks.clearTimer(name : String, meta : Object) : void
15                         Clear a timer set using  dragonblocks.setTimer
16                         meta is the variable the timer is stored in
17                         name is the timer's name (also stored in meta[name] while the timer is running)
18                 dragonblocks.createItemstack(itemstring : String) : dragonblocks.Itemstack
19                         Create an Itemstack object and immediately parse the provided itemstring.
20                 dragonblocks.createWorld(properties : Object) : void
21                         Create and load a world without saving it.
22                 dragonblocks.error(errorstring : String) : void
23                         Throw an error. (errorstring is added to dragonblocks.backlog)
24                 dragonblocks.finalize() : void
25                         Execute the final steps added using dragonblocks.addFinalStep. Not to be used!
26                 dragonblocks.finishTimer(name : String, meta : Object) : void
27                         Immediately finish a timer set using dragonblocks.setTimer
28                         meta is the variable the timer is stored in
29                         name is the timer's name (also stored in meta[name] while the timer is running)
30                 dragonblocks.generateMap() : void
31                         Run the Mapgen selected in the mainmenu. Not to be used.
32                 dragonblocks.getEmptyWorld() : Object
33                         Returns an Empty World save object. Not to be used.
34                 dragonblocks.getModpath(modname : String) : String
35                         Returns the path of an Mod or Gamemod. Use this instead of e.g. "mods/" + modname + "/" + ...
36                 dragonblocks.getNode(x, y) : dragonblocks.MapNode
37                         Returns the MapNode at x, y.
38                         You can use the object to read its properties.
39                 dragonblocks.getPixelManipulator(manip : Array) : dragonblocks.PixelManipulator
40                         Returns an Pixel Manipulator. Same as new dragonblocks.PixelManipulator(manip)
41                         You have to provide a Pixel Manipulator which is then made usable by this function.
42                         For further information on how to use Pixel Manipulators, consult Pixel_Manipulator.md
43                 dragonblocks.getSavestring() : String
44                         Return the save string for the world
45                 dragonblocks.getSound(filename : String) : String
46                         Return the path for an sound file. These files can be placed in the folders mods/*/sounds, game/*/sounds and sounds. If not found, it will just return the filename.
47                 dragonblocks.getTexture(filename : String) : String
48                         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(...)
49                 dragonblocks.getToken() : String
50                         Returns a unique string starting with #
51                         Useful when working with entities as they all need an ID
52                 dragonblocks.getTool(name : String) : dragonblocks.Tool
53                         Returns the tool with the id "name".
54                 dragonblocks.getVersion() : String
55                         Returns the version string (something like "Dragonblocks 3.0")
56                 dragonblocks.isValidItemstring(itemstring : String)
57                         Check if an Itemstring is OK
58                 dragonblocks.log(message : String) : void
59                         Add a message to the backlog.
60                 dragonblocks.gui.toggleLayer() : void
61                         Toggle (show or hide) the Layer. 
62                 dragonblocks.gui.openLayer() : void
63                         Not implemented yet
64                 dragonblocks.gui.showLayer() : void
65                         Show the Layer
66                 dragonblocks.gui.closeLayer() : void
67                         Not implemented yet
68                 dragonblocks.gui.hideLayer() : void
69                         Hide the Layer
70                 dragonblocks.gui.createBox(properties : Object) : Element
71                         Creates a dragonblocks.gui.Box(properties) and returns an object to access it.
72                         Valid properties are closeable : boolean, id : String, scroll : boolean, moveable : boolean, size : String ("big" or "small"), layer : boolean, keylock : boolean
73                 
74 ##      Objects
75                 dragonblocks.availableMods : Array
76                         A list of all mods
77                 dragonblocks.backlog : String
78                         Contains everything logged using dragonblocks.log
79                 dragonblocks.chat : dragonblocks.Chat
80                         The dragonblocks chatconsole.
81                 dragonblocks.chatcommands : Object
82                         Contains all registered chatcommands
83                 dragonblocks.entities : Object
84                         Contains all registered entities
85                 dragonblocks.gamemods : Array
86                         Contains the gamemods
87                 dragonblocks.groups : Object
88                         Contains all registered groups
89                 dragonblocks.items : Object
90                         Contains all registered items
91                 dragonblocks.itemstacks : Object
92                         Contains all created Itemstacks
93                 dragonblocks.keyHandler: dragonblocks.KeyHandler
94                         The Keyhandler
95                 dragonblocks.mods : Array
96                         Contains all loaded mods
97                 dragonblocks.nodes : Object
98                         Contains all registered nodes
99                 dragonblocks.recipes : Array
100                         Contains all registered recipes
101                 dragonblocks.settings : Object
102                         Contains all dragonblocks settings
103                 dragonblocks.skins : Object
104                         Contains all registered skins
105                 dragonblocks.spawnedEntities : Array
106                         Contains all spawned entities
107                 dragonblocks.tools : Object
108                         Contains all registered tools
109                 dragonblocks.worlds : Array
110                         List of saved worlds of logged-in user
111 ##      Classes
112