loud_walking/nodes.lua

86 lines
2.4 KiB
Lua
Raw Normal View History

2016-03-31 16:11:15 -07:00
minetest.register_node("loud_walking:plate_glass", {
description = "Plate Glass",
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = {"loud_walking_plate_glass.png"},
light_source = 8,
use_texture_alpha = true,
is_ground_content = false,
groups = {cracky = 3, level=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("loud_walking:scrith", {
description = "Scrith",
paramtype = "light",
tiles = {"default_obsidian.png"},
use_texture_alpha = true,
is_ground_content = false,
groups = {},
sounds = default.node_sound_stone_defaults(),
})
2016-04-01 15:16:27 -07:00
local node = loud_walking.clone_node("default:glass")
node.groups = {}
minetest.register_node("loud_walking:transparent_scrith", node)
minetest.register_node("loud_walking:controls", {
description = "Alien control system",
paramtype = "light",
tiles = {"loud_walking_controls.png"},
use_texture_alpha = true,
is_ground_content = false,
groups = {},
sounds = default.node_sound_stone_defaults(),
on_punch = function(pos, node, puncher, pointed_thing)
if not puncher:is_player() then
return
end
local sr = math.random(20)
if sr < 3 then
puncher:set_hp(puncher:get_hp() - sr)
elseif sr < 6 then
local pos = puncher:getpos()
if sr == 3 then
pos.x = pos.x + (math.random(-50, 50) * 160)
elseif sr == 4 then
pos.y = pos.y + (math.random(-50, 50) * 160)
elseif sr == 5 then
pos.z = pos.z + (math.random(-50, 50) * 160)
end
if pos.x > -31000 and pos.x < 31000 and pos.y > -31000 and pos.y < 31000 and pos.z > -31000 and pos.z < 31000 then
puncher:setpos(pos)
end
elseif sr == 6 then
for z1 = -4, 4 do
for y1 = -4, 4 do
for x1 = -4, 4 do
local p = {x = pos.x + x1, y = pos.y + y1, z = pos.z + z1}
local node = minetest.get_node(p)
if node and node.name == "air" then
minetest.set_node(p, {name="fire:basic_flame"})
end
end
end
end
elseif sr == 7 then
puncher:set_hp(20)
elseif sr == 8 then
minetest.set_timeofday(math.random(100)/100)
elseif sr == 9 then
local pos = puncher:getpos()
for z1 = -1, 1 do
for x1 = -1, 1 do
minetest.set_node({x = pos.x + x1, y = pos.y - 1, z = pos.z + z1}, {name="air"})
end
end
elseif sr == 10 then
minetest.set_node(pos, {name="air"})
else
minetest.chat_send_player(puncher:get_player_name(), "Please do not press this button again.")
end
end
})