aboutsummaryrefslogtreecommitdiff
path: root/API.md
diff options
context:
space:
mode:
authorPierre-Yves Rollo <dev@pyrollo.com>2018-12-09 17:24:46 +0100
committerPierre-Yves Rollo <dev@pyrollo.com>2018-12-09 17:24:46 +0100
commitb3c935768f7760328ee0fa9937c1997dac2b2175 (patch)
tree88825ceb401170a9f7203a2cab35b52a2d62c8f5 /API.md
parent18561210988276fc16aed7fd77ed4be41b1f7e6a (diff)
parentca28c5e8353613aeb97ab8831026c618a0cddabc (diff)
downloaddisplay_modpack_no_craft-b3c935768f7760328ee0fa9937c1997dac2b2175.tar.gz
display_modpack_no_craft-b3c935768f7760328ee0fa9937c1997dac2b2175.zip
Merge branch 'master' into dev
Diffstat (limited to 'API.md')
-rw-r--r--API.md22
1 files changed, 10 insertions, 12 deletions
diff --git a/API.md b/API.md
index 0d52e29..b214585 100644
--- a/API.md
+++ b/API.md
@@ -11,7 +11,7 @@ This method triggers entities update for the display node at pos. Actual entity
### register\_display\_entity
**display\_lib.register\_display\_entity(entity_name)**
-This is a helper to register entities used for display.
+This is a helper to register entities used for display.
`entity_name`: Name of the entity to register.
## Provided callback implementations
@@ -26,7 +26,7 @@ This is a helper to register entities used for display.
### on_destruct
**display\_lib.on_destruct(pos)**
-`on_destruct` node callback implementation. Display nodes should have this callback (removes display entities on node destruction).
+`on_destruct` node callback implementation. Display nodes should have this callback (removes display entities on node destruction).
### on_rotate
**display\_lib.on\_rotate(pos, node, user, mode, new_param2)**
@@ -34,22 +34,20 @@ This is a helper to register entities used for display.
### on_activate
**display\_lib.on_activate(entity, staticdata)**
-`On_activate` entity callback implementation for display entities. No need of this method if display entities have been registered using `register_display_entity` (callback is already set).
+`On_activate` entity callback implementation for display entities. No need of this method if display entities have been registered using `register_display_entity` (callback is already set).
## Howto register a display node
* Register display entities with `register_display_entity`
* Register node with :
- `on_place`, `on_construct`, `on_destruct` and `on_rotate` callbacks using display_api callbacks.
- - `display_modpack_node` group. This will make this node have their entities updated as soon as the mapblock is loaded (Useful after /clearobjects).
+ - `display_api` group. This will make this node have their entities updated as soon as the mapblock is loaded (Useful after /clearobjects).
- a `display_entities` field in node definition containing a entity name indexed table. See below for description of each display_entities fields.
### Display_entities fields
`on_display_update` is a callback in charge of setting up entity texture. If not set, entity will have no texture and will be displayed as unknown item.
-`depth`, `right` and `height` : Entity position regarding to node facedir/wallmounted main axis.
+`depth`, `right` and `height`: Entity position regarding to node facedir/wallmounted main axis.
Values for these fields can be any number between -1.5 and 1.5 (default value is 0).
Position 0,0,0 is the center of the node.
`depth` goes from front (-0.5) to rear (0.5), `height` goes from bottom (-0.5) to top (0.5) and `right` goes from left (-0.5) to right (0.5).
@@ -61,12 +59,12 @@ In order to avoid flickering text, it's better to have text a little behind node
display_api.register_display_entity("mymod:entity1")
display_api.register_display_entity("mymod:entity2")
- function my_display_update1(pos, objref)
+ function my_display_update1(pos, objref)
objref:set_properties({ textures= {"mytexture1.png"},
visual_size = {x=1, y=1} })
end
- function my_display_update2(pos, objref)
+ function my_display_update2(pos, objref)
objref:set_properties({ textures= {"mytexture2.png"},
                        visual_size = {x=1, y=1} })
end
@@ -75,13 +73,13 @@ In order to avoid flickering text, it's better to have text a little behind node
...
paramtype2 = "facedir",
...
- groups = { display_modpack_node = 1, ... },
+ groups = { display_api = 1, ... },
...
display_entities = {
- ["mymod:entity1"] = {
+ ["mymod:entity1"] = {
depth = 0.3,
on_display_update = my_display_update1 },
- ["mymod:entity1"] = {
+ ["mymod:entity1"] = {
depth = 0.2, height = 0.1,
on_display_update = my_display_update2 },
},