diff options
author | orwell96 <orwell@bleipb.de> | 2018-06-14 21:31:35 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-06-14 21:31:35 +0200 |
commit | a758426835f07437da897b9e4a8bab7b6cf0542e (patch) | |
tree | 421cf80dc4c194fbc910f1117e08932a3e2b5910 | |
parent | 712db5bd7f0c5cab71ccdc93b5d5220b1c99173b (diff) | |
download | advtrains-a758426835f07437da897b9e4a8bab7b6cf0542e.tar.gz advtrains-a758426835f07437da897b9e4a8bab7b6cf0542e.tar.bz2 advtrains-a758426835f07437da897b9e4a8bab7b6cf0542e.zip |
Correct some documentation
-rw-r--r-- | advtrains/api_doc.txt | 31 | ||||
-rw-r--r-- | advtrains_luaautomation/README.txt | 2 |
2 files changed, 19 insertions, 14 deletions
diff --git a/advtrains/api_doc.txt b/advtrains/api_doc.txt index 3cb58e5..7bd9c44 100644 --- a/advtrains/api_doc.txt +++ b/advtrains/api_doc.txt @@ -102,7 +102,7 @@ advtrains.register_wagon(name, prototype, description, inventory_image) return "<a formspec>" end, ^- Function that should return the formspec to be displayed when <player> requests to open the wagon's inventory - ^- Use "list[detached:advtrains_wgn_"..self.unique_id..";<list_name>;<X>,<Y>;<W>,<H>;<Start>]" to display a wagon's inventory list. + ^- Use "list[detached:advtrains_wgn_"..self.id..";<list_name>;<X>,<Y>;<W>,<H>;<Start>]" to display a wagon's inventory list. custom_on_step = function(self, dtime) end ^- optional: Execute custom code on every step @@ -116,8 +116,8 @@ advtrains.register_wagon(name, prototype, description, inventory_image) # Notes on wagons -- Every wagon has the field 'unique_id' which assigns each wagon a random id. -- All properties written in the lua entity (self) are saved and restored automatically. Minetest's internal staticdata is only used to save the unique_id of the wagon, which serves as a key in an externally saved table. +- Every wagon has the field 'id' which assigns each wagon a random id. +- Properties written in the Lua Entity (self) are discarded when the wagon entity is unloaded. At the moment there is no way to store data inside a wagon persistently. - Assuming Z Axis as the axis parallel to the tracks and Y Axis as the one pointing into the sky, wagon models should be dimensioned in a way that: - their origin is centered in X and Z direction - their origin lies 0.5 units above the bottom of the model @@ -140,22 +140,27 @@ If you can't enter or leave a train because the doors are closed, holding the Sn Most modders will be satisfied with the built-in tracks. If cog railways, maglev trains and mine trains are added, it is necessary to understand the definition of tracks. Although the tracks API is there, explaining it would require more effort than me creating the wanted definitions myself. Contact me if you need to register your own rails using my registration functions. However, it is still possible to register single rails by understanding the node properties of rails. -minetest.register_node(nodename, { -- TODO this is outdated! +minetest.register_node(nodename, { ... usual node definition ... groups = { + advtrains_track = 1, advtrains_track_<tracktype>=1 - ^- this group tells that the node is a track + ^- these groups tell that the node is a track not_blocking_trains=1, ^- this group tells that the node should not block trains although it's walkable. }, - connect1 = 0, - connect2 = 8, - ^- These values tell the direction (horizontal) the rail ends are pointing to. 0 means +Z, then rotation values increase clockwise. For a translation of directions to positions see helpers.lua. - rely1=0, - rely2=0, - ^- the Y height of the rail end 1/2. A value of >=1 means that the rail end points to the next y layer at rely-1 - railheight=0, - ^- the height value of this rail that is saved in the path. usually the median of rely1 and rely2. + + at_rail_y = 0, + ^- Height of this rail node (the y position of a wagon that stands centered on this rail) + at_conns = { + [1] = { c=0..15, y=0..1 }, + [2] = { c=0..15, y=0..1 }, + ( [3] = { c=0..15, y=0..1 }, ) + ( [4] = { c=0..15, y=0..1 }, ) + } + ^- Connections of this rail. There can be up to 4 connections. + 2 connections are a normal rail, 3 connections a turnout (1->2 and 2/3->1) and 4 connections a crossing (1<>2 and 3<>4) + c is the direction of the connection (0-16) and y is the height of the connection (rail will only connect when this matches) can_dig=function(pos) return not advtrains.get_train_at_pos(pos) diff --git a/advtrains_luaautomation/README.txt b/advtrains_luaautomation/README.txt index faf3cbb..113ff90 100644 --- a/advtrains_luaautomation/README.txt +++ b/advtrains_luaautomation/README.txt @@ -111,7 +111,7 @@ The 'event' table of the init code is always {type="init", init=true}. The Lua-controlled ATC rails are the only components that can actually interface with trains. The following event types are generated: {type="train", train=true, id="<train_id>"} -This event is fired when a train enters the rail. The field 'id' is the unique train ID, which is a long string (generated by concatenating os.time() and os.clock() at creation time). The Itrainmap mod displays the last 4 digits of this ID. +This event is fired when a train enters the rail. The field 'id' is the unique train ID, which is 6-digit random numerical string. {type="int", int=true, message=<message>} Fired when an interrupt set by the 'interrupt' function runs out. 'message' is the message passed to the interrupt function. |