Skip to content

Commit 1d856b7

Browse files
4Evergreen4kwolekr
4Evergreen4
authored andcommittedNov 8, 2013
Add wrapper for minetest.rotate_and_place.
1 parent 3d63492 commit 1d856b7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
 

‎builtin/misc_helpers.lua

+14
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,20 @@ if minetest then
282282
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack)
283283
end
284284
end
285+
286+
287+
--------------------------------------------------------------------------------
288+
--Wrapper for rotate_and_place() to check for sneak and assume Creative mode
289+
--implies infinite stacks when performing a 6d rotation.
290+
--------------------------------------------------------------------------------
291+
292+
293+
minetest.rotate_node = function(itemstack, placer, pointed_thing)
294+
minetest.rotate_and_place(itemstack, placer, pointed_thing,
295+
minetest.setting_getbool("creative_mode"),
296+
{invert_wall = placer:get_player_control().sneak})
297+
return itemstack
298+
end
285299
end
286300

287301
--------------------------------------------------------------------------------

‎doc/lua_api.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,11 @@ minetest.rotate_and_place(itemstack, placer, pointed_thing, infinitestacks, orie
15611561
force_facedir: if true, forcably reset the facedir to north when placing on
15621562
the floor or ceiling
15631563

1564+
minetest.rotate_node(itemstack, placer, pointed_thing)
1565+
^ calls rotate_and_place() with infinitestacks set according to the state of
1566+
the creative mode setting, and checks for "sneak" to set the invert_wall
1567+
parameter.
1568+
15641569
Global objects:
15651570
minetest.env - EnvRef of the server environment and world.
15661571
^ Any function in the minetest namespace can be called using the syntax

0 commit comments

Comments
 (0)