summaryrefslogtreecommitdiff
path: root/mario/portal.lua
blob: 7b9945d2209344f20badc5cfa51abd88e0a34652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
minetest.register_node("mario:portal", {
	description = "Portal",
	drawtype = "glasslike",
	tiles = {"mario_glass.png"},
	paramtype = "light",
	sunlight_propagates = true,
	alpha = 150,
	paramtype2 = "facedir",
	walkable = false,
	is_ground_content = false,
	groups = {cracky = 2,not_in_creative_inventory=1},
})
minetest.register_node("mario:portal_left", {
	description = "Portal Left",
	drawtype = "glasslike",
	tiles = {"mario_border.png"},
	paramtype = "light",
	sunlight_propagates = true,
	paramtype2 = "facedir",
	--walkable = false,
	is_ground_content = false,
	groups = {cracky = 2,not_in_creative_inventory=0},
})
minetest.register_node("mario:portal_right", {
	description = "Portal Right",
	drawtype = "glasslike",
	tiles = {"mario_border.png"},
	paramtype = "light",
	sunlight_propagates = true,
	paramtype2 = "facedir",
	--walkable = false,
	is_ground_content = false,
	groups = {cracky = 2,not_in_creative_inventory=0},
})
minetest.register_abm({
	nodenames = {"mario:portal"},
	interval = 0.5,
	chance = 1,
	action = function(pos, node, active_object_count, active_object_count_wider)
		local objs = minetest.env:get_objects_inside_radius(pos, 1)
		for k, player in pairs(objs) do
			if player:get_player_name() then

				player:setpos({x=pos.x,y=pos.y+12,z=pos.z})
			end
		end
	end
})
minetest.register_abm({
	nodenames = {"mario:portal_left"},
	interval = 0.5,
	chance = 1,
	action = function(pos, node, active_object_count, active_object_count_wider)
		local objs = minetest.env:get_objects_inside_radius(pos, 2)
		for k, player in pairs(objs) do
			if player:get_player_name() then

				player:setpos({x=pos.x+31,y=pos.y+0.5,z=pos.z})
			end
		end
	end
})
minetest.register_abm({
	nodenames = {"mario:portal_right"},
	interval = 0.5,
	chance = 1,
	action = function(pos, node, active_object_count, active_object_count_wider)
		local objs = minetest.env:get_objects_inside_radius(pos, 2)
		for k, player in pairs(objs) do
			if player:get_player_name() then

				player:setpos({x=pos.x-31,y=pos.y+0.5,z=pos.z})
			end
		end
	end
})