Add example code for sitting on stairs.

This commit is contained in:
Auke Kok 2016-12-16 21:43:58 -08:00
parent f6c6a9d4b9
commit a8029f8a7d
2 changed files with 26 additions and 0 deletions

View File

@ -57,6 +57,12 @@ rotation and offset so that players can easily sit on chairs,
lie on beds or emote-interact with machines (e.g. point emote lie on beds or emote-interact with machines (e.g. point emote
when interacting with a node). when interacting with a node).
## Can I sit on stair blocks with this?
The patch file `sit-on-stairs.patch` in this project is an example
patch for minetest_game that will allow a player to right-click stair
nodes and sit on them as if they were seats.
## License ## License
LGPL-2.1 LGPL-2.1

20
sit-on-stairs.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua
index 191c78d..5759ce5 100644
--- a/mods/stairs/init.lua
+++ b/mods/stairs/init.lua
@@ -77,6 +77,15 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
+ emote = {
+ emotestring = "sit",
+ eye_offset = {x = 0, y = 9, z = 0},
+ player_offset = {x = 3/16, y = 1/16, z = 0},
+ look_horizontal_offset = math.pi,
+ },
+ on_rightclick = function(pos, node, clicker)
+ emote.attach_to_node(clicker, pos, true)
+ end,
})
-- for replace ABM