loud_walking/nodes.lua

194 lines
5.2 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
2016-04-08 13:01:33 -07:00
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)
local node = loud_walking.clone_node("loud_walking:sky_scrith")
node.tiles = {"loud_walking_glass_detail.png"}
2016-04-01 15:16:27 -07:00
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()
2016-04-03 00:08:13 -07:00
pos.x = pos.x + (math.random(-50, 50) * 160)
pos.y = pos.y + (math.random(-50, 50) * 160)
pos.z = pos.z + (math.random(-50, 50) * 160)
2016-04-01 15:16:27 -07:00
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
})
2016-04-03 00:08:13 -07:00
loud_walking.decorations = {}
do
for i, odeco in pairs(minetest.registered_decorations) do
local deco = {}
if odeco.biomes then
deco.biomes = {}
for _, b in pairs(odeco.biomes) do
deco.biomes[b] = true
end
end
deco.deco_type = odeco.deco_type
deco.decoration = odeco.decoration
deco.schematic = odeco.schematic
deco.fill_ratio = odeco.fill_ratio
if odeco.noise_params then
deco.fill_ratio = (odeco.noise_params.scale + odeco.noise_params.offset)
end
local nod = minetest.registered_nodes[deco.decoration]
if nod and nod.groups and nod.groups.flower then
deco.flower = true
end
loud_walking.decorations[#loud_walking.decorations+1] = deco
end
end
local function register_flower(name, desc, biomes, chance)
local groups = {}
groups.snappy = 3
groups.flammable = 2
groups.flower = 1
groups.flora = 1
groups.attached_node = 1
minetest.register_node("loud_walking:" .. name, {
description = desc,
drawtype = "plantlike",
waving = 1,
tiles = {"loud_walking_" .. name .. ".png"},
inventory_image = "loud_walking_" .. name .. ".png",
wield_image = "flowers_" .. name .. ".png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
stack_max = 99,
groups = groups,
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
}
})
local bi = {}
if biomes then
bi = {}
for _, b in pairs(biomes) do
bi[b] = true
end
end
loud_walking.decorations[#loud_walking.decorations+1] = {
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
biomes = bi,
fill_ratio = chance,
flower = true,
decoration = "loud_walking:"..name,
}
end
register_flower("orchid", "Orchid", {"rainforest", "rainforest_swamp"}, 0.025)
register_flower("bird_of_paradise", "Bird of Paradise", {"rainforest", "desertstone_grassland"}, 0.025)
register_flower("gerbera", "Gerbera", {"savanna", "rainforest", "desertstone_grassland"}, 0.005)
2016-04-08 21:35:14 -07:00
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},
},
})