loud_walking/nodes.lua

194 lines
6.2 KiB
Lua

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(),
})
minetest.register_node("loud_walking:sky_scrith", {
description = "Transparent Scrith",
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = {"loud_walking_sky_glass.png"},
light_source = 1,
use_texture_alpha = true,
is_ground_content = false,
groups = {},
sounds = default.node_sound_stone_defaults(),
})
local node = loud_walking.clone_node("loud_walking:sky_scrith")
node.tiles = {"loud_walking_cloud_glass.png"}
minetest.register_node("loud_walking:cloud_scrith", node)
node = loud_walking.clone_node("loud_walking:sky_scrith")
node.tiles = {"loud_walking_glass_detail.png"}
minetest.register_node("loud_walking:transparent_scrith", node)
node = loud_walking.clone_node("air")
node.light_source = minetest.LIGHT_MAX
minetest.register_node("loud_walking:light_air", node)
minetest.register_node("loud_walking:control_floor", {
description = "Floor",
paramtype = "light",
tiles = {"loud_walking_control_floor.png"},
light_source = minetest.LIGHT_MAX,
use_texture_alpha = true,
is_ground_content = false,
groups = {},
sounds = default.node_sound_stone_defaults(),
})
node = loud_walking.clone_node("loud_walking:control_floor")
node.tiles = { "loud_walking_control_floor.png", "loud_walking_control_floor_alert.png", "loud_walking_control_floor.png"}
minetest.register_node("loud_walking:control_floor_alert_down", node)
node = loud_walking.clone_node("loud_walking:control_floor")
node.tiles = {"loud_walking_control_floor_alert.png", "loud_walking_control_floor.png", "loud_walking_control_floor.png"}
minetest.register_node("loud_walking:control_floor_alert_up", node)
node.tiles = {"loud_walking_control_floor_alert.png", "loud_walking_control_floor_alert.png", "loud_walking_control_floor.png"}
minetest.register_node("loud_walking:control_floor_alert_both", node)
node.tiles = {"loud_walking_strange_growth.png", "loud_walking_control_floor.png", "loud_walking_control_floor.png"}
minetest.register_node("loud_walking:control_floor_growth", node)
minetest.register_node("loud_walking:control_wall", {
description = "Wall",
paramtype = "light",
tiles = {"loud_walking_control_wall.png"},
use_texture_alpha = true,
light_source = minetest.LIGHT_MAX,
is_ground_content = false,
groups = {},
sounds = default.node_sound_stone_defaults(),
})
loud_walking.control_fun = 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
minetest.chat_send_player(puncher:get_player_name(), "Prepare for transport...")
local pos = {x=50000, y=50000, z=50000}
while pos.x > 31000 or pos.x < -31000 do
pos.x = math.random(-100, 100) * loud_walking.fcsize.x + math.floor(loud_walking.pod_size.x / 2)
end
while pos.y > 31000 or pos.y < -31000 do
pos.y = math.random(-100, 100) * loud_walking.fcsize.y + math.floor(loud_walking.pod_size.y - 3)
end
while pos.z > 31000 or pos.z < -31000 do
pos.z = math.random(-100, 100) * loud_walking.fcsize.z + math.floor(loud_walking.pod_size.z / 2)
end
puncher:setpos(pos)
elseif sr == 6 then
minetest.chat_send_player(puncher:get_player_name(), "Infectious organism detected. Sterilizing area...")
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
minetest.chat_send_player(puncher:get_player_name(), "Repairing injured animal...")
puncher:set_hp(20)
elseif sr == 8 then
minetest.chat_send_player(puncher:get_player_name(), "Reseting chronometers...")
minetest.set_timeofday(math.random(100)/100)
elseif sr == 9 then
minetest.chat_send_player(puncher:get_player_name(), "Escaped animal detected. Ejecting...")
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
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 = loud_walking.control_fun,
})
minetest.register_node("loud_walking:air_ladder", {
description = "Air Ladder",
drawtype = "glasslike",
tiles = {"loud_walking_air_ladder.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
use_texture_alpha = true,
climbable = true,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})
minetest.register_node("loud_walking:control_plant_1", {
description = "Strange Plant",
drawtype = "plantlike",
waving = 1,
tiles = {"loud_walking_strange_plant_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})
minetest.register_node("loud_walking:control_plant_2", {
description = "Strange Plant",
drawtype = "plantlike",
waving = 1,
tiles = {"loud_walking_strange_plant_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})