[ create a new paste ] login | about

Link: http://codepad.org/7XlOxb70    [ raw code | output | fork ]

Lua, pasted on Oct 12:
---- Warp Code ----

local function warp(pos, i, puncher_name)
	local i = i
	local puncher = puncher_name
	local locp = { x = pos.x, y = pos.y + i, z = pos.z}
	local locplayp = { x = pos.x, y = pos.y + i + 2, z = pos.z}
	local n = minetest.env:get_node(locp).name
      if (n == "waveroad:waveroad_top") then
			puncher:setpos(locplayp)
			print("Warped")
			return true
		else
			print(i)
			return false
	 end
end


---- Node Registration ----

minetest.register_node("waveroad:waveroad_bottom", {
tiles = {{
		name="waveroad_bottom_animated.png",
		animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
	}},
description = "Wave Road Bottom",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
drop = "waveroad:waveroad_bottom",
on_punch = function(pos, node, puncher)
	local i = 1
	print("Punched")
	while not warp(pos, i, puncher:get_player_name()) do
		i = i + 1
		if i > 99 then
			break
		end
	end
	end,
})


Output:
1
2
3
4
line 22: attempt to index global 'minetest' (a nil value)
stack traceback:
	t.lua:22: in main chunk
	[C]: ?


Create a new paste based on this one


Comments: