loud_walking/nodes.lua

459 lines
13 KiB
Lua

local get_node_or_nil = minetest.get_node_or_nil
local get_item_group = minetest.get_item_group
local light_max = 12
local max_depth = 31000
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 = loud_walking.baseline + math.floor(loud_walking.pod_size.y / 2) - 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},
},
})
do
local n = loud_walking.clone_node('air')
n.drowning = 1
minetest.register_node('loud_walking:vacuum', n)
end
-- Polluted dirt
newnode = loud_walking.clone_node("default:dirt")
newnode.description = "Polluted Dirt"
newnode.tiles = {"default_dirt.png^[colorize:#100020:100"}
newnode.groups.soil = 0
minetest.register_node("loud_walking:polluted_dirt", newnode)
-- Bare branches
minetest.register_node('loud_walking:sticks_default', {
description = 'Sticks',
drawtype = 'allfaces_optional',
waving = 1,
visual_scale = 1.3,
tiles = {'loud_walking_dry_twigs.png'},
paramtype = 'light',
is_ground_content = false,
drop = 'default:stick 2',
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
})
-- Black leaves
newnode = loud_walking.clone_node("default:leaves")
newnode.description = "Blackened Leaves"
newnode.tiles = {"default_leaves.png^[colorize:#100020:200"}
newnode.special_tiles = {"default_leaves_simple.png^[colorize:#100020:200"}
newnode.groups = {snappy = 3, flammable = 2}
minetest.register_node("loud_walking:leaves_black", newnode)
minetest.register_node("loud_walking:water_poison_source", {
description = "Poisonous Water",
drawtype = "liquid",
tiles = {
{
name = "loud_walking_water_poison_source_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{
name = "loud_walking_water_poison_source_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
alpha = 160,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "loud_walking:water_poison_flowing",
liquid_alternative_source = "loud_walking:water_poison_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 108, g = 128, b = 64},
groups = {water = 3, liquid = 3, cools_lava = 1, poison = 4},
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("loud_walking:water_poison_flowing", {
description = "Poisonous Water",
drawtype = "flowingliquid",
tiles = {"loud_walking_water_poison.png"},
special_tiles = {
{
name = "loud_walking_water_poison_flowing_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
{
name = "loud_walking_water_poison_flowing_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
},
alpha = 160,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "loud_walking:water_poison_flowing",
liquid_alternative_source = "loud_walking:water_poison_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 108, g = 128, b = 64},
groups = {water = 3, liquid = 3, not_in_creative_inventory = 1,
cools_lava = 1, poison = 3},
sounds = default.node_sound_water_defaults(),
})
bucket.register_liquid(
"loud_walking:water_poison_source",
"loud_walking:water_poison_flowing",
"loud_walking:bucket_poison",
"bucket_poison.png",
"Poison Bucket",
{}
)
minetest.register_node("loud_walking:basalt", {
description = "Basalt",
tiles = {"loud_walking_basalt.png"},
is_ground_content = true,
groups = {cracky=1, level=2},
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
minetest.register_alias('loud_walking:basalt_raw', 'loud_walking:basalt')
minetest.register_node("loud_walking:granite", {
description = "Granite",
tiles = {"loud_walking_granite.png"},
is_ground_content = true,
groups = {cracky=1, level=3},
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
minetest.register_alias('loud_walking:granite_raw', 'loud_walking:granite')
newnode = loud_walking.clone_node("default:stone")
newnode.tiles = {'loud_walking_cracked_stone.png'}
minetest.register_node('loud_walking:cracked_stone', newnode)
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
wherein = "loud_walking:cracked_stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 1,
clust_size = 1,
y_min = 1,
y_max = 10,
})
newnode = loud_walking.clone_node("default:dry_shrub")
newnode.tiles = {'loud_walking_black_shrub.png'}
minetest.register_node('loud_walking:blackened_shrub', newnode)
do
local size_name = 1
for size = 1, 4 do
local name = 'loud_walking:stone_spike_'..size_name
minetest.register_node(name, {
description = "Stone Spike",
tiles = {"loud_walking_spike_1.png"},
inventory_image = "loud_walking_spike_1.png",
wield_image = "loud_walking_spike_1.png",
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
--light_source = 3,
paramtype = "light",
drawtype = "plantlike",
walkable = true,
buildable_to = true,
visual_scale = size,
selection_box = {
type = "fixed",
fixed = {-0.3*size, -0.5, -0.3*size, 0.3*size, -5/16, 0.3*size},
}
})
size_name = size_name + 1
end
end
minetest.register_node('loud_walking:fur_tree', {
description = "Fur Fronds",
tiles = {"loud_walking_fur_frond.png"},
inventory_image = "loud_walking_fur_frond.png",
wield_image = "loud_walking_fur_frond.png",
is_ground_content = true,
groups = {choppy=3},
sounds = default.node_sound_wood_defaults(),
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
--visual_scale = 2,
selection_box = {
type = "fixed",
fixed = {-0.1, -0.5, -0.1, 0.1, 0.5, 0.1},
}
})
newnode = loud_walking.clone_node("default:dirt_with_grass")
newnode.groups.spreading_dirt_type = nil
newnode.tiles = {"loud_walking_odd_grass_1.png", "default_dirt.png",
{name = "default_dirt.png^loud_walking_odd_grass_1.png",
tileable_vertical = false}}
minetest.register_node('loud_walking:dirt_with_odd_grass', newnode)
minetest.register_node("loud_walking:strange_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 = { snappy = 3, flower = 1, flora = 1, attached_node = 1, },
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("loud_walking:strange_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 = { snappy = 3, flora = 1, attached_node = 1, },
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})