Remove extraneous features.

master
Duane Robertson 2017-06-25 10:31:21 -05:00
parent fe4c162089
commit 8215986999
43 changed files with 652 additions and 11179 deletions

245
abms.lua
View File

@ -1,245 +0,0 @@
-------------------------------------------------------------------
-- Abms
-------------------------------------------------------------------
-- player surface damage and hunger
local dps_delay = 3
local last_dps_check = 0
local cold_delay = 5
local monster_delay = 3
local hunger_delay = 60
local dps_count = hunger_delay
local time_factor = (loud_walking.time_factor or 10)
local light_max = (loud_walking.light_max or 10)
------------------------------------------------------------
-- all the loud_walking globalstep functions
------------------------------------------------------------
local hot_stuff = {"group:surface_hot"}
local traps = {"group:trap"}
local cold_stuff = {"group:surface_cold"}
local poison_stuff = {"group:poison"}
local sparking = {}
minetest.register_globalstep(function(dtime)
if not (dtime and type(dtime) == 'number') then
return
end
if not (loud_walking.db.status and loud_walking.registered_status) then
return
end
local time = minetest.get_gametime()
if not (time and type(time) == 'number') then
return
end
-- Trap check
if last_dps_check and time - last_dps_check < 1 then
return
end
local minetest_find_nodes_in_area = minetest.find_nodes_in_area
local players = minetest.get_connected_players()
if not (players and type(players) == 'table') then
return
end
for i = 1, #players do
local player = players[i]
local pos = player:getpos()
pos = vector.round(pos)
local player_name = player:get_player_name()
local minp = vector.subtract(pos, 2)
local maxp = vector.add(pos, 2)
local counts = minetest_find_nodes_in_area(minp, maxp, traps)
if counts and type(counts) == 'table' and #counts > 0 then
for _, tpos in ipairs(counts) do
local node = minetest.get_node_or_nil(tpos)
if not node then
return
end
if node.name == 'loud_walking:stone_with_coal_trap' then
minetest.set_node(tpos, {name="fire:basic_flame"})
local hp = player:get_hp()
if hp > 0 then
player:set_hp(hp - 1)
end
elseif node.name == 'loud_walking:stone_with_diamond_trap' then
loud_walking.diamond_trap(tpos, player)
elseif node.name == 'loud_walking:stone_with_gold_trap' then
loud_walking.gold_trap(tpos, player)
elseif node.name == 'loud_walking:mossycobble_trap' then
player:set_physics_override({speed = 0.1})
minetest.after(1, function() -- this effect is temporary
player:set_physics_override({speed = 1}) -- we'll just set it to 1 and be done.
end)
elseif node.name == 'loud_walking:ice_trap' then
loud_walking.ice_trap(tpos, player)
elseif node.name == 'loud_walking:stone_with_copper_trap' or node.name == 'loud_walking:stone_with_iron_trap' then
if not sparking[player_name] then
sparking[player_name] = true
loud_walking.copper_trap(tpos, player)
minetest.after(1, function()
sparking[player_name] = nil
end)
end
else
minetest.remove_node(tpos)
end
end
end
-- Execute only after an interval.
if last_dps_check and time - last_dps_check >= dps_delay then
-- environmental damage
local minp = vector.subtract(pos, 0.5)
local maxp = vector.add(pos, 0.5)
-- Remove status effects.
local status = loud_walking.db.status[player_name]
for status_name, status_param in pairs(status) do
local def = loud_walking.registered_status[status_name]
if not def then
print('Loud Walking: Error - unregistered status ' .. status_name)
break
end
local remove
if type(status_param.remove) == 'number' then
if status_param.remove < time then
remove = true
end
elseif def.remove then
remove = def.remove(player)
else
print('Loud Walking: Error in status remove for ' .. status_name)
end
if remove then
loud_walking.remove_status(player_name, status_name)
elseif def.during then
def.during(player)
end
end
if loud_walking.db.status[player_name]['breathe'] then
player:set_breath(11)
end
-- ... from standing on or near hot objects.
local counts = minetest_find_nodes_in_area(minp, maxp, hot_stuff)
if not (counts and type(counts) == 'table') then
return
end
if #counts > 1 then
player:set_hp(player:get_hp() - 1)
end
-- ... from standing on or near poison.
local counts = minetest_find_nodes_in_area(minp, maxp, poison_stuff)
if not (counts and type(counts) == 'table') then
return
end
if #counts > 1 then
player:set_hp(player:get_hp() - 1)
end
-- ... from standing on or near cold objects (less often).
if dps_count % cold_delay == 0 then
counts = minetest_find_nodes_in_area(minp, maxp, cold_stuff)
if not (counts and type(counts) == 'table') then
return
end
if #counts > 1 then
player:set_hp(player:get_hp() - 1)
end
end
-- ... from hunger (even less often).
if dps_count % hunger_delay == 0 and loud_walking.hunger_change then
loud_walking.hunger_change(player, -1)
end
end
end
-- Execute only after an interval.
if last_dps_check and time - last_dps_check < dps_delay then
return
end
local out = io.open(loud_walking.world..'/loud_walking_data.txt','w')
if out then
out:write(minetest.serialize(loud_walking.db))
out:close()
end
-- Promote mobs based on spawn position
for _, mob in pairs(minetest.luaentities) do
if not mob.initial_promotion then
local pos = mob.object:getpos()
if mob.hp_max and mob.object and mob.health and mob.damage then
local factor = 1 + (math.max(math.abs(pos.x), math.abs(pos.y), math.abs(pos.z)) / 2000)
mob.hp_max = math.floor(mob.hp_max * factor)
mob.damage = math.floor(mob.damage * factor)
mob.health = math.floor(mob.health * factor)
mob.object:set_hp(mob.health)
mob.initial_promotion = true
check_for_death(mob)
--local name = mob.object:get_entity_name() or ''
--print('Promoting '..name..': '..mob.health..' health, '..mob.damage..' damage')
end
end
end
-- Set this outside of the player loop, to affect everyone.
if dps_count % hunger_delay == 0 then
dps_count = hunger_delay
end
last_dps_check = minetest.get_gametime()
if not (last_dps_check and type(last_dps_check) == 'number') then
last_dps_check = 0
end
dps_count = dps_count - 1
end)
------------------------------------------------------------
-- abms
------------------------------------------------------------
minetest.register_abm({
nodenames = {"loud_walking:flare",},
interval = 5,
chance = 10,
action = function(pos, node)
if not (pos and node) then
return
end
minetest.remove_node(pos)
end,
})
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 2 * time_factor,
chance = 50,
action = function(p0, node, _, _)
minetest.remove_node(p0)
end,
})

142
chat.lua
View File

@ -1,142 +0,0 @@
--minetest.register_chatcommand("armor", {
-- params = "",
-- description = "Display your armor values",
-- privs = {},
-- func = function(player_name, param)
-- if not (player_name and type(player_name) == 'string' and player_name ~= '' and fun_caves.db.status) then
-- return
-- end
--
-- local player = minetest.get_player_by_name(player_name)
-- if not player then
-- return
-- end
--
-- local armor = player:get_armor_groups()
-- if armor then
-- minetest.chat_send_player(player_name, "Armor:")
-- for group, value in pairs(armor) do
-- minetest.chat_send_player(player_name, " "..group.." "..value)
-- end
--
-- if fun_caves.db.status[player_name].armor_elixir then
-- local armor_time = fun_caves.db.status[player_name].armor_elixir.remove
-- local game_time = minetest.get_gametime()
-- if not (armor_time and type(armor_time) == 'number' and game_time and type(game_time) == 'number') then
-- return
-- end
--
-- local min = math.floor(math.max(0, armor_time - game_time) / 60)
-- minetest.chat_send_player(player_name, "Your armor elixir will expire in "..min..' minutes.')
-- end
-- end
-- end,
--})
--minetest.register_chatcommand("setspawn", {
-- params = "",
-- description = "change your spawn position",
-- privs = {},
-- func = function(player_name, param)
-- if not (player_name and type(player_name) == 'string' and player_name ~= '') then
-- return
-- end
--
-- local player = minetest.get_player_by_name(player_name)
-- if not player then
-- return
-- end
--
-- local pos = player:getpos()
-- beds.spawn[player_name] = pos
-- minetest.chat_send_player(player_name, 'Your spawn position has been changed.')
-- end,
--})
minetest.register_chatcommand("fixlight", {
params = "<radius>",
description = "attempt to fix light bugs",
privs = {},
func = function(player_name, param)
if not (player_name and type(player_name) == 'string' and player_name ~= '') then
return
end
local privs = minetest.check_player_privs(player_name, {server=true})
if not privs then
return
end
print('Loud Walking: '..player_name..' used the fixlight command')
local player = minetest.get_player_by_name(player_name)
if not player then
return
end
local pos = player:getpos()
if not pos then
return
end
pos = vector.round(pos)
local radius = tonumber(param) or 50
radius = math.floor(radius)
local minp = vector.subtract(pos, radius)
local maxp = vector.add(pos, radius)
local vm = minetest.get_voxel_manip(minp, maxp)
if not vm then
return
end
--vm:set_lighting({day = 0, night = 0}, minp, maxp)
vm:calc_lighting(minp, maxp, false)
vm:update_liquids()
vm:write_to_map()
vm:update_map()
end,
})
--minetest.register_chatcommand("sleep", {
-- params = "",
-- description = "Sleep on the ground",
-- privs = {},
-- func = function(player_name, param)
-- local player = minetest.get_player_by_name(player_name)
-- if not (player and beds) then
-- return
-- end
--
-- if (beds.player and beds.player[player_name]) then
-- minetest.chat_send_player(player_name, 'You can\'t sleep.')
-- return
-- end
--
-- local pos = player:getpos()
-- if not pos then
-- return
-- end
-- pos = vector.round(pos)
--
-- local status, err = pcall(beds.on_rightclick, pos, player)
--
-- if status then
-- minetest.after(5, function()
-- local time = minetest.get_timeofday()
-- if not time or time < 0.23 or time > 0.3 then
-- return
-- end
--
-- local hp = player:get_hp()
-- if hp and type(hp) == 'number' then
-- player:set_hp(hp - 1)
-- end
--
-- minetest.chat_send_player(player_name, 'You\'d sleep better in a bed.')
-- end)
-- end
-- end,
--})

621
deco.lua
View File

@ -1,204 +1,333 @@
local low_size = 138
local road_level = 1
local dirt_depth = 5
local water_diff = 8
local water_level = road_level - water_diff
loud_walking.schematics = {}
local math_floor = math.floor
local math_ceil = math.ceil
local math_abs = math.abs
local math_random = math.random
local csize
local heat_noise = {offset = 50, scale = 50, seed = 5349, spread = {x = 750, y = 750, z = 750}, octaves = 3, persist = 0.5, lacunarity = 2}
local heat_blend_noise = {offset = 0, scale = 1.5, seed = 13, spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1.0, lacunarity = 2}
local humidity_noise = {offset = 50, scale = 50, seed = 842, spread = {x = 750, y = 750, z = 750}, octaves = 3, persist = 0.5, lacunarity = 2}
local humidity_blend_noise = {offset = 0, scale = 1.5, seed = 90003, spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1.0, lacunarity = 2}
-- Loud Walking deco.lua
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
do
local biome_mod = {
coniferous_forest_dunes = { heat_point = 35, humidity_point = 60, },
coniferous_forest = { heat_point = 35, humidity_point = 60, },
coniferous_forest_ocean = { heat_point = 35, humidity_point = 60, },
deciduous_forest = { heat_point = 60, humidity_point = 60, },
deciduous_forest_ocean = { heat_point = 60, humidity_point = 60, },
deciduous_forest_swamp = { heat_point = 60, humidity_point = 60, },
desert = { heat_point = 80, humidity_point = 10, },
desert_ocean = { heat_point = 80, humidity_point = 10, },
glacier = {},
glacier_ocean = {},
rainforest = { heat_point = 85, humidity_point = 70, },
rainforest_ocean = { heat_point = 85, humidity_point = 70, },
rainforest_swamp = { heat_point = 85, humidity_point = 70, },
sandstone_grassland_dunes = { heat_point = 55, humidity_point = 40, },
sandstone_grassland = { heat_point = 55, humidity_point = 40, },
sandstone_grassland_ocean = { heat_point = 55, humidity_point = 40, },
savanna = { heat_point = 80, humidity_point = 25, },
savanna_ocean = { heat_point = 80, humidity_point = 25, },
savanna_swamp = { heat_point = 80, humidity_point = 25, },
stone_grassland_dunes = { heat_point = 35, humidity_point = 40, },
stone_grassland = { heat_point = 35, humidity_point = 40, },
stone_grassland_ocean = { heat_point = 35, humidity_point = 40, },
taiga = {},
taiga_ocean = {},
tundra = { node_river_water = "loud_walking:thin_ice", },
tundra_beach = { node_river_water = "loud_walking:thin_ice", },
tundra_ocean = {},
}
local rereg = {}
for n, bi in pairs(biome_mod) do
for i, rbi in pairs(minetest.registered_biomes) do
if rbi.name == n then
rereg[#rereg+1] = table.copy(rbi)
for j, prop in pairs(bi) do
rereg[#rereg][j] = prop
end
end
end
end
minetest.clear_registered_biomes()
for _, bi in pairs(rereg) do
minetest.register_biome(bi)
end
rereg = {}
for _, dec in pairs(minetest.registered_decorations) do
rereg[#rereg+1] = dec
end
minetest.clear_registered_decorations()
for _, dec in pairs(rereg) do
minetest.register_decoration(dec)
end
rereg = nil
minetest.register_biome({
name = "desertstone_grassland",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 1,
node_stone = "default:desert_stone",
node_riverbed = "default:sand",
depth_riverbed = 2,
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 6,
y_max = 31000,
heat_point = 80,
humidity_point = 55,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 80,
fill_ratio = 0.1,
biomes = {"desertstone_grassland", },
y_min = 1,
y_max = 31000,
decoration = "default:junglegrass",
})
end
flowers.register_decorations()
dofile(loud_walking.path..'/schematics.lua')
local dangerous = true
loud_walking.decorations = {}
local bad_deco = {}
for _, i in pairs({"apple_tree", "pine_tree", "jungle_tree", "acacia_tree", "aspen_tree", }) do
bad_deco[i] = true
end
do
for _, odeco in pairs(minetest.registered_decorations) do
if not odeco.schematic then
local deco = {}
if odeco.biomes then
deco.biomes = {}
for _, b in pairs(odeco.biomes) do
deco.biomes[b] = true
end
end
for _, odeco in pairs(minetest.registered_decorations) do
if not odeco.schematic then
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
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 = math.max(0.001, (odeco.noise_params.scale + odeco.noise_params.offset) / 4)
end
if odeco.noise_params then
deco.fill_ratio = math.max(0.001, (odeco.noise_params.scale + odeco.noise_params.offset) / 4)
end
local nod = minetest.registered_nodes[deco.decoration]
if nod and nod.groups and nod.groups.flower then
deco.flower = true
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
loud_walking.decorations[#loud_walking.decorations+1] = deco
end
end
end
minetest.clear_registered_decorations()
loud_walking.biomes = {}
local biomes = loud_walking.biomes
local biome_names = {}
do
local biome_mod = {
cold_desert = { danger = 2, y_min = 1, },
cold_desert_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
coniferous_forest = { danger = 0, y_min = 1, },
coniferous_forest_ocean = { danger = 0, y_min = -loud_walking.max_height, y_max = 0, },
deciduous_forest = { danger = 0, },
deciduous_forest_ocean = { danger = 0, y_min = -loud_walking.max_height, },
deciduous_forest_shore = { danger = 0, },
desert = { danger = 2, y_min = 1, },
desert_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
--glacier = { y_min = 1, node_water_top = 'loud_walking:thin_ice', depth_water_top = 1, },
glacier = { danger = 2, y_min = 1, depth_water_top = 1, },
glacier_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
grassland = { danger = 0, y_min = 1, },
grassland_ocean = { danger = 0, y_min = -loud_walking.max_height, y_max = 0, },
icesheet = { danger = 2, y_min = 1, },
icesheet_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
rainforest = { danger = 1, node_riverbed = 'default:dirt', },
rainforest_ocean = { danger = 1, y_min = -loud_walking.max_height, node_riverbed = 'default:dirt', },
rainforest_swamp = { danger = 1,},
sandstone_desert = { danger = 2, y_min = 1, },
sandstone_desert_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
savanna = { danger = 1, },
savanna_ocean = { danger = 1, y_min = -loud_walking.max_height, },
savanna_shore = { danger = 1, },
snowy_grassland = { danger = 1, y_min = 1, },
snowy_grassland_ocean = { danger = 1, y_min = -loud_walking.max_height, y_max = 0, },
--taiga = { y_min = 1, node_water_top = 'loud_walking:thin_ice', depth_water_top = 1, },
taiga = { danger = 1, y_min = 1, depth_water_top = 1, },
taiga_ocean = { danger = 1, y_min = -loud_walking.max_height, y_max = 0, },
--tundra = { node_river_water = "loud_walking:thin_ice", },
--tundra_beach = { node_river_water = "loud_walking:thin_ice", },
--tundra = { node_top = 'default:snowblock', depth_top = 1, y_min = 1, node_water_top = 'loud_walking:thin_ice', depth_water_top = 1, },
tundra = { danger = 2, node_top = 'default:snowblock', depth_top = 1, y_min = 1, depth_water_top = 1, },
tundra_ocean = { danger = 2, y_min = -loud_walking.max_height, y_max = 0, },
underground = {},
}
do
local tree_biomes = {}
tree_biomes["deciduous_forest"] = {"apple_tree", 'aspen_tree'}
tree_biomes["coniferous_forest"] = {"pine_tree"}
tree_biomes["taiga"] = {"pine_tree"}
tree_biomes["rainforest"] = {"jungle_tree"}
tree_biomes["rainforest_swamp"] = {"jungle_tree"}
tree_biomes["coniferous_forest"] = {"pine_tree"}
tree_biomes["savanna"] = {"acacia_tree"}
for i, obiome in pairs(minetest.registered_biomes) do
local biome = table.copy(obiome)
biome.special_trees = tree_biomes[biome.name]
biome.terrain_scale = 1
biomes[biome.name] = biome
biome_names[#biome_names+1] = biome.name
if string.find(biome.name, "ocean") then
biome.terrain_scale = 2
end
if string.find(biome.name, "swamp") then
biome.terrain_scale = 0.5
end
if string.find(biome.name, "beach") then
biome.terrain_scale = 0.5
end
if string.find(biome.name, "^underground$") then
biome.node_top = "default:stone"
end
--if type(biome.depth_water_top) == 'string' then
-- print('** '..biome.name)
--end
for n, bi in pairs(biome_mod) do
for i, rbi in pairs(biomes) do
if rbi.name == n then
for j, prop in pairs(bi) do
biomes[i][j] = prop
end
end
end
end
end
end
biomes['tundra_beach'] = nil
biomes['grassland_dunes'] = nil
biomes['coniferous_forest_dunes'] = nil
biomes['deciduous_forest_shore'] = nil
biomes['savanna_shore'] = nil
biomes["desertstone_grassland"] = {
name = "desertstone_grassland",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 1,
node_stone = "default:desert_stone",
node_riverbed = "default:sand",
depth_riverbed = 2,
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 6,
y_max = loud_walking.max_height,
heat_point = 80,
humidity_point = 55,
terrain_scale = 1,
}
if dangerous then
biomes["toxic_forest"] = {
name = "toxic_forest",
node_top = "loud_walking:polluted_dirt",
danger = 3,
depth_top = 1,
node_filler = "loud_walking:polluted_dirt",
depth_filler = 1,
node_riverbed = "loud_walking:polluted_dirt",
depth_riverbed = 1,
node_water = "loud_walking:water_poison_source",
node_river_water = "loud_walking:water_poison_source",
special_trees = {"decaying_tree"},
y_min = 1,
y_max = loud_walking.max_height,
heat_point = 20,
humidity_point = 50,
terrain_scale = 0.75,
}
biomes["toxic_forest_ocean"] = {
name = "toxic_forest_ocean",
node_top = "loud_walking:polluted_dirt",
danger = 3,
depth_top = 1,
node_filler = "loud_walking:polluted_dirt",
depth_filler = 1,
node_riverbed = "loud_walking:polluted_dirt",
depth_riverbed = 1,
node_water = "loud_walking:water_poison_source",
node_river_water = "loud_walking:water_poison_source",
y_min = -10,
y_max = 0,
heat_point = 20,
humidity_point = 50,
terrain_scale = 1,
}
biomes["draconic"] = {
name = "draconic",
--node_dust = "",
node_top = "loud_walking:cracked_stone",
depth_top = 1,
node_filler = "loud_walking:granite_raw",
depth_filler = 1,
node_stone = "loud_walking:granite_raw",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
node_river_water = "loud_walking:basalt_raw",
node_riverbed = "loud_walking:basalt_raw",
depth_riverbed = 2,
danger = 3,
y_min = 1,
y_max = loud_walking.max_height,
heat_point = 80,
humidity_point = 20,
terrain_scale = 1,
}
biomes["draconic_ocean"] = {
name = "draconic_ocean",
--node_dust = "",
node_top = "loud_walking:granite_raw",
depth_top = 1,
danger = 3,
node_filler = "loud_walking:granite_raw",
depth_filler = 3,
node_stone = "loud_walking:granite_raw",
y_min = -20,
y_max = 0,
heat_point = 80,
humidity_point = 20,
terrain_scale = 1,
}
biomes["bizarre"] = {
name = "bizarre",
--node_dust = "",
node_top = "loud_walking:dirt_with_odd_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 1,
node_stone = "loud_walking:basalt_raw",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "loud_walking:basalt_raw",
--node_riverbed = "loud_walking:basalt_raw",
--depth_riverbed = 2,
special_trees = {'fur_tree'},
danger = 3,
y_min = 1,
y_max = loud_walking.max_height,
heat_point = 60,
humidity_point = 70,
terrain_scale = 1,
}
biomes["bizarre_ocean"] = {
name = "bizarre_ocean",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
danger = 3,
node_filler = "default:sand",
depth_filler = 3,
node_stone = "loud_walking:basalt_raw",
y_min = -20,
y_max = 0,
heat_point = 60,
humidity_point = 70,
}
end
loud_walking.decorations[#loud_walking.decorations+1] = {
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 80,
fill_ratio = 0.1,
biomes = {"desertstone_grassland", },
y_min = 1,
y_max = loud_walking.max_height,
decoration = "default:junglegrass",
}
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
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},
}
})
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
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,
}
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)
@ -207,108 +336,46 @@ register_flower("gerbera", "Gerbera", {"savanna", "rainforest", "desertstone_gra
local function register_decoration(deco, place_on, biomes, chance)
local bi = {}
if biomes then
bi = {}
for _, b in pairs(biomes) do
bi[b] = true
end
end
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 = place_on,
biomes = bi,
fill_ratio = chance,
decoration = deco,
}
loud_walking.decorations[#loud_walking.decorations+1] = {
deco_type = "simple",
place_on = place_on,
biomes = bi,
fill_ratio = chance,
decoration = deco,
}
end
loud_walking.biomes = {}
local biomes = loud_walking.biomes
local biome_names = {}
do
--local biome_terrain_scale = {}
--biome_terrain_scale["coniferous_forest"] = 0.75
--biome_terrain_scale["rainforest"] = 0.33
--biome_terrain_scale["underground"] = 1.5
if dangerous then
--register_decoration('default:lava_source', 'loud_walking:cracked_stone', {'draconic'}, 0.0005)
register_decoration('loud_walking:blackened_shrub', 'loud_walking:polluted_dirt', {'toxic_forest'}, 0.05)
register_decoration('flowers:mushroom_red', 'loud_walking:polluted_dirt', {'toxic_forest'}, 0.05)
register_decoration('loud_walking:strange_plant_1', 'loud_walking:dirt_with_odd_grass', {'bizarre'}, 0.05)
register_decoration('loud_walking:strange_plant_2', 'loud_walking:dirt_with_odd_grass', {'bizarre'}, 0.05)
local tree_biomes = {}
tree_biomes["deciduous_forest"] = {"apple_tree", 'aspen_tree'}
tree_biomes["coniferous_forest"] = {"pine_tree"}
tree_biomes["taiga"] = {"pine_tree"}
tree_biomes["rainforest"] = {"jungle_tree"}
tree_biomes["rainforest_swamp"] = {"jungle_tree"}
tree_biomes["coniferous_forest"] = {"pine_tree"}
tree_biomes["savanna"] = {"acacia_tree"}
for i, obiome in pairs(minetest.registered_biomes) do
local biome = table.copy(obiome)
biome.special_tree_prob = 2 * 25
if string.match(biome.name, "^rainforest") then
biome.special_tree_prob = 0.8 * 25
end
if biome.name == "savanna" then
biome.special_tree_prob = 30 * 25
end
--biome.terrain_scale = biome_terrain_scale[biome] or 0.5
--if string.find(biome.name, "ocean") then
-- biome.terrain_scale = 1
--end
--if string.find(biome.name, "swamp") then
-- biome.terrain_scale = 0.25
--end
--if string.find(biome.name, "beach") then
-- biome.terrain_scale = 0.25
--end
--if string.find(biome.name, "^underground$") then
-- biome.node_top = "default:stone"
--end
biome.special_trees = tree_biomes[biome.name]
biomes[biome.name] = biome
biome_names[#biome_names+1] = biome.name
end
for i = 1, 4 do
register_decoration('loud_walking:stone_spike_'..i, 'loud_walking:cracked_stone', {'draconic'}, 0.02 / i)
end
end
local function get_decoration(biome_name)
for i, deco in pairs(loud_walking.decorations) do
if not deco.biomes or deco.biomes[biome_name] then
local range = 1000
if deco.deco_type == "simple" then
if deco.fill_ratio and math.random(range) - 1 < deco.fill_ratio * 1000 then
return deco.decoration
end
else
-- nop
end
end
end
for i, deco in pairs(loud_walking.decorations) do
if not deco.biomes or deco.biomes[biome_name] then
if deco.deco_type == "simple" then
if deco.fill_ratio and math.random(1000) - 1 < deco.fill_ratio * 1000 then
return deco.decoration
end
end
end
end
end
-- Create and initialize a table for a schematic.
function loud_walking.schematic_array(width, height, depth)
-- Dimensions of data array.
local s = {size={x=width, y=height, z=depth}}
s.data = {}
for z = 0,depth-1 do
for y = 0,height-1 do
for x = 0,width-1 do
local i = z*width*height + y*width + x + 1
s.data[i] = {}
s.data[i].name = "air"
s.data[i].param1 = 000
end
end
end
s.yslice_prob = {}
return s
end
dofile(loud_walking.path.."/deco_trees.lua")
loud_walking.get_decoration = get_decoration

View File

@ -1,519 +0,0 @@
----------------------
-- Cave Decorations --
----------------------
-- Mushrooms and Speleothems
-- These are instantiated by voxel.lua since the decoration manager
-- only works at the surface of the world.
local light_max = 9
loud_walking.time_factor = 10
minetest.register_node("loud_walking:huge_mushroom_cap", {
description = "Huge Mushroom Cap",
tiles = {"loud_walking_mushroom_giant_cap.png", "loud_walking_mushroom_giant_under.png", "loud_walking_mushroom_giant_cap.png"},
is_ground_content = false,
paramtype = "light",
drawtype = "nodebox",
node_box = { type = "fixed",
fixed = {
{-0.5, -0.5, -0.33, 0.5, -0.33, 0.33},
{-0.33, -0.5, 0.33, 0.33, -0.33, 0.5},
{-0.33, -0.5, -0.33, 0.33, -0.33, -0.5},
{-0.33, -0.33, -0.33, 0.33, -0.17, 0.33},
} },
light_source = 4,
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
})
minetest.register_node("loud_walking:giant_mushroom_cap", {
description = "Giant Mushroom Cap",
tiles = {"loud_walking_mushroom_giant_cap.png", "loud_walking_mushroom_giant_under.png", "loud_walking_mushroom_giant_cap.png"},
is_ground_content = false,
paramtype = "light",
drawtype = "nodebox",
node_box = { type = "fixed",
fixed = {
{-0.4, -0.5, -0.4, 0.4, 0.0, 0.4},
{-0.75, -0.5, -0.4, -0.4, -0.25, 0.4},
{0.4, -0.5, -0.4, 0.75, -0.25, 0.4},
{-0.4, -0.5, -0.75, 0.4, -0.25, -0.4},
{-0.4, -0.5, 0.4, 0.4, -0.25, 0.75},
} },
light_source = 8,
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
})
minetest.register_node("loud_walking:giant_mushroom_stem", {
description = "Giant Mushroom Stem",
tiles = {"loud_walking_mushroom_giant_stem.png", "loud_walking_mushroom_giant_stem.png", "loud_walking_mushroom_giant_stem.png"},
is_ground_content = false,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, plant=1},
sounds = default.node_sound_wood_defaults(),
paramtype = "light",
drawtype = "nodebox",
node_box = { type = "fixed", fixed = { {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25}, }},
})
-- Mushroom stems can be used as wood, ala Journey to the Center of the Earth.
minetest.register_craft({
output = "default:wood",
recipe = {
{"loud_walking:giant_mushroom_stem"}
}
})
-- Caps can be cooked and eaten.
minetest.register_node("loud_walking:mushroom_steak", {
description = "Mushroom Steak",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_mushroom_steak.png"},
inventory_image = "loud_walking_mushroom_steak.png",
on_use = minetest.item_eat(4),
groups = {dig_immediate = 3, attached_node = 1},
})
minetest.register_craft({
type = "cooking",
output = "loud_walking:mushroom_steak",
recipe = "loud_walking:huge_mushroom_cap",
cooktime = 2,
})
minetest.register_craft({
type = "cooking",
output = "loud_walking:mushroom_steak 2",
recipe = "loud_walking:giant_mushroom_cap",
cooktime = 2,
})
-- Glowing fungal stone provides an eerie light.
minetest.register_node("loud_walking:glowing_fungal_stone", {
description = "Glowing Fungal Stone",
tiles = {"default_stone.png^loud_walking_glowing_fungal.png",},
is_ground_content = true,
light_source = 8,
groups = {cracky=3, stone=1},
drop = {items={ {items={"default:cobble"},}, {items={"loud_walking:glowing_fungus",},},},},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("loud_walking:glowing_fungus", {
description = "Glowing Fungus",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_glowing_fungus.png"},
inventory_image = "loud_walking_glowing_fungus.png",
groups = {dig_immediate = 3, attached_node = 1},
})
-- The fungus can be made into juice and then into glowing glass.
minetest.register_node("loud_walking:moon_juice", {
description = "Moon Juice",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_moon_juice.png"},
inventory_image = "loud_walking_moon_juice.png",
groups = {dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("loud_walking:moon_glass", {
description = "Moon Glass",
drawtype = "glasslike",
tiles = {"default_glass.png",},
inventory_image = minetest.inventorycube("default_glass.png"),
is_ground_content = true,
light_source = default.LIGHT_MAX,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft({
output = "loud_walking:moon_juice",
recipe = {
{"loud_walking:glowing_fungus", "loud_walking:glowing_fungus", "loud_walking:glowing_fungus"},
{"loud_walking:glowing_fungus", "loud_walking:glowing_fungus", "loud_walking:glowing_fungus"},
{"loud_walking:glowing_fungus", "vessels:glass_bottle", "loud_walking:glowing_fungus"},
},
})
minetest.register_craft({
output = "loud_walking:moon_glass",
type = "shapeless",
recipe = {
"loud_walking:moon_juice",
"loud_walking:moon_juice",
"default:glass",
},
})
-- What's a cave without speleothems?
local spel = {
{type1="stalactite", type2="stalagmite", tile="default_stone.png"},
{type1="stalactite_slimy", type2="stalagmite_slimy", tile="default_stone.png^loud_walking_algae.png"},
{type1="stalactite_mossy", type2="stalagmite_mossy", tile="default_stone.png^loud_walking_moss.png"},
{type1="icicle_down", type2="icicle_up", desc="Icicle", tile="caverealms_thin_ice.png", drop="default:ice"},
}
for _, desc in pairs(spel) do
minetest.register_node("loud_walking:"..desc.type1, {
description = (desc.desc or "Stalactite"),
tiles = {desc.tile},
is_ground_content = true,
walkable = false,
paramtype = "light",
--light_source = 14,
drop = (desc.drop or "loud_walking:stalactite"),
drawtype = "nodebox",
node_box = { type = "fixed",
fixed = {
{-0.07, 0.0, -0.07, 0.07, 0.5, 0.07},
{-0.04, -0.25, -0.04, 0.04, 0.0, 0.04},
{-0.02, -0.5, -0.02, 0.02, 0.25, 0.02},
} },
groups = {rock=1, cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("loud_walking:"..desc.type2, {
description = (desc.desc or "Stalagmite"),
tiles = {desc.tile},
is_ground_content = true,
walkable = false,
paramtype = "light",
--light_source = 14,
drop = "loud_walking:stalagmite",
drawtype = "nodebox",
node_box = { type = "fixed",
fixed = {
{-0.07, -0.5, -0.07, 0.07, 0.0, 0.07},
{-0.04, 0.0, -0.04, 0.04, 0.25, 0.04},
{-0.02, 0.25, -0.02, 0.02, 0.5, 0.02},
} },
groups = {rock=1, cracky=3},
sounds = default.node_sound_stone_defaults(),
})
end
-- They can be made into cobblestone, to get them out of inventory.
minetest.register_craft({
output = "default:cobble",
recipe = {
{"", "", ""},
{"loud_walking:stalactite", "loud_walking:stalactite", ""},
{"loud_walking:stalactite", "loud_walking:stalactite", ""},
},
})
minetest.register_craft({
output = "default:cobble",
recipe = {
{"", "", ""},
{"loud_walking:stalagmite", "loud_walking:stalagmite", ""},
{"loud_walking:stalagmite", "loud_walking:stalagmite", ""},
},
})
minetest.register_node("loud_walking:glowing_dirt", {
description = "Glowing Dirt",
tiles = {"default_dirt.png"},
groups = {crumbly = 3, soil = 1},
light_source = default.LIGHT_MAX,
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "loud_walking:glowing_dirt",
dry = "loud_walking:glowing_soil",
wet = "loud_walking:glowing_soil_wet"
},
})
minetest.register_node("loud_walking:glowing_soil", {
description = "Glowing Soil",
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "loud_walking:glowing_dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
light_source = default.LIGHT_MAX,
soil = {
base = "loud_walking:glowing_dirt",
dry = "loud_walking:glowing_soil",
wet = "loud_walking:glowing_soil_wet"
},
})
minetest.register_node("loud_walking:glowing_soil_wet", {
description = "Wet Glowing Soil",
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "loud_walking:glowing_dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
light_source = default.LIGHT_MAX,
soil = {
base = "loud_walking:glowing_dirt",
dry = "loud_walking:glowing_soil",
wet = "loud_walking:glowing_soil_wet"
},
})
minetest.register_craft({
output = "loud_walking:glowing_dirt",
type = "shapeless",
recipe = {
"loud_walking:moon_juice",
"default:dirt",
},
})
--thin (transparent) ice
minetest.register_node("loud_walking:thin_ice", {
description = "Thin Ice",
tiles = {"caverealms_thin_ice.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
light_source = 1,
drawtype = "glasslike",
sunlight_propagates = true,
freezemelt = "default:water_source",
paramtype = "light",
})
minetest.register_node("loud_walking:stone_with_moss", {
description = "Cave Stone with Moss",
tiles = {"default_stone.png^loud_walking_moss.png"},
is_ground_content = true,
light_source = 1,
groups = {stone=1, crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
minetest.register_node("loud_walking:stone_with_lichen", {
description = "Cave Stone with Lichen",
tiles = {"default_stone.png^loud_walking_lichen.png"},
is_ground_content = true,
light_source = 1,
groups = {stone=1, crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
minetest.register_node("loud_walking:stone_with_algae", {
description = "Cave Stone with Algae",
tiles = {"default_stone.png^loud_walking_algae.png"},
is_ground_content = true,
light_source = 1,
groups = {stone=1, crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
minetest.register_node("loud_walking:stone_with_salt", {
description = "Cave Stone with Salt",
tiles = {"caverealms_salty2.png"},--{"caverealms_salty2.png^caverealms_salty.png", "caverealms_salty2.png", "caverealms_salty2.png^caverealms_salty_side.png"},
light_source = 9,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
is_ground_content = true,
groups = {stone=1, crumbly=3},
sounds = default.node_sound_glass_defaults(),
})
--Glow Obsidian
minetest.register_node("loud_walking:glow_obsidian", {
description = "Glowing Obsidian",
tiles = {"caverealms_glow_obsidian.png"},
is_ground_content = true,
groups = {stone=2, crumbly=1},
light_source = 7,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
--Glow Obsidian 2 - has traces of lava
minetest.register_node("loud_walking:glow_obsidian_2", {
description = "Hot Glow Obsidian",
tiles = {"caverealms_glow_obsidian2.png"},
is_ground_content = true,
groups = {stone=2, crumbly=1, hot=1},
damage_per_second = 1,
light_source = 9,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
--minetest.register_node("loud_walking:bright_air", {
-- drawtype = "glasslike",
-- tiles = {"technic_light.png"},
-- paramtype = "light",
-- groups = {not_in_creative_inventory=1},
-- drop = "",
-- walkable = false,
-- buildable_to = true,
-- sunlight_propagates = true,
-- light_source = LIGHT_MAX,
-- pointable = false,
--})
--define special flame so that it does not expire
minetest.register_node("loud_walking:constant_flame", {
description = "Fire",
drawtype = "plantlike",
tiles = {{
name="fire_basic_flame_animated.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
}},
inventory_image = "fire_basic_flame.png",
light_source = 14,
groups = {igniter=2,dig_immediate=3,hot=3, not_in_creative_inventory=1},
drop = '',
walkable = false,
buildable_to = true,
damage_per_second = 4,
--after_place_node = function(pos, placer)
-- if pos.y > -7000 then
-- minetest.remove_node(pos)
-- end
--end,
})
--Hot Cobble - cobble with lava instead of mortar XD
minetest.register_node("loud_walking:hot_cobble", {
description = "Hot Cobble",
tiles = {"caverealms_hot_cobble.png"},
is_ground_content = true,
groups = {crumbly=2, hot=1},
damage_per_second = 1,
light_source = 3,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
-- mushroom growth
minetest.register_abm({
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 50 * loud_walking.time_factor,
chance = 100,
action = function(pos, node)
if pos.y > -50 then
return
end
local pos_up = {x=pos.x,y=pos.y+1,z=pos.z}
local node_up = minetest.get_node_or_nil(pos_up)
if not node_up then
return
end
if node_up.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos_up, nil) <= light_max then
minetest.set_node(pos_up, {name = "loud_walking:huge_mushroom_cap"})
minetest.set_node(pos, {name = "loud_walking:giant_mushroom_stem"})
end
end
})
-- mushroom growth
minetest.register_abm({
nodenames = {"loud_walking:huge_mushroom_cap"},
interval = 100 * loud_walking.time_factor,
chance = 150,
action = function(pos, node)
if minetest.get_node_light(pos, nil) >= 14 then
minetest.set_node(pos, {name = "air"})
return
end
local pos_up = {x=pos.x,y=pos.y+1,z=pos.z}
local node_up = minetest.get_node_or_nil(pos_up)
if not node_up then
return
end
if node_up.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if not node_under or node_under.name ~= "loud_walking:giant_mushroom_stem" then
return
end
node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 2, z = pos.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos_up, nil) <= light_max then
minetest.set_node(pos_up, {name = "loud_walking:giant_mushroom_cap"})
minetest.set_node(pos, {name = "loud_walking:giant_mushroom_stem"})
end
end
})
-- mushroom growth
minetest.register_abm({
nodenames = {"loud_walking:giant_mushroom_stem"},
interval = 5 * loud_walking.time_factor,
chance = 5,
action = function(pos, node)
local pos_up = {x=pos.x,y=pos.y+1,z=pos.z}
local node_up = minetest.get_node_or_nil(pos_up)
if not node_up then
return
end
if node_up.name ~= "air" then
return
end
if minetest.get_node_light(pos_up, nil) <= light_max then
minetest.set_node(pos_up, {name = "loud_walking:huge_mushroom_cap"})
end
end
})
-- mushroom spread
minetest.register_abm({
nodenames = {"loud_walking:giant_mushroom_cap", "loud_walking:huge_mushroom_cap"},
interval = 3 * loud_walking.time_factor,
chance = 40,
action = function(pos, node)
if minetest.get_node_light(pos, nil) >= 14 then
minetest.set_node(pos, {name = "air"})
return
end
local pos_down = pos
pos_down.y = pos_down.y - 1
local pos1, count = minetest.find_nodes_in_area_under_air(vector.subtract(pos_down, 4), vector.add(pos_down, 4), {"group:soil"})
if #pos1 < 1 then
return
end
local random = pos1[math.random(1, #pos1)]
random.y = random.y + 1
local mushroom_type
if math.random(1,2) == 1 then
mushroom_type = "flowers:mushroom_red"
else
mushroom_type = "flowers:mushroom_brown"
end
if minetest.get_node_light(random, nil) <= light_max then
minetest.set_node(random, {name = mushroom_type})
end
end
})

View File

@ -1,193 +0,0 @@
-------------------
-- Conifer Trees --
-------------------
-- Create different colored needles with the same properties.
newnode = loud_walking.clone_node("default:pine_needles")
if loud_walking.noleafdecay then
newnode.groups.leafdecay = 0
end
newnode.tiles = {"default_pine_needles.png^[colorize:#FF0000:20"}
minetest.register_node("loud_walking:pine_needles2", newnode)
newnode.tiles = {"default_pine_needles.png^[colorize:#FFFF00:20"}
minetest.register_node("loud_walking:pine_needles3", newnode)
newnode.tiles = {"default_pine_needles.png^[colorize:#00FF00:20"}
minetest.register_node("loud_walking:pine_needles4", newnode)
if loud_walking.glow then
minetest.register_node("loud_walking:pine_tree_glowing_moss", {
description = "Pine tree with glowing moss",
tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
"default_pine_tree.png^trunks_moss.png"},
paramtype2 = "facedir",
is_ground_content = false,
light_source = 4,
drop = 'default:pine_tree',
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
end
-- similar to the general tree schematic, but basically vertical
function loud_walking.generate_conifer_schematic(trunk_height, radius, trunk, leaf)
local height = trunk_height + radius * 3 + 2
local width = 2 * radius + 1
local trunk_top = height - radius - 1
local s = loud_walking.schematic_array(width, height, width)
-- the main trunk
local probs = {200,150,100,75,50,25}
for z = -radius,radius do
for y = 1,trunk_top do
-- Gives it a vaguely conical shape.
local r1 = math.ceil((height - y) / 4)
-- But rounded at the bottom.
if y == trunk_height + 1 then
r1 = r1 -1
end
for x = -radius,radius do
local i = (z+radius)*width*height + y*width + (x+radius) + 1
local dist = math.floor(math.sqrt(x^2 + z^2 + 0.5))
if x == 0 and z == 0 then
if trunk == "default:pine_tree" and loud_walking.glow and math.random(1,10) == 1 then
s.data[i].name = "loud_walking:pine_tree_glowing_moss"
else
s.data[i].name = trunk
end
s.data[i].param1 = 255
s.data[i].force_place = true
elseif y > trunk_height and dist <= r1 then
s.data[i].name = leaf
s.data[i].param1 = probs[dist]
end
end
end
end
-- leaves at the top
for z = -1,1 do
for y = trunk_top, height-1 do
for x = -1,1 do
local i = (z+radius)*width*height + y*width + (x+radius) + 1
if (x == 0 and z == 0) or y < height - 1 then
s.data[i].name = leaf
if x == 0 and z == 0 then
s.data[i].param1 = 255
else
s.data[i].param1 = 200
end
end
end
end
end
return s
end
-- the default pine schematic
function loud_walking.generate_default_conifer_schematic(trunk, leaf)
local height = 13 + 1
local width = 5
local s = loud_walking.schematic_array(width, height, width)
-- the main trunk
local probs = {255,220,190}
for p = 0,2 do
local c = math.floor(width / 2)
local y = height - p * 3 - 1
for r = 0,2 do
for z = c-r,c+r do
for x = c-r,c+r do
local i = z*width*height + (y-r)*width + x + 1
s.data[i].name = leaf
s.data[i].param1 = probs[r]
end
end
end
s.yslice_prob = {}
for y = 1,height-3 do
local i = 2*width*height + y*width + 2 + 1
if trunk == "default:pine_tree" and loud_walking.glow and math.random(1,10) == 1 then
s.data[i].name = "loud_walking:pine_tree_glowing_moss"
else
s.data[i].name = trunk
end
s.data[i].param1 = 255
s.data[i].force_place = true
local j = (height - y - 1) / 3
if j == 0 or j == 1 or j == 2 or y <= height - 11 then
s.yslice_prob[#s.yslice_prob+1] = {ypos=y,prob=170}
end
end
end
return s
end
-- generic conifers
loud_walking.schematics.conifer_trees = {}
leaves = {"default:pine_needles", "loud_walking:pine_needles2", "loud_walking:pine_needles3", "loud_walking:pine_needles4"}
for i = 1,#leaves do
local max_r = 4
for r = 2,max_r do
local schem = loud_walking.generate_conifer_schematic(2, r, "default:pine_tree", leaves[i])
loud_walking.schematics.conifer_trees[#loud_walking.schematics.conifer_trees+1] = schem
--minetest.register_decoration({
-- deco_type = "schematic",
-- sidelen = 80,
-- place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
-- fill_ratio = (max_r-r+1)/500,
-- biomes = {"coniferous_forest", "taiga",},
-- schematic = schem,
-- flags = "place_center_x, place_center_z",
-- y_min = 2,
-- rotation = "random",
--})
end
end
if false then
-- generic conifers
loud_walking.schematics.conifer_trees = {}
leaves = {"default:pine_needles", "loud_walking:pine_needles2", "loud_walking:pine_needles3", "loud_walking:pine_needles4"}
for i = 1,#leaves do
local schem = loud_walking.generate_default_conifer_schematic("default:pine_tree", leaves[i])
loud_walking.schematics.conifer_trees[#loud_walking.schematics.conifer_trees+1] = schem
minetest.register_decoration({
deco_type = "schematic",
sidelen = 80,
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
fill_ratio = 6/500,
biomes = {"coniferous_forest", "taiga",},
schematic = schem,
flags = "place_center_x, place_center_z",
y_min = 2,
rotation = "random",
})
end
end
-- Place the schematic when a sapling grows.
function default.grow_new_pine_tree(pos, bad)
local schem = loud_walking.schematics.conifer_trees[math.random(1,#loud_walking.schematics.conifer_trees)]
local adj = {x = pos.x - math.floor(schem.size.x / 2),
y = pos.y - 1,
z = pos.z - math.floor(schem.size.z / 2)}
minetest.place_schematic(adj, schem, 'random', nil, true)
end

View File

@ -1,164 +0,0 @@
---------------------
-- Deciduous Trees --
---------------------
-- Make some leaves of different colors (but the same properties).
local newnode = loud_walking.clone_node("default:leaves")
if loud_walking.noleafdecay then
newnode.groups.leafdecay = 0
end
newnode.tiles = {"default_leaves.png^[colorize:#FF0000:20"}
minetest.register_node("loud_walking:leaves2", newnode)
newnode.tiles = {"default_leaves.png^[colorize:#FFFF00:20"}
minetest.register_node("loud_walking:leaves3", newnode)
newnode.tiles = {"default_leaves.png^[colorize:#00FFFF:20"}
minetest.register_node("loud_walking:leaves4", newnode)
newnode.tiles = {"default_leaves.png^[colorize:#00FF00:20"}
minetest.register_node("loud_walking:leaves5", newnode)
if loud_walking.glow then
minetest.register_node("loud_walking:tree_glowing_moss", {
description = "Tree with glowing moss",
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png^trunks_moss.png"},
paramtype2 = "facedir",
is_ground_content = false,
light_source = 4,
drop = 'default:tree',
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
end
-- create a schematic for a spherical tree.
function loud_walking.generate_tree_schematic(trunk_height, radii, trunk, leaf, fruit, limbs)
-- trunk_height refers to the amount of trunk visible below any leaves.
local height = trunk_height + radii.y * 2 + 2
local width = 2 * radii.z + 1
local trunk_top = height-radii.y-1
local s = loud_walking.schematic_array(width, height, width)
-- the main trunk
for y = 1,trunk_top do
local i = radii.z*width*height + y*width + radii.x + 1
if trunk == "default:tree" and loud_walking.glow and math.random(1,10) == 1 then
s.data[i].name = "loud_walking:tree_glowing_moss"
else
s.data[i].name = trunk
end
s.data[i].param1 = 255
s.data[i].force_place = false
end
-- some leaves for free
loud_walking.generate_leaves(s, leaf, {x=0, y=trunk_top, z=0}, radii.x, fruit)
-- Specify a table of limb positions...
if radii.x > 3 and limbs then
for _, p in pairs(limbs) do
local i = (p.z+radii.z)*width*height + p.y*width + (p.x+radii.x) + 1
s.data[i].name = trunk
s.data[i].param1 = 255
s.data[i].force_place = false
loud_walking.generate_leaves(s, leaf, p, radii.x, fruit, true)
end
-- or just do it randomly.
elseif radii.x > 3 then
for z = -radii.z,radii.z do
for y = -radii.y,radii.y do
for x = -radii.x,radii.x do
-- a smaller spheroid inside the radii
if x^2/(radii.x-3)^2 + y^2/(radii.y-3)^2 + z^2/(radii.z-3)^2 <= 1 then
if math.random(1,6) == 1 then
local i = (z+radii.z)*width*height + (y+trunk_top)*width + (x+radii.x) + 1
s.data[i].name = trunk
s.data[i].param1 = 255
s.data[i].force_place = false
loud_walking.generate_leaves(s, leaf, {x=x, y=trunk_top+y, z=z}, radii.x, fruit, true)
end
end
end
end
end
end
return s
end
-- Create a spheroid of leaves.
function loud_walking.generate_leaves(s, leaf, pos, radius, fruit, adjust)
local height = s.size.y
local width = s.size.x
local rx = math.floor(s.size.x / 2)
local rz = math.floor(s.size.z / 2)
local r1 = math.min(3, radius) -- leaf decay radius
local probs = {255,200,150,100,75}
for z = -r1,r1 do
for y = -r1,r1 do
for x = -r1,r1 do
if x+pos.x >= -rx and x+pos.x <= rx and y+pos.y >= 0 and y+pos.y < height and z+pos.z >= -rz and z+pos.z <= rz then
local i = (z+pos.z+rz)*width*height + (y+pos.y)*width + (x+pos.x+rx) + 1
local dist1 = math.sqrt(x^2 + y^2 + z^2)
local dist2 = math.sqrt((x+pos.x)^2 + (z+pos.z)^2)
if dist1 <= r1 then
local newprob = probs[math.max(1, math.ceil(dist1))]
if s.data[i].name == "air" then
if fruit and (rx < 3 or dist2 / rx > 0.5) and math.random(1,10) == 1 then
s.data[i].name = fruit
s.data[i].param1 = 127
else
s.data[i].name = leaf
s.data[i].param1 = newprob
end
elseif adjust and s.data[i].name == leaf then
s.data[i].param1 = math.max(s.data[i].param1, newprob)
end
end
end
end
end
end
end
-- generic deciduous trees
loud_walking.schematics.deciduous_trees = {}
local leaves = {"default:leaves", "loud_walking:leaves2", "loud_walking:leaves3", "loud_walking:leaves4", "loud_walking:leaves5"}
for i = 1,#leaves do
local max_r = 6
local fruit = nil
if i == 1 then
fruit = "default:apple"
end
for r = 3,max_r do
local schem = loud_walking.generate_tree_schematic(2, {x=r, y=r, z=r}, "default:tree", leaves[i], fruit)
loud_walking.schematics.deciduous_trees[#loud_walking.schematics.deciduous_trees+1] = schem
--minetest.register_decoration({
-- deco_type = "schematic",
-- sidelen = 80,
-- place_on = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
-- y_min = 4,
-- fill_ratio = (max_r-r+1)/1700,
-- biomes = {"deciduous_forest",},
-- schematic = schem,
-- flags = "place_center_x, place_center_z",
-- rotation = "random",
--})
end
end
-- Place the schematic when a sapling grows.
function default.grow_new_apple_tree(pos, bad)
local schem = loud_walking.schematics.deciduous_trees[math.random(1,#loud_walking.schematics.deciduous_trees)]
local adj = {x = pos.x - math.floor(schem.size.x / 2),
y = pos.y - 1,
z = pos.z - math.floor(schem.size.z / 2)}
minetest.place_schematic(adj, schem, 'random', nil, true)
end

View File

@ -1,128 +0,0 @@
------------------
-- Jungle Trees --
------------------
-- Create different colored leaves with the same properties.
newnode = loud_walking.clone_node("default:jungleleaves")
newnode.tiles = {"default_jungleleaves.png^[colorize:#FF0000:10"}
minetest.register_node("loud_walking:jungleleaves2", newnode)
newnode.tiles = {"default_jungleleaves.png^[colorize:#FFFF00:30"}
minetest.register_node("loud_walking:jungleleaves3", newnode)
-- Create a schematic for a jungle tree.
function loud_walking.generate_jungle_tree_schematic(trunk_height, trunk, leaf)
local height = trunk_height * 2 + 1
local radius = 6
local width = 2 * radius + 1
local trunk_top = height - 4
local s = loud_walking.schematic_array(width, height, width)
-- roots, trunk, and extra leaves
for z = -1,1 do
for y = 1,trunk_top do
for x = -1,1 do
local i = (z+radius)*width*height + y*width + (x+radius) + 1
if x == 0 and z == 0 then
s.data[i].name = trunk
s.data[i].param1 = 255
s.data[i].force_place = true
elseif (x == 0 or z == 0) and y < 3 then
s.data[i].name = trunk
s.data[i].param1 = 255
s.data[i].force_place = true
elseif y > 3 then
s.data[i].name = leaf
s.data[i].param1 = 50
end
end
end
end
-- canopies
for y = 1,trunk_top+2 do
if y > trunk_height and (y == trunk_top or math.random(1,height - y) == 1) then
local x, z = 0, 0
while x == 0 and z == 0 do
x = math.random(-1,1) * 2
z = math.random(-1,1) * 2
end
for j = -1,1,2 do
local i = (j*z + radius)*width*height + y*width + (j*x + radius) + 1
s.data[i].name = trunk
s.data[i].param1 = 255
s.data[i].force_place = true
loud_walking.generate_canopy(s, leaf, {x=j*x, y=y, z=j*z})
end
end
end
return s
end
-- Create a canopy of leaves.
function loud_walking.generate_canopy(s, leaf, pos)
local height = s.size.y
local width = s.size.x
local rx = math.floor(s.size.x / 2)
local rz = math.floor(s.size.z / 2)
local r1 = 4 -- leaf decay radius
local probs = {255,200,150,100,75}
for z = -r1,r1 do
for y = 0,1 do
for x = -r1,r1 do
if x+pos.x >= -rx and x+pos.x <= rx and y+pos.y >= 0 and y+pos.y < height and z+pos.z >= -rz and z+pos.z <= rz then
local i = (z+pos.z+rz)*width*height + (y+pos.y)*width + (x+pos.x+rx) + 1
local dist1 = math.sqrt(x^2 + y^2 + z^2)
local dist2 = math.sqrt((x+pos.x)^2 + (z+pos.z)^2)
if dist1 <= r1 then
local newprob = probs[math.max(1, math.ceil(dist1))]
if s.data[i].name == "air" then
s.data[i].name = leaf
s.data[i].param1 = newprob
elseif s.data[i].name == leaf then
s.data[i].param1 = math.max(s.data[i].param1, newprob)
end
end
end
end
end
end
end
-- generic jungle trees
loud_walking.schematics.jungle_trees = {}
leaves = {"default:jungleleaves", "loud_walking:jungleleaves2", "loud_walking:jungleleaves3"}
for i = 1,#leaves do
local max_h = 7
for h = 5,max_h do
local schem = loud_walking.generate_jungle_tree_schematic(h*2, "default:jungletree", leaves[i])
loud_walking.schematics.jungle_trees[#loud_walking.schematics.jungle_trees+1] = schem
--minetest.register_decoration({
-- deco_type = "schematic",
-- sidelen = 80,
-- place_on = {"default:dirt_with_grass", "default:dirt"},
-- fill_ratio = (max_h-h+1)/1200,
-- biomes = {"rainforest", "rainforest_swamp",},
-- schematic = schem,
-- flags = "place_center_x, place_center_z",
-- y_min = 0,
-- rotation = "random",
--})
end
end
-- Place the schematic when a sapling grows.
function default.grow_new_jungle_tree(pos, bad)
local schem = loud_walking.schematics.jungle_trees[math.random(1,#loud_walking.schematics.jungle_trees)]
local adj = {x = pos.x - math.floor(schem.size.x / 2),
y = pos.y - 1,
z = pos.z - math.floor(schem.size.z / 2)}
minetest.place_schematic(adj, schem, 'random', nil, true)
end

View File

@ -1,57 +0,0 @@
-----------
-- Trees --
-----------
-- Change leafdecay ratings
minetest.add_group("default:leaves", {leafdecay = 4})
minetest.add_group("default:jungleleaves", {leafdecay = 4})
minetest.add_group("default:pine_needles", {leafdecay = 5})
-- tree creation code
dofile(loud_walking.path.."/deco_deciduous.lua")
dofile(loud_walking.path.."/deco_conifer.lua")
dofile(loud_walking.path.."/deco_jungle.lua")
loud_walking.schematics.acacia_trees = {}
local mz = 9
local mx = 9
local my = 7
local s = loud_walking.schematic_array(mx, my, mz)
for i = 1, #s.data do
s.data[i] = { name = "air", prob = 0 }
end
local y1 = 5
for z1 = 0, 5, 5 do
for x1 = 0, 5, 5 do
if x1 ~= z1 then
for z = 0, 3 do
for x = 0, 3 do
local i = (z + z1) * mx * my + y1 * mx + x1 + x + 1
s.data[i] = { name = "default:acacia_leaves", prob = 240 }
end
end
end
end
end
y1 = 6
for z1 = 4, 0, -4 do
for x1 = 0, 4, 4 do
if x1 == z1 then
for z = 0, 4 do
for x = 0, 4 do
local i = (z + z1) * mx * my + y1 * mx + x1 + x + 1
s.data[i] = { name = "default:acacia_leaves", prob = 240 }
end
end
end
end
end
local trunk = {{4,0,4}, {4,1,4}, {4,2,4}, {4,3,4}, {3,4,3}, {5,4,5}, {3,3,5}, {5,3,3}, {2,5,2}, {6,5,6}, {2,4,6}, {6,4,2}}
for _, p in pairs(trunk) do
local i = p[3] * mx * my + p[2] * mx + p[1] + 1
s.data[i] = { name = "default:acacia_tree", prob = 255 }
end
loud_walking.schematics.acacia_trees[#loud_walking.schematics.acacia_trees+1] = s

539
dmobs.lua
View File

@ -1,539 +0,0 @@
-- This was taken more or less intact from loud_walking by D00Med
mobs:register_mob("loud_walking:fox", {
type = "animal",
attacks_monsters = true,
reach = 1,
damage = 1,
attack_type = "dogfight",
hp_min = 4,
hp_max = 8,
armor = 100,
collisionbox = {-0.4, -0.6, -0.4, 0.3, 0.3, 0.3},
runaway = true,
pathfinding = true,
visual = "mesh",
mesh = "fox.b3d",
textures = {
{"dmobs_fox.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=1.5, y=1.5},
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 2.5,
jump = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
replace_rate = 10,
replace_what = {"farming:wheat_5", "default:fence_wood", "default:grass_5", "default:dirt_with_grass"},
replace_with = "air",
follow = {"mobs:meat_raw"},
view_range = 14,
animation = {
speed_normal = 6,
speed_run = 15,
walk_start = 25,
walk_end = 35,
stand_start = 51,
stand_end = 60,
run_start = 1,
run_end = 16,
punch_start = 36,
punch_end = 51,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
mobs:register_spawn("loud_walking:fox", {"default:dirt_with_grass","default:dirt"}, 20, 10, 15000, 2, 31000)
mobs:register_egg("loud_walking:fox", "Fox", "wool_orange.png", 1)
mobs:register_mob("loud_walking:hedgehog", {
type = "animal",
passive = true,
hp_min = 1,
hp_max = 2,
armor = 100,
collisionbox = {-0.1, -0.1, -0.2, 0.2, 0.2, 0.2},
visual = "mesh",
mesh = "hedgehog.b3d",
textures = {
{"dmobs_hedgehog.png"},
},
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
},
blood_texture = "mobs_blood.png",
visual_size = {x=2, y=2},
makes_footstep_sound = true,
walk_velocity = 0.5,
run_velocity = 1,
jump = true,
water_damage = 2,
lava_damage = 2,
light_damage = 0,
view_range = 14,
follow = {"farming:bread"},
animation = {
speed_normal = 5,
speed_run = 10,
walk_start = 1,
walk_end = 10,
stand_start = 1,
stand_end = 10,
run_start = 1,
run_end = 10,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
mobs:register_spawn("loud_walking:hedgehog", {"default:dirt_with_grass","default:pine_needles"}, 20, 10, 15000, 2, 31000)
mobs:register_egg("loud_walking:hedgehog", "Hedgehog", "wool_brown.png", 1)
mobs:register_mob("loud_walking:elephant", {
type = "monster",
passive = false,
reach = 3,
damage = 5,
attack_type = "dogfight",
hp_min = 24,
hp_max = 40,
armor = 75,
collisionbox = {-0.9, -1.2, -0.9, 0.9, 0.9, 0.9},
visual = "mesh",
mesh = "elephant.b3d",
textures = {
{"dmobs_elephant.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=2.5, y=2.5},
makes_footstep_sound = true,
walk_velocity = 0.5,
run_velocity = 1,
jump = false,
water_damage = 0,
lava_damage = 2,
light_damage = 0,
replace_rate = 10,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "ethereal:bamboo"},
replace_with = "air",
follow = {"farming:wheat"},
view_range = 14,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 9},
},
animation = {
speed_normal = 5,
speed_run = 10,
walk_start = 3,
walk_end = 19,
stand_start = 20,
stand_end = 30,
run_start = 3,
run_end = 19,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
mobs:register_spawn("loud_walking:elephant", {"default:dirt_with_dry_grass","default:desert_sand"}, 20, 10, 15000, 2, 31000)
mobs:register_egg("loud_walking:elephant", "Elephant", "default_dry_grass.png", 1)
mobs:register_mob("loud_walking:whale", {
type = "animal",
passive = false,
reach = 2,
damage = 5,
attack_type = "dogfight",
hp_min = 52,
hp_max = 82,
armor = 100,
collisionbox = {-0.9, -1.2, -0.9, 0.9, 0.9, 0.9},
visual = "mesh",
mesh = "whale.b3d",
rotate = 180,
textures = {
{"dmobs_whale.png"},
},
sounds = {
random = "whale_1",
death = "whale_1",
distance = 128,
},
blood_texture = "mobs_blood.png",
visual_size = {x=2.5, y=2.5},
makes_footstep_sound = true,
walk_velocity = 0.5,
run_velocity = 1,
jump = false,
stepheight = 1.5,
fall_damage = 0,
fall_speed = -6,
fly = true,
fly_in = "default:water_source",
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = {"fishing:fish_cooked"},
view_range = 14,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
},
animation = {
speed_normal = 5,
speed_run = 10,
walk_start = 2,
walk_end = 39,
stand_start = 2,
stand_end = 39,
run_start = 2,
run_end = 39,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
mobs:register_spawn("loud_walking:whale", {"default:water_source"}, 20, 1, 15000, -20, 31000)
mobs:register_egg("loud_walking:whale", "Whale", "default_water_source.png", 1)
mobs:register_mob("loud_walking:orc", {
type = "monster",
passive = false,
reach = 2,
damage = 2,
attack_type = "dogfight",
hp_min = 12,
hp_max = 22,
armor = 100,
collisionbox = {-0.4, -1.3, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "orc.b3d",
textures = {
{"dmobs_orc.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=3, y=3},
makes_footstep_sound = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 4},
},
walk_velocity = 1,
run_velocity = 2,
jump = true,
water_damage = 0,
lava_damage = 2,
light_damage = 0,
view_range = 14,
animation = {
speed_normal = 10,
speed_run = 20,
walk_start = 2,
walk_end = 18,
stand_start = 30,
stand_end = 40,
run_start = 2,
run_end = 18,
punch_start = 20,
punch_end = 30,
},
})
mobs:register_spawn("loud_walking:orc", {'group:stone', "default:snow","default:snow_block", "default:desert_sand"}, 20, -1, 11000, 2, 31000)
mobs:register_egg("loud_walking:orc", "Orc", "default_desert_sand.png", 1)
mobs:register_mob("loud_walking:ogre", {
type = "monster",
passive = false,
reach = 3,
damage = 3,
attack_type = "dogfight",
hp_min = 15,
hp_max = 26,
armor = 70,
collisionbox = {-0.6, -1.3, -0.6, 0.6, 1.5, 0.6},
visual = "mesh",
mesh = "ogre.b3d",
textures = {
{"dmobs_ogre.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=3.5, y=3.5},
makes_footstep_sound = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 9},
},
walk_velocity = 1,
run_velocity = 2,
jump = true,
rotate = 180,
water_damage = 0,
lava_damage = 2,
light_damage = 0,
view_range = 14,
animation = {
speed_normal = 10,
speed_run = 20,
walk_start = 3,
walk_end = 38,
stand_start = 40,
stand_end = 70,
run_start = 3,
run_end = 38,
punch_start = 70,
punch_end = 100,
},
})
mobs:register_spawn("loud_walking:ogre", {"default:snow","default:dirt_with_dry_grass", "default:desert_sand"}, 20, 10, 15000, 2, 31000)
mobs:register_egg("loud_walking:ogre", "Ogre", "default_desert_sand.png", 1)
mobs:register_mob("loud_walking:badger", {
type = "animal",
passive = false,
reach = 1,
damage = 2,
attack_type = "dogfight",
hp_min = 6,
hp_max = 12,
armor = 100,
collisionbox = {-0.3, -0.15, -0.3, 0.3, 0.4, 0.3},
visual = "mesh",
mesh = "badger.b3d",
textures = {
{"dmobs_badger.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=2, y=2},
makes_footstep_sound = true,
walk_velocity = 0.7,
run_velocity = 1,
jump = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = {"mobs:meat_raw"},
view_range = 14,
animation = {
speed_normal = 12,
speed_run = 18,
walk_start = 34,
walk_end = 58,
stand_start = 1,
stand_end = 30,
run_start = 34,
run_end = 58,
punch_start = 60,
punch_end = 80,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
mobs:register_spawn("loud_walking:badger", {"default:dirt_with_grass","default:dirt"}, 20, 10, 15000, 2, 31000)
mobs:register_egg("loud_walking:badger", "Badger", "default_obsidian.png", 1)
--dragon
mobs:register_mob("loud_walking:dragon", {
type = "monster",
passive = false,
attacks_monsters = true,
damage = 6,
reach = 3,
attack_type = "dogshoot",
shoot_interval = 2.5,
dogshoot_switch = 2,
dogshoot_count = 0,
dogshoot_count_max =5,
arrow = "loud_walking:fireball",
shoot_offset = 1,
hp_min = 30,
hp_max = 40,
armor = 50,
collisionbox = {-0.6, -1.2, -0.6, 0.6, 0.6, 0.6},
visual = "mesh",
mesh = "dragon.b3d",
textures = {
{"dmobs_dragon.png"},
{"dmobs_dragon2.png"},
{"dmobs_dragon3.png"},
{"dmobs_dragon4.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=2, y=2},
makes_footstep_sound = true,
runaway = false,
jump_chance = 30,
walk_chance = 80,
fall_speed = 0,
pathfinding = true,
fall_damage = 0,
sounds = {
shoot_attack = "mobs_fireball",
},
walk_velocity = 3,
run_velocity = 5,
jump = true,
fly = true,
drops = {
{name = "mobs:lava_orb", chance = 1, min = 1, max = 1},
{name = "mobs:meat_raw", chance = 1, min = 1, max = 9},
},
fall_speed = 0,
stepheight = 10,
water_damage = 2,
lava_damage = 0,
light_damage = 0,
view_range = 20,
animation = {
speed_normal = 10,
speed_run = 20,
walk_start = 1,
walk_end = 22,
stand_start = 1,
stand_end = 22,
run_start = 1,
run_end = 22,
punch_start = 22,
punch_end = 47,
},
knock_back = 2,
})
--Thanks to Tenplus1
mobs:register_arrow("loud_walking:fireball", {
visual = "sprite",
visual_size = {x = 0.5, y = 0.5},
textures = {"dmobs_fire.png"},
velocity = 8,
tail = 1, -- enable tail
tail_texture = "fire_basic_flame.png",
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
hit_node = function(self, pos, node)
mobs:explosion(pos, 2, 1, 1)
end,
})
mobs:spawn_specific("loud_walking:dragon", {"air"}, {"default:stone"}, 20, 10, 300, 15000, 2, -31000, 31000)
mobs:register_egg("loud_walking:dragon", "Dragon", "default_apple.png", 1)
if minetest.registered_entities["mobs_yeti:yeti"] then
local m = table.copy(minetest.registered_entities["loud_walking:dragon"])
m.name = 'loud_walking:snow_dragon'
m.lava_damage = 4
m.textures = { {"squaresville_snow_dragon.png"}, }
m.base_texture = m.textures[1]
m.arrow = "loud_walking:snow_blast"
m.attack_type = 'dogshoot'
m.shoot_interval = .7
m.shoot_offset = 2
m.drops = {
{name = "default:ice", chance = 1, min = 1, max = 3},
{name = "mobs:meat_raw", chance = 1, min = 1, max = 9},
}
minetest.registered_entities["loud_walking:snow_dragon"] = m
mobs.spawning_mobs["loud_walking:snow_dragon"] = true
local m = table.copy(minetest.registered_entities["mobs_yeti:snowball"])
m.hit_player = function(self, player)
if not (self and player) then
return
end
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end
m.hit_mob = function(self, player)
if not (self and player) then
return
end
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end
minetest.registered_entities["loud_walking:snow_blast"] = m
mobs:spawn_specific("loud_walking:snow_dragon", {"air"}, {'default:snow', 'default:ice', 'default:snow_block'}, -1, 20, 300, 15000, 2, -31000, 31000)
end

View File

@ -1,682 +0,0 @@
---------------------------------------------------------------
-- GOBLINS
---------------------------------------------------------------
local spawn_frequency = 3000 -- 350
local dig_freq = 5 -- 5
local trap_freq = 25 -- 25
local torch_freq = 2 -- 2
local diggable = {
'default:dirt',
'default:dirt_with_grass',
'default:dirt_with_dry_grass',
'default:dirt_with_snow',
'default:sand',
'default:stone',
'default:sandstone',
'default:desert_stone',
'default:stone_with_coal',
'default:stone_with_copper',
'default:stone_with_diamond',
'default:stone_with_gold',
'default:stone_with_iron',
'default:stone_with_mese',
'loud_walking:stone_with_coal_trap',
'loud_walking:stone_with_copper_trap',
'loud_walking:stone_with_diamond_trap',
'loud_walking:stone_with_gold_trap',
'loud_walking:stone_with_iron_trap',
'loud_walking:stone_with_salt',
'loud_walking:stone_with_algae',
'loud_walking:stone_with_lichen',
'loud_walking:stone_with_moss',
'loud_walking:giant_mushroom_cap',
'loud_walking:huge_mushroom_cap',
'loud_walking:giant_mushroom_stem',
'loud_walking:stalactite',
'loud_walking:stalagmite',
'loud_walking:stalactite_slimy',
'loud_walking:stalagmite_slimy',
'loud_walking:stalactite_mossy',
'loud_walking:stalagmite_mossy',
'flowers:mushroom_red',
'flowers:mushroom_brown'
}
local traps = {
'loud_walking:mossycobble_trap',
'loud_walking:stone_with_coal_trap',
'loud_walking:stone_with_copper_trap',
'loud_walking:stone_with_diamond_trap',
'loud_walking:stone_with_gold_trap',
'loud_walking:stone_with_iron_trap',
}
local function goblin_do(self)
if not (self and loud_walking.custom_ready and loud_walking.search_replace and loud_walking.surface_damage and loud_walking.custom_ready(self)) then
return
end
local cold_natured = false
local pos = self.object:getpos()
pos.y = pos.y + 0.5
-- dig
if self.name == 'loud_walking:goblin_digger' then
loud_walking.search_replace(pos, 1, diggable, 'air')
else
loud_walking.search_replace(pos, dig_freq, diggable, 'air')
end
--loud_walking.search_replace(pos, dig_freq * 3, burnable, 'fire:basic_flame')
-- steal torches
loud_walking.search_replace(self.object:getpos(), torch_freq, {"default:torch"}, "air")
pos.y = pos.y - 0.5
-- place a mossycobble
local cobbling = trap_freq
if self.name == 'loud_walking:goblin_cobbler' then
cobbling = torch_freq
end
loud_walking.search_replace(pos, cobbling, {"group:stone", "default:sandstone"}, "default:mossycobble")
-- place a trap
local trap = 'loud_walking:mossycobble_trap'
if self.name == 'loud_walking:goblin_ice' then
cold_natured = true
trap = 'loud_walking:ice_trap'
loud_walking.search_replace(pos, trap_freq, {"default:ice"}, trap)
else
if self.name == 'loud_walking:goblin_coal' then
trap = 'loud_walking:stone_with_coal_trap'
elseif self.name == 'loud_walking:goblin_copper' then
trap = 'loud_walking:stone_with_copper_trap'
elseif self.name == 'loud_walking:goblin_diamond' then
trap = 'loud_walking:stone_with_diamond_trap'
elseif self.name == 'loud_walking:goblin_gold' then
trap = 'loud_walking:stone_with_gold_trap'
elseif self.name == 'loud_walking:goblin_iron' then
trap = 'loud_walking:stone_with_iron_trap'
elseif self.name == 'loud_walking:goblin_king' then
trap = traps[math.random(#traps)]
end
loud_walking.search_replace(pos, trap_freq, {"group:stone", "default:sandstone"}, trap)
end
loud_walking.surface_damage(self, cold_natured)
end
local drops = {
digger = {
{name = "default:mossycobble", chance = 1, min = 1, max = 3},
},
--cobbler = {
-- {name = "loud_walking:glowing_fungus", chance = 1, min = 2, max = 5},
--},
coal = {
{name = "default:coal_lump", chance = 1, min = 1, max = 3},
},
copper = {
{name = "default:copper_lump", chance = 1, min = 1, max = 3},
},
diamond = {
{name = "default:diamond", chance = 5, min = 1, max = 3},
},
gold = {
{name = "default:gold_lump", chance = 1, min = 1, max = 3},
},
ice = {
{name = "default:coal_lump", chance = 1, min = 1, max = 3},
},
iron = {
{name = "default:iron_lump", chance = 1, min = 1, max = 3},
},
king = {
{name = "default:mese_crystal", chance = 1, min = 1, max = 3},
},
}
for name, drop in pairs(drops) do
if name == 'digger' or name == 'cobbler' or name == 'coal' or name == 'ice' then
drop[#drop+1] = {name = "default:pick_stone", chance = 3, min = 1, max = 3}
drop[#drop+1] = {name = "default:sword_stone", chance = 5, min = 1, max = 1}
elseif name == 'copper' or name == 'iron' then
drop[#drop+1] = {name = "default:pick_steel", chance = 3, min = 1, max = 3}
drop[#drop+1] = {name = "default:sword_steel", chance = 5, min = 1, max = 1}
elseif name == 'diamond' or name == 'gold' then
drop[#drop+1] = {name = "default:pick_diamond", chance = 3, min = 1, max = 3}
drop[#drop+1] = {name = "default:sword_diamond", chance = 5, min = 1, max = 1}
elseif name == 'king' then
drop[#drop+1] = {name = "default:pick_mese", chance = 3, min = 1, max = 3}
drop[#drop+1] = {name = "default:sword_mese", chance = 5, min = 1, max = 1}
end
drop[#drop+1] = {name = "loud_walking:rotten_flesh", chance = 2, min = 1, max = 2}
drop[#drop+1] = {name = "default:torch", chance = 3, min = 1, max = 10}
end
mobs:register_mob("loud_walking:goblin_digger", {
description = "Digger Goblin",
type = "monster",
passive = false,
damage = 1,
attack_type = "dogfight",
attacks_monsters = true,
hp_min = 5,
hp_max = 10,
armor = 100,
fear_height = 4,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_digger.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = drops['digger'],
water_damage = 0,
lava_damage = 2,
light_damage = 0,
lifetimer = 60,
follow = {"default:diamond"},
view_range = 10,
owner = "",
order = "follow",
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
},
on_rightclick = nil,
do_custom = goblin_do,
})
mobs:register_egg("loud_walking:goblin_digger", "Goblin Egg (digger)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_cobbler'
m.textures = { {"goblins_goblin_cobble1.png"}, {"goblins_goblin_cobble2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['cobbler']
minetest.registered_entities["loud_walking:goblin_cobbler"] = m
mobs:register_egg("loud_walking:goblin_cobbler", "Goblin Egg (cobbler)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_coal'
m.hp_min = 7
m.hp_max = 15
m.armor = 90
m.textures = { {"goblins_goblin_coal1.png"}, {"goblins_goblin_coal2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['coal']
minetest.registered_entities["loud_walking:goblin_coal"] = m
mobs:register_egg("loud_walking:goblin_coal", "Goblin Egg (coal)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_copper'
m.damage = 2
m.hp_min = 7
m.hp_max = 15
m.armor = 70
m.textures = { {"goblins_goblin_copper1.png"}, {"goblins_goblin_copper2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['copper']
minetest.registered_entities["loud_walking:goblin_copper"] = m
mobs:register_egg("loud_walking:goblin_copper", "Goblin Egg (copper)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_diamond'
m.damage = 3
m.hp_min = 7
m.hp_max = 15
m.armor = 50
m.textures = { {"goblins_goblin_diamond1.png"}, {"goblins_goblin_diamond2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['diamond']
minetest.registered_entities["loud_walking:goblin_diamond"] = m
mobs:register_egg("loud_walking:goblin_diamond", "Goblin Egg (diamond)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_gold'
m.damage = 3
m.hp_min = 7
m.hp_max = 15
m.armor = 60
m.textures = { {"goblins_goblin_gold1.png"}, {"goblins_goblin_gold2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['gold']
minetest.registered_entities["loud_walking:goblin_gold"] = m
mobs:register_egg("loud_walking:goblin_gold", "Goblin Egg (gold)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_ice'
m.textures = { {"loud_walking_goblin_ice2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['ice']
minetest.registered_entities["loud_walking:goblin_ice"] = m
mobs:register_egg("loud_walking:goblin_ice", "Goblin Egg (ice)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_iron'
m.damage = 2
m.hp_min = 7
m.hp_max = 15
m.armor = 80
m.textures = { {"goblins_goblin_iron1.png"}, {"goblins_goblin_iron2.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['iron']
minetest.registered_entities["loud_walking:goblin_iron"] = m
mobs:register_egg("loud_walking:goblin_iron", "Goblin Egg (iron)", "default_mossycobble.png", 1)
local m = table.copy(minetest.registered_entities["loud_walking:goblin_digger"])
m.name = 'loud_walking:goblin_king'
m.damage = 3
m.hp_min = 10
m.hp_max = 20
m.armor = 40
m.textures = { {"goblins_goblin_king.png"}, }
m.base_texture = m.textures[1]
m.drops = drops['king']
minetest.registered_entities["loud_walking:goblin_king"] = m
mobs:register_egg("loud_walking:goblin_king", "Goblin Egg (king)", "default_mossycobble.png", 1)
---------------------------------------------------------------
-- Traps
---------------------------------------------------------------
minetest.register_node("loud_walking:mossycobble_trap", {
description = "Messy Gobblestone",
tiles = {"default_mossycobble.png"},
is_ground_content = false,
groups = {cracky = 2, stone = 1, trap = 1},
sounds = default.node_sound_stone_defaults(),
paramtype = "light",
light_source = 4,
})
minetest.register_craft({
type = "cooking",
output = "default:stone",
recipe = "loud_walking:mossycobble_trap",
})
minetest.register_node("loud_walking:stone_with_coal_trap", {
description = "Coal Trap",
tiles = {"default_cobble.png^default_mineral_coal.png"},
groups = {cracky = 3, trap = 1},
drop = 'default:coal_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
if minetest.registered_nodes['tnt:tnt_burning'] then
-- 5... 4... 3... 2... 1...
loud_walking.diamond_trap = function(pos, player)
if not (pos and player) then
return
end
minetest.set_node(pos, {name="tnt:tnt_burning"})
local timer = minetest.get_node_timer(pos)
if timer then
timer:start(5)
end
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
else
-- wimpier trap for non-tnt settings
loud_walking.diamond_trap = function(pos, player)
if not (pos and player) then
return
end
minetest.set_node(pos, {name="default:lava_source"})
local hp = player:get_hp()
if hp > 0 then
player:set_hp(hp - 2)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end
minetest.register_node("loud_walking:stone_with_diamond_trap", {
description = "Diamond Trap",
tiles = {"default_cobble.png^(default_mineral_diamond.png^[colorize:#000000:160)"},
groups = {cracky = 3, trap = 1},
drop = 'default:diamond',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_dig = function(pos, node, digger)
if not (pos and digger) then
return
end
if math.random(3) == 1 then
loud_walking.diamond_trap(pos, digger)
else
minetest.node_dig(pos, node, digger)
end
end
})
newnode = loud_walking.clone_node("default:lava_source")
newnode.description = "Molten Gold Source"
newnode.wield_image = "goblins_molten_gold.png"
newnode.tiles[1].name = "goblins_molten_gold_source_animated.png"
newnode.special_tiles[1].name = "goblins_molten_gold_source_animated.png"
newnode.liquid_alternative_flowing = "loud_walking:molten_gold_flowing"
newnode.liquid_alternative_source = "loud_walking:molten_gold_source"
newnode.liquid_renewable = false
newnode.post_effect_color = {a=192, r=255, g=64, b=0}
minetest.register_node("loud_walking:molten_gold_source", newnode)
newnode = loud_walking.clone_node("default:lava_flowing")
newnode.description = "Flowing Molten Gold"
newnode.wield_image = "goblins_molten_gold.png"
newnode.tiles = {"goblins_molten_gold.png"}
newnode.special_tiles[1].name = "goblins_molten_gold_flowing_animated.png"
newnode.liquid_alternative_flowing = "loud_walking:molten_gold_flowing"
newnode.liquid_alternative_source = "loud_walking:molten_gold_source"
newnode.liquid_renewable = false
newnode.post_effect_color = {a=192, r=255, g=64, b=0}
minetest.register_node("loud_walking:molten_gold_flowing", newnode)
bucket.register_liquid(
"loud_walking:molten_gold_source",
"loud_walking:molten_gold_flowing",
"loud_walking:bucket_molten_gold",
"loud_walking_bucket_molten_gold.png",
"Bucket of Molten Gold",
{}
)
loud_walking.gold_trap = function(pos, player)
if not (pos and player) then
return
end
minetest.set_node(pos, {name="loud_walking:molten_gold_source"})
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
local hp = player:get_hp()
if hp > 0 then
player:set_hp(hp - 2)
end
end
minetest.register_node("loud_walking:stone_with_gold_trap", {
description = "Gold Trap",
tiles = {"default_cobble.png^(default_mineral_gold.png^[colorize:#000000:160)"},
groups = {cracky = 3, trap = 1},
drop = 'default:gold_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_dig = function(pos, node, digger)
if not (pos and digger) then
return
end
if math.random(3) == 1 then
loud_walking.gold_trap(pos, digger)
else
minetest.node_dig(pos, node, digger)
end
end
})
loud_walking.ice_trap = function(pos, player)
if not (pos and player) then
return
end
local ppos = player:getpos()
if ppos then
ppos.y = ppos.y + 1
local p1 = vector.subtract(ppos, 2)
local p2 = vector.add(ppos, 2)
local nodes = minetest.find_nodes_in_area(p1, p2, 'air')
if not (nodes and type(nodes) == 'table') then
return
end
for _, npos in pairs(nodes) do
minetest.set_node(npos, {name="default:ice"})
end
minetest.set_node(pos, {name="default:ice"})
end
end
minetest.register_node("loud_walking:ice_trap", {
description = "Ice Trap",
tiles = {"default_ice.png^loud_walking_mineral_moonstone.png"},
groups = {cracky = 3, trap = 1},
drop = 'default:ice',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_dig = function(pos, node, digger)
if not (pos and digger) then
return
end
if math.random(3) == 1 then
loud_walking.ice_trap(pos, digger)
else
minetest.node_dig(pos, node, digger)
end
end
})
local function lightning_effects(pos, radius)
if not (pos and radius) then
return
end
minetest.add_particlespawner({
amount = 30,
time = 1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-10, y=-10, z=-10},
maxvel = {x=10, y=10, z=10},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 1,
maxexptime = 3,
minsize = 16,
maxsize = 32,
texture = "goblins_lightning.png",
})
end
loud_walking.copper_trap = function(pos, player)
if not (pos and player) then
return
end
local hp = player:get_hp()
if hp > 0 then
player:set_hp(hp - 1)
lightning_effects(pos, 3)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
minetest.register_node("loud_walking:stone_with_copper_trap", {
description = "Copper Trap",
tiles = {"default_cobble.png^(default_mineral_copper.png^[colorize:#000000:160)"},
groups = {cracky = 3, trap = 1},
drop = 'default:copper_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_dig = function(pos, node, digger)
if not (pos and digger) then
return
end
if math.random(3) == 1 then
loud_walking.copper_trap(pos, digger)
else
minetest.node_dig(pos, node, digger)
end
end
})
-- summon a metallic goblin?
-- pit of iron razors?
minetest.register_node("loud_walking:stone_with_iron_trap", {
description = "Iron Trap",
tiles = {"default_cobble.png^(default_mineral_iron.png^[colorize:#000000:160)"},
groups = {cracky = 3, trap = 1},
drop = 'default:iron_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_dig = function(pos, node, digger)
if not (pos and digger) then
return
end
if math.random(3) == 1 then
loud_walking.copper_trap(pos, digger)
else
minetest.node_dig(pos, node, digger)
end
end
})
-- goblin spawner
minetest.register_node("loud_walking:goblin_spawner", {
--tiles = {"default_obsidian.png^[colorize:#00FF00:10"},
tiles = {"default_obsidian.png"},
paramtype = "light",
description = "Goblin Throne",
groups = {cracky = 2, falling_node = 1},
light_source = 4,
drop = 'default:mossycobble',
drawtype = "nodebox",
node_box = { type = "fixed",
fixed = {
{-0.25, -0.5, -0.4, 0.25, 0.0, 0.4}, -- seat
{-0.25, 0.0, -0.25, -0.2, 0.5, 0.25}, -- back
{-0.25, 0.5, -0.4, -0.2, 1.0, 0.4}, -- back
} },
})
local goblins = {}
goblins['loud_walking:goblin_king'] = 1
goblins['loud_walking:goblin_diamond'] = 2
goblins['loud_walking:goblin_gold'] = 2
goblins['loud_walking:goblin_copper'] = 4
goblins['loud_walking:goblin_iron'] = 4
goblins['loud_walking:goblin_coal'] = 8
goblins['loud_walking:goblin_digger'] = 8
goblins['loud_walking:goblin_cobbler'] = 8
local goblins_total = 0
for name, rate in pairs(goblins) do
goblins_total = goblins_total + rate
end
-- spawner abm
minetest.register_abm({
nodenames = {"loud_walking:goblin_spawner"},
interval = 4,
chance = 6,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
-- check objects inside 9x9 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 9)
local count = 0
-- count mob objects of same type in area
for k, obj in pairs(objs) do
local ent = obj:get_luaentity()
if ent and string.find(ent.name, 'goblin') then
count = count + 1
end
end
-- Are there too many of same type?
if count >= 12 then
return
end
-- find air blocks within 5 nodes of spawner
local air = minetest.find_nodes_in_area(
{x = pos.x - 5, y = pos.y, z = pos.z - 5},
{x = pos.x + 5, y = pos.y, z = pos.z + 5},
{"air"})
-- spawn in random air block
if air and #air > 0 then
local choose
local r = math.random(goblins_total)
for name, rate in pairs(goblins) do
if r <= rate then
choose = name
break
else
r = r - rate
end
end
local pos2 = air[math.random(#air)]
--local lig = minetest.get_node_light(pos2) or 0
pos2.y = pos2.y + 0.5
-- only if light levels are within range
--if lig >= mlig and lig <= xlig then
minetest.add_entity(pos2, choose)
--end
end
end
})

View File

@ -1,156 +0,0 @@
-- **CODE**
-- --------
-- See Mobs.Redo license
--
--
-- **MODELS/TEXTURES**
-- -------------------
-- WTFPL
-- Author/origin: Tomas J. Luis
--
-- Jeija_glue texture by: Jeija
--
-- **SOUNDS**
-- ----------
-- Original sound for slime damage by RandomationPictures under licence CC0 1.0.
-- http://www.freesound.org/people/RandomationPictures/sounds/138481/
--
-- Original sounds for slime jump, land and death by Dr. Minky under licence CC BY 3.0.
-- http://www.freesound.org/people/DrMinky/sounds/
local ENABLE_SPAWN_NODE = true
-- sounds
local green_sounds = {
damage = "slimes_damage",
death = "slimes_death",
jump = "slimes_jump",
attack = "slimes_attack"
}
-- textures
local green_textures = {"green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png",
"green_slime_sides.png", "green_slime_front.png", "green_slime_sides.png"}
-- small
mobs:register_mob("loud_walking:green_small", {
type = "monster",
visual = "cube",
textures = { green_textures },
visual_size = {x = 0.5, y = 0.5},
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
sounds = green_sounds,
hp_min = 2,
hp_max = 4,
armor = 100,
knock_back = 3,
blood_amount = 3,
blood_texture = "green_slime_blood.png",
lava_damage = 3,
fall_damage = 0,
damage = 1,
reach = 1,
attack_type = "dogfight",
attacks_monsters = true,
view_range = 10,
walk_chance = 0,
walk_velocity = 2,
stepheight = 0.6,
jump_chance = 60,
drops = {
{name = "loud_walking:green_slimeball", chance = 2, min = 1, max = 2},
}
})
-- medium
mobs:register_mob("loud_walking:green_medium", {
type = "monster",
visual = "cube",
textures = { green_textures },
visual_size = {x = 1, y = 1},
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
sounds = green_sounds,
hp_min = 4,
hp_max = 8,
armor = 100,
knock_back = 2,
blood_amount = 4,
blood_texture = "green_slime_blood.png",
lava_damage = 7,
fall_damage = 0,
damage = 2,
reach = 2,
attack_type = "dogfight",
attacks_monsters = true,
view_range = 10,
walk_chance = 0,
walk_velocity = 2,
stepheight = 1.1,
jump_chance = 60,
on_die = function(self, pos)
local num = math.random(2, 4)
for i=1,num do
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "loud_walking:green_small")
end
end
})
-- big
mobs:register_mob("loud_walking:green_big", {
type = "monster",
visual = "cube",
textures = { green_textures },
visual_size = {x = 2, y = 2},
collisionbox = {-1, -1, -1, 1, 1, 1},
sounds = green_sounds,
hp_min = 6,
hp_max = 12,
armor = 100,
knock_back = 1,
blood_amount = 5,
blood_texture = "green_slime_blood.png",
lava_damage = 11,
fall_damage = 0,
damage = 3,
reach = 3,
attack_type = "dogfight",
attacks_monsters = true,
view_range = 10,
walk_chance = 0,
walk_velocity = 2,
stepheight = 1.1,
jump_chance = 60,
on_die = function(self, pos)
local num = math.random(1, 2)
for i=1,num do
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "loud_walking:green_medium")
end
end
})
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("loud_walking:green_big",
{"default:dirt_with_grass", "default:junglegrass", "default:mossycobble"},
{"air"},
-1, 20, 30, 30000, 1, -31000, 31000
)
mobs:spawn_specific("loud_walking:green_medium",
{"default:dirt_with_grass", "default:junglegrass", "default:mossycobble"},
{"air"},
-1, 20, 30, 30000, 2, -31000, 31000
)
mobs:spawn_specific("loud_walking:green_small",
{"default:dirt_with_grass", "default:junglegrass", "default:mossycobble"},
{"air"},
-1, 20, 30, 30000, 3, -31000, 31000
)
mobs:register_egg("loud_walking:green_small", "Small Green Slime", "green_slime_front.png", 0)
mobs:register_egg("loud_walking:green_medium", "Medium Green Slime", "green_slime_front.png", 0)
mobs:register_egg("loud_walking:green_big", "Big Green Slime", "green_slime_front.png", 0)
-- crafts
minetest.register_craftitem("loud_walking:green_slimeball", {
image = "jeija_glue.png",
description="Green Slime Ball",
})

425
init.lua
View File

@ -1,7 +1,5 @@
loud_walking = {}
loud_walking.version = "1.0"
loud_walking.time_factor = 10 -- affects growth abms
loud_walking.light_max = 8 -- light intensity for mushroom growth
loud_walking.path = minetest.get_modpath(minetest.get_current_modname())
loud_walking.world = minetest.get_worldpath()
@ -25,80 +23,15 @@ if loud_walking.bridge_size == nil then
loud_walking.bridge_size = 50
end
loud_walking.vertical_sep = minetest.setting_get('loud_walking_vertical_sep')
if loud_walking.vertical_sep == nil then
loud_walking.vertical_sep = 300
end
loud_walking.breakable_wood = minetest.setting_getbool('loud_walking_breakable_wood')
if loud_walking.breakable_wood == nil then
loud_walking.breakable_wood = false
end
local armor_mod = minetest.get_modpath("3d_armor") and armor and armor.set_player_armor
loud_walking.elixir_armor = minetest.setting_getbool('loud_walking_use_armor_elixirs')
if loud_walking.elixir_armor == nil then
loud_walking.elixir_armor = true
end
loud_walking.expire_elixir_on_death = minetest.setting_getbool('loud_walking_expire_elixir_on_death')
if loud_walking.expire_elixir_on_death == nil then
loud_walking.expire_elixir_on_death = true
end
loud_walking.breakable_wood = minetest.setting_getbool('loud_walking_breakable_wood')
if loud_walking.breakable_wood == nil then
loud_walking.breakable_wood = false
end
loud_walking.starting_equipment = minetest.setting_getbool('loud_walking_starting_equipment')
if loud_walking.starting_equipment == nil then
loud_walking.starting_equipment = false
end
loud_walking.quick_leaf_decay = minetest.setting_getbool('loud_walking_quick_leaf_decay')
if loud_walking.quick_leaf_decay == nil then
loud_walking.quick_leaf_decay = false
end
loud_walking.goblin_rarity = minetest.setting_get('loud_walking_goblin_rarity')
if loud_walking.goblin_rarity == nil then
loud_walking.goblin_rarity = 9
end
loud_walking.goblin_rarity = 11 - loud_walking.goblin_rarity
print(loud_walking.goblin_rarity)
loud_walking.DEBUG = false -- for maintenance only
local inp = io.open(loud_walking.world..'/loud_walking_data.txt','r')
if inp then
local d = inp:read('*a')
loud_walking.db = minetest.deserialize(d)
inp:close()
end
if not loud_walking.db then
loud_walking.db = {}
end
for _, i in pairs({'teleport_data', 'hunger', 'status', 'translocators'}) do
if not loud_walking.db[i] then
loud_walking.db[i] = {}
end
end
if not minetest.set_mapgen_setting then
return
end
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode", water_level=-31000, flags="nolight"})
end)
loud_walking.max_height = 31000
loud_walking.baseline = 28000
loud_walking.extent_bottom = -400
loud_walking.extent_top = 400
-- Modify a node to add a group
function minetest.add_group(node, groups)
function loud_walking.add_group(node, groups)
local def = minetest.registered_items[node]
if not (node and def and groups and type(groups) == 'table') then
return false
@ -115,6 +48,7 @@ function minetest.add_group(node, groups)
return true
end
function loud_walking.clone_node(name)
if not (name and type(name) == 'string') then
return
@ -126,331 +60,44 @@ function loud_walking.clone_node(name)
end
loud_walking.registered_status = {}
function loud_walking.register_status(def)
if not (def and loud_walking.registered_status and type(def) == 'table') then
return
end
-- This table looks up nodes that aren't already stored.
local node = setmetatable({}, {
__index = function(t, k)
if not (t and k and type(t) == 'table') then
return
end
loud_walking.registered_status[def.name] = {
remove = def.remove,
start = def.start,
during = def.during,
terminate = def.terminate,
}
end
function loud_walking.set_status(player_name, status, time, param)
if not (player_name and type(player_name) == 'string' and status and type(status) == 'string') and loud_walking.db and loud_walking.db.status and loud_walking.db.status[player_name] then
return
end
local player = minetest.get_player_by_name(player_name)
local def = loud_walking.registered_status[status]
if not (def and player) then
return
end
if not param then
param = {}
end
if time then
param.remove = (minetest.get_gametime() or 0) + time
end
loud_walking.db.status[player_name][status] = param
if def.start then
def.start(player)
end
end
function loud_walking.remove_status(player_name, status)
if not (player_name and type(player_name) == 'string' and status and type(status) == 'string') and loud_walking.db and loud_walking.db.status and loud_walking.db.status[player_name] then
return
end
local player = minetest.get_player_by_name(player_name)
local def = loud_walking.registered_status[status]
if player and def then
if def.terminate then
loud_walking.db.status[player_name][status] = def.terminate(player)
else
loud_walking.db.status[player_name][status] = nil
end
end
end
t[k] = minetest.get_content_id(k)
if not t[k] or t[k] == 0 then
print('** error finding '..k)
end
return t[k]
end
})
loud_walking.node = node
--dofile(loud_walking.path .. "/recipe_list.lua")
dofile(loud_walking.path .. "/chat.lua")
dofile(loud_walking.path .. "/nodes.lua")
dofile(loud_walking.path .. "/deco.lua")
dofile(loud_walking.path .. "/deco_caves.lua")
--dofile(loud_walking.path .. "/schematics.lua")
--dofile(loud_walking.path .. "/wallhammer.lua")
local ground_nodes = {}
ground_nodes[node['default:dirt']] = true
ground_nodes[node['default:stone']] = true
ground_nodes[node['default:dirt_with_grass']] = true
ground_nodes[node['default:dirt_with_snow']] = true
ground_nodes[node['loud_walking:polluted_dirt']] = true
ground_nodes[node['loud_walking:cracked_stone']] = true
ground_nodes[node['loud_walking:dirt_with_odd_grass']] = true
loud_walking.ground_nodes = ground_nodes
dofile(loud_walking.path .. "/mapgen.lua")
dofile(loud_walking.path .. "/wooden_buckets.lua")
dofile(loud_walking.path .. "/tools.lua")
--dofile(loud_walking.path .. "/molotov.lua")
--dofile(loud_walking.path .. "/elixir.lua")
--dofile(loud_walking.path .. "/chat.lua")
if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then
dofile(loud_walking.path .. "/mobs.lua")
end
dofile(loud_walking.path .. "/abms.lua")
--loud_walking.print_recipes()
-- Attempt to save data at shutdown (as well as periodically).
minetest.register_on_shutdown(function()
local out = io.open(loud_walking.world..'/loud_walking_data.txt','w')
if out then
print('Squaresville: Saving database at shutdown')
out:write(minetest.serialize(loud_walking.db))
out:close()
end
end)
local hunger_mod = minetest.get_modpath("hunger")
loud_walking.hunger_id = {}
function loud_walking.hunger_change(player, change)
if not (player and change and type(change) == 'number') then
return
end
local player_name = player:get_player_name()
if hunger_mod then
if change < 0 and hunger and hunger.update_hunger and hunger.players then
hunger.update_hunger(player, hunger.players[player_name].lvl + change * 4)
end
return
end
if not (loud_walking.db.hunger and loud_walking.hunger_id) then
return
end
local hp = player:get_hp()
if not (hp and type(hp) == 'number') then
return
end
if change < 0 or hp >= 16 then
loud_walking.db.hunger[player_name] = math.min(20, math.max(0, loud_walking.db.hunger[player_name] + change))
player:hud_change(loud_walking.hunger_id[player_name], 'number', loud_walking.db.hunger[player_name])
if loud_walking.db.hunger[player_name] == 0 then
player:set_hp(hp - 1)
end
end
end
local hunger_hud
if not hunger_mod then
hunger_hud = function(player)
if not (player and loud_walking.db.hunger and loud_walking.hunger_id) then
return
end
local player_name = player:get_player_name()
if not loud_walking.db.hunger[player_name] then
loud_walking.db.hunger[player_name] = 20
end
local hunger_bar = {
hud_elem_type = 'statbar',
position = {x=0.52, y=1},
offset = {x = 0, y = -90},
name = "hunger",
text = "farming_bread.png",
number = loud_walking.db.hunger[player_name],
direction = 0,
size = { x=24, y=24 },
}
loud_walking.hunger_id[player_name] = player:hud_add(hunger_bar)
end
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if not (hp_change and type(hp_change) == 'number') then
return
end
if hp_change > 0 then
loud_walking.hunger_change(user, hp_change)
end
end)
end
minetest.register_on_dieplayer(function(player)
if loud_walking.db.status and not player then
return
end
local player_name = player:get_player_name()
if not (player_name and type(player_name) == 'string' and player_name ~= '') then
return
end
if loud_walking.db.status[player_name] then
for status in pairs(loud_walking.db.status[player_name]) do
local def = loud_walking.registered_status[status]
if not def.remain_after_death then
loud_walking.remove_status(player_name, status)
end
end
end
if loud_walking.db.hunger and loud_walking.hunger_id and not hunger_mod then
loud_walking.db.hunger[player_name] = 20
player:hud_change(loud_walking.hunger_id[player_name], 'number', 20)
end
end)
loud_walking.armor_id = {}
local armor_hud
if not armor_mod then
armor_hud = function(player)
if not (player and loud_walking.armor_id) then
return
end
local player_name = player:get_player_name()
if not player_name then
return
end
local armor_icon = {
hud_elem_type = 'image',
name = "armor_icon",
text = 'loud_walking_shield.png',
scale = {x=1,y=1},
position = {x=0.8, y=1},
offset = {x = -30, y = -80},
}
local armor_text = {
hud_elem_type = 'text',
name = "armor_text",
text = '0%',
number = 0xFFFFFF,
position = {x=0.8, y=1},
offset = {x = 0, y = -80},
}
loud_walking.armor_id[player_name] = {}
loud_walking.armor_id[player_name].icon = player:hud_add(armor_icon)
loud_walking.armor_id[player_name].text = player:hud_add(armor_text)
end
loud_walking.display_armor = function(player)
if not (player and loud_walking.armor_id) then
return
end
local player_name = player:get_player_name()
local armor = player:get_armor_groups()
if not (player_name and armor and armor.fleshy) then
return
end
player:hud_change(loud_walking.armor_id[player_name].text, 'text', (100 - armor.fleshy)..'%')
end
end
if loud_walking.starting_equipment then
minetest.register_on_newplayer(function(player)
local inv = player:get_inventory()
inv:add_item("main", 'default:sword_wood')
inv:add_item("main", 'default:axe_wood')
inv:add_item("main", 'default:pick_wood')
inv:add_item("main", 'default:apple 10')
inv:add_item("main", 'default:torch 10')
if minetest.registered_items['unified_inventory:bag_small'] then
inv:add_item("main", 'unified_inventory:bag_small')
end
end)
end
minetest.register_on_joinplayer(function(player)
if not (player and loud_walking.db.status) then
return
end
local player_name = player:get_player_name()
if not (player_name and type(player_name) == 'string' and player_name ~= '') then
return
end
if not loud_walking.db.status[player_name] then
loud_walking.db.status[player_name] = {}
end
if armor_hud then
armor_hud(player)
end
if hunger_hud then
hunger_hud(player)
end
-- If there's an armor mod, we wait for it to load armor.
if loud_walking.load_armor_elixir and not armor_mod then
loud_walking.load_armor_elixir(player)
end
end)
-- support for 3d_armor
-- This may or may not work with all versions.
if armor_mod then
local old_set_player_armor = armor.set_player_armor
armor.set_player_armor = function(self, player)
old_set_player_armor(self, player)
if loud_walking.load_armor_elixir then
loud_walking.load_armor_elixir(player)
end
end
end
----------------------------------------------------------------------
if loud_walking.quick_leaf_decay then
for name, node in pairs(minetest.registered_nodes) do
if node.groups.leafdecay then
node.groups.leafdecay = 0
node.groups.qfc_leafdecay = 0
end
end
end
local breakable = {}
breakable['loud_walking:wood_rotten'] = true
breakable['loud_walking:glowing_fungal_wood'] = true
if not loud_walking.breakable_wood then
print('* Loud Walking: Wood is NOT breakable by hand.')
for _, item in pairs(minetest.registered_items) do
if (item.groups.tree or item.groups.wood) and not breakable[item.name] then
local groups = table.copy(item.groups)
groups.oddly_breakable_by_hand = nil
minetest.override_item(item.name, {groups=groups})
end
end
end
minetest.register_on_joinplayer(function(player)
player:set_sky("#4070FF", "plain", {})
end)
--minetest.register_on_joinplayer(function(player)
-- player:set_sky("#4070FF", "plain", {})
--end)

View File

@ -1,677 +1,101 @@
-- This tables looks up nodes that aren't already stored.
local node = setmetatable({}, {
__index = function(t, k)
if not (t and k and type(t) == 'table') then
return
end
-- Loud Walking mapgen.lua
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
t[k] = minetest.get_content_id(k)
return t[k]
end
})
loud_walking.node = node
local DEBUG
local node = loud_walking.node
local max_height = 31000
local math_abs = math.abs
local math_floor = math.floor
local cloud_i = 0.5
local glass = {"loud_walking:sky_scrith", "loud_walking:cloud_scrith", "loud_walking:transparent_scrith"}
local fun_caves_mod = minetest.get_modpath('fun_caves')
local data = {}
local p2data = {} -- vm rotation data buffer
local vm, emin, emax, a, csize, heightmap, biomemap
local div_sz_x, div_sz_z, minp, maxp, terrain, cave
local cloud
local terrain_noise = {offset = 0,
scale = 20, seed = 8829, spread = {x = 40, y = 40, z = 40},
octaves = 6, persist = 0.4, lacunarity = 2}
local cave_noise = {offset = 0, scale = 1,
seed = -3977, spread = {x = 30, y = 30, z = 30}, octaves = 3,
persist = 0.8, lacunarity = 2}
local cloud_noise = {offset = 0, scale = 1,
seed = -7874, spread = {x = 30, y = 30, z = 30}, octaves = 3,
persist = 0.8, lacunarity = 2}
loud_walking.biomes = {}
local biomes = loud_walking.biomes
local biome_names = {}
biome_names["common"] = {}
biome_names["uncommon"] = {}
do
local biome_terrain_scale = {}
biome_terrain_scale["coniferous_forest"] = 0.75
biome_terrain_scale["rainforest"] = 0.33
biome_terrain_scale["underground"] = 1.5
local tree_biomes = {}
tree_biomes["deciduous_forest"] = {"deciduous_trees"}
tree_biomes["coniferous_forest"] = {"conifer_trees"}
tree_biomes["taiga"] = {"conifer_trees"}
tree_biomes["rainforest"] = {"jungle_trees"}
tree_biomes["rainforest_swamp"] = {"jungle_trees"}
tree_biomes["coniferous_forest"] = {"conifer_trees"}
tree_biomes["savanna"] = {"acacia_trees"}
for i, obiome in pairs(minetest.registered_biomes) do
local biome = table.copy(obiome)
biome.special_tree_prob = 5
if biome.name == "rainforest" or biome.name == 'rainforest_swamp' then
biome.special_tree_prob = 2
end
if biome.name == "savanna" then
biome.special_tree_prob = 30
end
local rarity = "common"
biome.terrain_scale = biome_terrain_scale[biome] or 0.5
if string.find(biome.name, "ocean") then
biome.terrain_scale = 1
rarity = "uncommon"
end
if string.find(biome.name, "swamp") then
biome.terrain_scale = 0.25
rarity = "uncommon"
end
if string.find(biome.name, "beach") then
biome.terrain_scale = 0.25
rarity = "uncommon"
end
if string.find(biome.name, "^underground$") then
biome.node_top = "default:stone"
rarity = "uncommon"
end
biome.special_trees = tree_biomes[biome.name]
biomes[biome.name] = biome
biome_names[rarity][#biome_names[rarity]+1] = biome.name
end
end
biomes["control"] = {}
local cave_stones = {
"loud_walking:stone_with_moss",
"loud_walking:stone_with_lichen",
"loud_walking:stone_with_algae",
"loud_walking:stone_with_salt",
}
local mushroom_stones = {}
mushroom_stones[node["default:stone"]] = true
mushroom_stones[node["loud_walking:stone_with_algae"]] = true
mushroom_stones[node["loud_walking:stone_with_lichen"]] = true
local function connection(x, y, z)
local min_x = math_floor((x + 32) / csize.x)
local min_y = math_floor((y + 32) / csize.y)
local min_z = math_floor((z + 32) / csize.z)
--local seed_noise = minetest.get_perlin({offset = 0, scale = 32768,
--seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2,
--persist = 0.4, lacunarity = 2})
--math.randomseed(seed_noise:get2d({x=minp.x, y=minp.z}))
local ct = min_x % 2 + min_y % 2 + min_z % 2
local r = min_x % 2 + 2 * (min_y % 2) + 4 * (min_z % 2)
if ct == 1 then
return r
end
return nil
end
local function get_decoration(biome)
if not loud_walking.decorations then
return
end
for i, deco in pairs(loud_walking.decorations) do
if not deco.biomes or deco.biomes[biome] then
local range = 1000
if deco.deco_type == "simple" then
if deco.fill_ratio and math.random(range) - 1 < deco.fill_ratio * 1000 then
return deco.decoration
end
else
-- nop
end
end
end
end
local pod_size = {x=loud_walking.pod_size_x, y=loud_walking.pod_size_y, z=loud_walking.pod_size_z}
local half_pod = {x=math_floor(pod_size.x / 2), y=math_floor(pod_size.y / 2), z=math_floor(pod_size.z / 2)}
local bridge_size = loud_walking.bridge_size
local vert_sep = loud_walking.vertical_sep
local fcsize = {x=pod_size.x + bridge_size, y=pod_size.y + vert_sep, z=pod_size.z + bridge_size}
local bevel = half_pod.y
local room_size = 20
local control_off = math_floor(room_size / 4)
local biome_look = {}
local cave_look = {}
local ore_look = {}
local tree_space = 3
loud_walking.fcsize = table.copy(fcsize)
loud_walking.pod_size = table.copy(pod_size)
local function place_schematic(pos, schem, center)
local rot = math.random(4) - 1
local yslice = {}
if schem.yslice_prob then
for _, ys in pairs(schem.yslice_prob) do
yslice[ys.ypos] = ys.prob
end
end
if center then
pos.x = pos.x - math_floor(schem.size.x / 2)
pos.z = pos.z - math_floor(schem.size.z / 2)
end
for z1 = 0, schem.size.z - 1 do
for x1 = 0, schem.size.x - 1 do
local x, z
if rot == 0 then
x, z = x1, z1
elseif rot == 1 then
x, z = schem.size.z - z1 - 1, x1
elseif rot == 2 then
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
elseif rot == 3 then
x, z = z1, schem.size.x - x1 - 1
end
local fdz = (pos.z + z) % fcsize.z
local fdx = (pos.x + x) % fcsize.x
if fdz < pod_size.z - 1 and fdz > 0 and fdx < pod_size.x - 1 and fdx > 0 then
local ivm = a:index(pos.x + x, pos.y, pos.z + z)
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
for y = 0, schem.size.y - 1 do
if pos.y + y < maxp.y + 16 and pos.y + y > minp.y - 16 then
local fdy = (pos.y + y) % fcsize.y
if math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) > bevel then
if yslice[y] or 255 >= math.random(255) then
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
if prob >= math.random(255) and schem.data[isch].name ~= "air" then
data[ivm] = node[schem.data[isch].name]
end
local param2 = schem.data[isch].param2 or 0
p2data[ivm] = param2
end
end
end
ivm = ivm + a.ystride
isch = isch + schem.size.x
end
end
end
end
end
local function get_biome(x, y, z)
local px = math_floor(x / fcsize.x)
local py = math_floor(y / fcsize.y)
local pz = math_floor(z / fcsize.z)
if px % 10 == 6 and pz % 10 == 6 then
return "control"
else
local hash = px * 1000000 + py * 1000 + pz
if not biome_look[hash] then
-- use the same seed (based on perlin noise).
local seed_noise = minetest.get_perlin({offset = 0, scale = 32768, seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2, persist = 0.4, lacunarity = 2})
math.randomseed(seed_noise:get3d({x=px, y=py, z=pz}))
local rarity = "common"
if math.random(5) == 1 then
rarity = "uncommon"
end
biome_look[hash] = biome_names[rarity][math.random(#biome_names[rarity])]
local cave_lining
if math.random(3) ~= 1 then
cave_lining = cave_stones[math.random(#cave_stones)]
end
cave_look[hash] = cave_lining
local sr = math.random(100)
if sr == 1 then
ore_look[hash] = 'default:stone_with_mese'
elseif sr <= 3 then
ore_look[hash] = 'default:stone_with_diamond'
elseif sr <= 7 then
ore_look[hash] = 'default:stone_with_gold'
elseif sr <= 15 then
ore_look[hash] = 'default:stone_with_copper'
elseif sr <= 31 then
ore_look[hash] = 'default:stone_with_iron'
elseif sr <= 63 then
ore_look[hash] = 'default:stone_with_coal'
else
ore_look[hash] = 'default:stone'
end
end
--return 'rainforest', cave_look[hash]
return biome_look[hash], cave_look[hash], ore_look[hash]
end
end
local function get_height(fdx, fdz, y, index, heights, terrain_scale, ocean)
local py = math_floor(y / fcsize.y)
if not terrain_scale then
return
end
if not heights[py] then
heights[py] = minetest.get_perlin_map(terrain_noise, csize):get2dMap_flat({x=minp.x, y=minp.z})
end
local terr = math_floor(heights[py][index] * terrain_scale + 0.5)
local d = - math_abs(math_abs(fdx - (half_pod.x - 0.5)) - math_abs(fdz - (half_pod.z - 0.5)))
if math_abs(fdx - half_pod.x) > math_abs(fdz - half_pod.z) then
d = d + half_pod.x - 2
else
d = d + half_pod.z - 2
end
if math_abs(terr) > d then
if terr > 0 then
terr = math_floor(d + 0.5)
elseif not ocean then
terr = math_floor(0.5 - d)
end
end
return terr
end
local function generate(p_minp, p_maxp, seed)
--local ta0, ta1, ta2 = 0, 0, 0
local t0 = os.clock()
minp, maxp = p_minp, p_maxp
vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
vm:get_data(data)
--p2data = vm:get_param2_data()
a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
csize = vector.add(vector.subtract(maxp, minp), 1)
if not (p_minp and p_maxp and seed) then
return
end
local ground = half_pod.y
local heights = {}
cloud = minetest.get_perlin_map(cloud_noise, csize):get2dMap_flat(minp)
cave = minetest.get_perlin_map(cave_noise, csize):get3dMap_flat(minp)
local goblin_spawner
if minetest.registered_nodes['loud_walking:goblin_spawner'] then
goblin_spawner = node['loud_walking:goblin_spawner']
end
local baseline = loud_walking.baseline
local extent_bottom = loud_walking.extent_bottom
local extent_top = loud_walking.extent_top
local heightmap = {}
local t1 = os.clock()
local minp, maxp = p_minp, p_maxp
if maxp.y < baseline + extent_bottom or minp.y > baseline + extent_top then
return
end
local index = 0
local index3d = 0
local last_biome, last_px, last_py, last_pz, node_top, node_filler, node_water_top, node_water, depth_top, depth_water_top, depth_filler, node_stone, ocean, swamp, beach, dunes, height
local biome, cave_lining, room_type, room_type_below, ore_type
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
if not (vm and emin and emax) then
return
end
for z = minp.z, maxp.z do
local dz = z - minp.z
local fdz = z % fcsize.z
local pz = math_floor(z / fcsize.z)
for x = minp.x, maxp.x do
index = index + 1
local dx = x - minp.x
local fdx = x % fcsize.x
local px = math_floor(x / fcsize.x)
local in_cave = false
index3d = dz * csize.y * csize.x + dx + 1
local ivm = a:index(x, minp.y, z)
local cave_height = 0
last_py = nil
vm:get_data(data)
p2data = vm:get_param2_data()
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
loud_walking.csize = vector.add(vector.subtract(maxp, minp), 1)
for y = minp.y, maxp.y do
local dy = y - minp.y
local fdy = y % fcsize.y
local py = math_floor(y / fcsize.y)
loud_walking.tree_map = {}
if biome == 'control' then
local room_px = math_floor((math_abs(fdx - half_pod.x) - 3) / room_size)
local room_py = math_floor(fdy / 5)
local room_pz = math_floor((math_abs(fdz - half_pod.z) - 3) / room_size)
room_type = math_floor((math_abs(room_pz * 1000000 + room_py * 1000 + room_px) % 17) / 3)
room_type_below = math_floor((math_abs(room_pz * 1000000 + (room_py - 1) * 1000 + room_px) % 17) / 3)
if room_type_below == 1 and room_type == 3 then
room_type = 0
end
end
local t
local meta_data = {}
local schem = {}
if py ~= last_py or px ~= last_px or pz ~= last_pz then
biome, cave_lining, ore_type = get_biome(x, y, z)
end
if biome ~= last_biome then
node_top = biomes[biome].node_top or "default:dirt_with_grass"
node_filler = biomes[biome].node_filler or "default:dirt"
node_water_top = biomes[biome].node_water_top or "default:water_source"
node_water = biomes[biome].node_water or "default:water_source"
depth_top = biomes[biome].depth_top or 1
depth_water_top = biomes[biome].node_water_top or 1
depth_filler = biomes[biome].depth_filler or 1
node_stone = biomes[biome].node_stone or "default:stone"
ocean = string.find(biome, "ocean") and true or false
swamp = string.find(biome, "swamp") and true or false
beach = string.find(biome, "beach") and true or false
dunes = string.find(biome, "dunes") and true or false
end
for fake_loop = 1, 1 do
loud_walking.terrain(minp, maxp, data, p2data, area, baseline, heightmap, schem)
if py ~= last_py then
height = half_pod.y - 5
if not (biome == "underground" or biome == 'control') then
height = get_height(fdx, fdz, y, index, heights, biomes[biome].terrain_scale, ocean)
end
end
--loud_walking.caves(minp, maxp, data, p2data, area, node, baseline, heightmap)
end
if not (data[ivm] == node['air'] or data[ivm] == node['ignore']) then
-- nop
elseif biome == "control" and math_abs(fdx - half_pod.x) < 3 and math_abs(fdz - half_pod.z) < 3 then
data[ivm] = node["loud_walking:air_ladder"]
elseif fdz >= pod_size.z or fdx >= pod_size.x or fdy >= pod_size.y then
if (fdy == half_pod.y and fdx == half_pod.x) or (fdy == half_pod.y and fdz == half_pod.z) then
data[ivm] = node['loud_walking:scrith']
else
--data[ivm] = node['air']
end
elseif math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) < bevel then
--data[ivm] = node['air']
in_cave = false
elseif (fdx == 0 or fdx == pod_size.x - 1) or (fdz == 0 or fdz == pod_size.z - 1) or (fdy == 0 or fdy == pod_size.y - 1) or math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) < bevel + 1 then
if math_abs(fdy - half_pod.y - 2) < 2 and (fdz == half_pod.z or fdx == half_pod.x) then
--data[ivm] = node["air"]
else
if biome == "control" then
data[ivm] = node[glass[3]]
elseif fdy < half_pod.y then
data[ivm] = node["loud_walking:scrith"]
elseif biome == "underground" then
data[ivm] = node["loud_walking:scrith"]
elseif fdy == pod_size.y - 1 then
data[ivm] = node[glass[cloud[index] < cloud_i and 1 or 2]]
else
data[ivm] = node[glass[1]]
end
end
elseif fdz == 0 and fdz == pod_size.z - 1 or fdx == 0 and fdx == pod_size.x - 1 or fdy == 0 and fdy == pod_size.y - 1 then
data[ivm] = node['loud_walking:scrith']
elseif biome == "control" and fdy < pod_size.y then
if (math_abs(fdx - half_pod.x) < 3 or math_abs(fdz - half_pod.z) < 3) then
-- corridor
if fdy % 5 == 0 then
data[ivm] = node["loud_walking:control_floor"]
end
elseif ((math_abs(fdx - half_pod.x) % room_size == 3) or (math_abs(fdz - half_pod.z) % room_size == 3)) then
if fdy % 5 == 0 then
data[ivm] = node["loud_walking:control_floor"]
elseif ((math_abs(fdx - half_pod.x) % room_size == 3 and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or (math_abs(fdz - half_pod.z) % room_size == 3 and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) then
data[ivm] = node["loud_walking:control_wall"]
end
elseif fdy % 5 == 0 then
if room_type == 1 then
if room_type_below == 1 then
data[ivm] = node["loud_walking:control_floor_alert_both"]
else
data[ivm] = node["loud_walking:control_floor_alert_up"]
end
elseif room_type_below == 1 then
data[ivm] = node["loud_walking:control_floor_alert_down"]
elseif room_type == 3 then
data[ivm] = node["loud_walking:control_floor_growth"]
else
data[ivm] = node["loud_walking:control_floor"]
end
elseif room_type == 2 and fdy < pod_size.y then
if math_abs(fdx - half_pod.x) % 4 < 3 and math_abs(fdz - half_pod.z) % 4 < 3 then
data[ivm] = node["loud_walking:air_ladder"]
end
elseif room_type == 3 then
if fdy % 5 == 1 then
local sr2 = math.random(20)
if sr2 == 1 then
data[ivm] = node["loud_walking:control_plant_1"]
elseif sr2 == 2 then
data[ivm] = node["loud_walking:control_plant_2"]
end
end
elseif room_type == 4 then
if fdy % 5 == 4 and (((math_abs(fdx - half_pod.x) % room_size == 4 or math_abs(fdx - half_pod.x) % room_size == 2) and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or ((math_abs(fdz - half_pod.z) % room_size == 4 or math_abs(fdz - half_pod.z) % room_size == 2) and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) then
data[ivm] = node["loud_walking:controls"]
end
else
-- nop
end
elseif (((fdx == (half_pod.x - control_off) or fdx == (half_pod.x + control_off)) and fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off)) or ((fdz == (half_pod.z - control_off) or fdz == (half_pod.z + control_off)) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off))) and fdx ~= half_pod.x and fdz ~= half_pod.z and fdy == pod_size.y - 2 then
data[ivm] = node["loud_walking:controls"]
elseif (((fdx == (half_pod.x - control_off) or fdx == (half_pod.x + control_off)) and fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off)) or ((fdz == (half_pod.z - control_off) or fdz == (half_pod.z + control_off)) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off))) and fdx ~= half_pod.x and fdz ~= half_pod.z and fdy > pod_size.y - control_off then
data[ivm] = node[glass[3]]
elseif fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off) and fdy == pod_size.y - control_off then
data[ivm] = node[glass[3]]
elseif not in_cave and (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy == height + ground + 1 then
-- ** water decorations **
--local deco = get_decoration(biome)
--if deco then
-- data[ivm] = node[deco]
--end
elseif not in_cave and fdy == height + ground + 1 then
local deco = get_decoration(biome)
if deco then
data[ivm] = node[deco]
end
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy >= half_pod.y - depth_water_top then
data[ivm] = node[node_water_top]
in_cave = false
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y then
data[ivm] = node[node_water]
in_cave = false
elseif fdy > height + ground then
--data[ivm] = node["air"]
in_cave = false
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(fdy / (half_pod.y * 0.2))) then
cave_height = cave_height + 1
if height + ground >= fdy and not in_cave and fdy > height + ground - 10 then
data[ivm] = node[node_top]
elseif fdy == 1 then
if not cave_lining and not ocean and not swamp and not beach and biome ~= "glacier" and math.random(6) == 1 then
data[ivm] = node["default:lava_source"]
elseif ocean or swamp or beach then
data[ivm] = node[node_filler]
end
elseif (ocean or swamp or beach) and not in_cave and node_stone == "default:stone" and fdy < half_pod.y and math.random(20) == 1 then
data[ivm] = node["loud_walking:glowing_fungal_stone"]
elseif (ocean or swamp or beach) and fdy < half_pod.y then
data[ivm] = node[node_water]
elseif cave_height == 3 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 3 * a.ystride]] and math.random(40) == 1 then
data[ivm] = node["loud_walking:giant_mushroom_cap"]
data[ivm - a.ystride] = node["loud_walking:giant_mushroom_stem"]
data[ivm - 2 * a.ystride] = node["loud_walking:giant_mushroom_stem"]
data[ivm - 3 * a.ystride] = node[node_filler]
elseif cave_height == 2 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 2 * a.ystride]] and math.random(20) == 1 then
data[ivm] = node["loud_walking:huge_mushroom_cap"]
data[ivm - a.ystride] = node["loud_walking:giant_mushroom_stem"]
data[ivm - 2 * a.ystride] = node[node_filler]
elseif not in_cave and node_stone == "default:stone" and not cave_lining and math.random(10) == 1 then
data[ivm] = node["loud_walking:stalagmite"]
elseif not in_cave and node_stone == "default:ice" and math.random(10) == 1 then
data[ivm] = node["loud_walking:icicle_up"]
elseif not in_cave and goblin_spawner and loud_walking.goblin_rarity < 11 and math.random(loud_walking.goblin_rarity * 1000) == 1 then
data[ivm] = goblin_spawner
else
--data[ivm] = node["air"]
end
in_cave = true
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(fdy / (half_pod.y * 0.2))) then
data[ivm] = node[cave_lining]
elseif fdy > height + ground - depth_top then
data[ivm] = node[node_top]
in_cave = false
elseif fdy > height + ground - depth_filler - depth_top then
data[ivm] = node[node_filler]
in_cave = false
else
data[ivm] = node[node_stone]
if math.random(100) == 1 then
data[ivm] = node[ore_type]
end
for _, s in ipairs(schem) do
loud_walking.place_schematic(minp, maxp, data, p2data, area, node, s.pos, loud_walking.schematics[s.name], true, s.bound)
end
if in_cave and node_stone == "default:stone" and math.random(20) == 1 then
data[ivm] = node["loud_walking:glowing_fungal_stone"]
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:stone" and not cave_lining and math.random(10) == 1 then
data[ivm - a.ystride] = node["loud_walking:stalactite"]
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:ice" and math.random(10) == 1 then
data[ivm - a.ystride] = node["loud_walking:icicle_down"]
end
in_cave = false
end
if not in_cave then
cave_height = 0
end
vm:set_data(data)
vm:set_param2_data(p2data)
minetest.generate_ores(vm, minp, maxp)
last_biome = biome
last_py = py
if DEBUG then
vm:set_lighting({day = 15, night = 15})
else
vm:set_lighting({day = 0, night = 0}, minp, maxp)
vm:calc_lighting()
end
vm:update_liquids()
vm:write_to_map()
ivm = ivm + a.ystride
index3d = index3d + csize.x
end
last_px = px
end
last_pz = pz
end
for _, t in ipairs(meta_data) do
local meta = minetest.get_meta({x=t.x, y=t.y, z=t.z})
meta:from_table()
meta:from_table(t.meta)
end
local t2 = os.clock()
-- Clear any tables that won't be reused.
loud_walking.tree_map = nil
end
local index = 0
for z = minp.z, maxp.z do
local fdz = z % fcsize.z
local pz = math_floor(z / fcsize.z)
for x = minp.x, maxp.x do
local fdx = x % fcsize.x
local px = math_floor(x / fcsize.x)
index = index + 1
last_py = nil
for y = minp.y, maxp.y do
if fdz % tree_space == 0 and fdx % tree_space == 0 then
local fdy = y % fcsize.y
local py = math_floor(y / fcsize.y)
local pod = fdz < pod_size.z and fdx < pod_size.x and fdy < pod_size.y
if py ~= last_py or px ~= last_px or pz ~= last_pz then
biome, cave_lining = get_biome(x, y, z)
ocean = string.find(biome, "ocean") and true or false
swamp = string.find(biome, "swamp") and true or false
node_top = biomes[biome].node_top or "default:dirt_with_grass"
end
if py ~= last_py then
height = get_height(fdx, fdz, y, index, heights, biomes[biome].terrain_scale, ocean)
end
if biome ~= 'control' and pod and fdy == height + ground and biomes[biome].special_tree_prob and math.random(biomes[biome].special_tree_prob) == 1 then
local rx = x + math.random(tree_space) - 1
local rz = z + math.random(tree_space) - 1
local ivm = a:index(rx, y, rz)
if (swamp or data[ivm + a.ystride] ~= node["default:water_source"]) and (data[ivm] == node[node_top]) then
if biomes[biome].special_trees then
local tree_type = biomes[biome].special_trees[math.random(#biomes[biome].special_trees)]
if tree_type and loud_walking.schematics then
local schem = loud_walking.schematics[tree_type][math.random(#loud_walking.schematics[tree_type])]
local pos = {x=rx, y=y, z=rz}
-- The minetest schematic functions don't seem very accurate.
place_schematic(pos, schem, true)
end
else
-- regular schematics?
end
end
end
end
end
end
end
local t3 = os.clock()
local t4 = os.clock()
vm:set_data(data)
--minetest.generate_ores(vm, minp, maxp)
--vm:set_param2_data(p2data)
vm:set_lighting({day = 0, night = 0}, minp, maxp)
vm:update_liquids()
vm:calc_lighting(minp, maxp, false)
vm:write_to_map()
local t5 = os.clock()
--print(' times: '..(t1 - t0)..', '..(t2 - t1)..', '..(t3 - t2)..', '..(t5 - t4)..' = '..(t5 - t0))
--print(' also: '..ta1..', '..ta2)
if loud_walking.path then
dofile(loud_walking.path .. "/terrain.lua")
--dofile(loud_walking.path .. "/caves.lua")
end
local function pgenerate(...)
--local status, err = pcall(generate, ...)
local status, err = true
generate(...)
if not status then
print('Loud Walking: Could not generate terrain:')
print(dump(err))
collectgarbage("collect")
end
--local status, err = pcall(generate, ...)
local status, err = true
generate(...)
if not status then
print('Loud Walking: Could not generate terrain:')
print(dump(err))
collectgarbage("collect")
end
end
-- Inserting helps to ensure that squaresville operates first.
table.insert(minetest.registered_on_generateds, 1, pgenerate)
function loud_walking.respawn(player)
local player_name = player:get_player_name()
if not player_name then
return
end
if beds and beds.spawn and beds.spawn[player_name] then
return
end
while true do
local px = math.random(-10, 10) * 2 - 1
local pz = math.random(-10, 10) * 2
local x = fcsize.x * px + math.random(half_pod.x) + math_floor(half_pod.x / 2)
local z = fcsize.z * pz + math.random(half_pod.z) + math_floor(half_pod.z / 2)
local y = half_pod.y + 5
local biome = get_biome(x,y,z)
if biome then
local terrain_scale = biomes[biome].terrain_scale
local noise = minetest.get_perlin(terrain_noise)
if not noise then
return
end
local height = noise:get2d({x=x, y=z}) * terrain_scale
local y = height + half_pod.y + 5
local pos = {x=x,y=y,z=z}
local node = minetest.get_node_or_nil(pos)
if not node or node.name == 'air' then
player:setpos(pos)
return true
end
end
end
end
minetest.register_on_newplayer(loud_walking.respawn)
minetest.register_on_respawnplayer(loud_walking.respawn)
minetest.register_on_generated(pgenerate)

411
mobs.lua
View File

@ -1,411 +0,0 @@
-- search/replace -- lets mobs change the terrain
-- used for goblin traps and torch thieving
loud_walking.search_replace = function(pos, search_rate, replace_what, replace_with)
if not (pos and search_rate and replace_what and replace_with and type(search_rate) == 'number' and (type(replace_what) == 'string' or type(replace_what) == 'table') and type(replace_with) == 'string') then
return
end
if math.random(search_rate) == 1 then
local p1 = vector.subtract(pos, 1)
local p2 = vector.add(pos, 1)
--look for nodes
local nodelist = minetest.find_nodes_in_area(p1, p2, replace_what)
if not (nodelist and type(nodelist) == 'table') then
return
end
if #nodelist > 0 then
for _, new_pos in pairs(nodelist) do
minetest.set_node(new_pos, {name = replace_with})
return true -- only one at a time
end
end
end
end
-- causes mobs to take damage from hot/cold surfaces
loud_walking.surface_damage = function(self, cold_natured)
if not self then
return
end
local pos = self.object:getpos()
if not pos then
return
end
local minp = vector.subtract(pos, 1.5)
local maxp = vector.add(pos, 1.5)
local counts = 0
if self.lava_damage > 1 then
counts = minetest.find_nodes_in_area(minp, maxp, {"group:surface_hot"})
if not (counts and type(counts) == 'table') then
return
end
if #counts > 0 then
self.health = self.health - math.floor(self.lava_damage / 2)
effect(pos, 5, "fire_basic_flame.png")
end
end
if not cold_natured then
counts = minetest.find_nodes_in_area(minp, maxp, {"group:surface_cold"})
if not (counts and type(counts) == 'table') then
return
end
if #counts > 0 then
self.health = self.health - 1
end
end
check_for_death(self)
end
-- executed in a mob's do_custom() to regulate their actions
-- if false, do nothing
local custom_delay = 2000000
loud_walking.custom_ready = function(self, delay)
if not self then
return
end
local time = minetest.get_us_time()
if not (time and type(time) == 'number') then
return
end
if not delay then
delay = custom_delay
end
if not self.custom_time or time - self.custom_time > delay then
self.custom_time = time
return true
else
return false
end
end
-- Try to standardize creature stats based on (log of) mass.
local mob_stats = {
{name = 'kpgmobs:deer', hp = 20, damage = 2, armor = 100, reach = 2},
{name = 'kpgmobs:horse2', hp = 30, damage = 3, armor = 100, reach = 2},
{name = 'kpgmobs:horse3', hp = 30, damage = 3, armor = 100, reach = 2},
{name = 'kpgmobs:horse', hp = 30, damage = 3, armor = 100, reach = 2},
{name = 'kpgmobs:jeraf', hp = 32, damage = 3, armor = 100, reach = 2},
{name = 'kpgmobs:medved', hp = 26, damage = 3, armor = 100, reach = 2},
{name = 'kpgmobs:wolf', hp = 18, damage = 3, armor = 100, reach = 1},
{name = 'mobs_animal:bee', hp = 1, damage = 1, armor = 200, reach = 1},
{name = 'mobs_animal:bunny', hp = 2, damage = 1, armor = 100, reach = 1},
{name = 'mobs_animal:chicken', hp = 8, damage = 1, armor = 150, reach = 1},
{name = 'mobs_animal:cow', hp = 30, damage = 3, armor = 150, reach = 1},
{name = 'mobs_animal:kitten', hp = 8, damage = 1, armor = 100, reach = 1},
{name = 'mobs_animal:pumba', hp = 20, damage = 2, armor = 100, reach = 1},
{name = 'mobs_animal:rat', hp = 2, damage = 1, armor = 100, reach = 1},
{name = 'mobs_animal:sheep', hp = 18, damage = 1, armor = 150, reach = 1},
{name = 'mobs_bat:bat', hp = 2, damage = 1, armor = 150, reach = 1},
{name = 'mobs_birds:bird_lg', hp = 4, damage = 1, armor = 150, reach = 1},
{name = 'mobs_birds:bird_sm', hp = 2, damage = 1, armor = 150, reach = 1},
{name = 'mobs_birds:gull', hp = 4, damage = 1, armor = 150, reach = 1},
{name = 'mobs_butterfly:butterfly', hp = 1, damage = 0, armor = 200, reach = 1},
{name = 'mobs_creeper:creeper', hp = 14, damage = 2, armor = 150, reach = 1},
{name = 'mobs_crocs:crocodile_float', hp = 26, damage = 3, armor = 75, reach = 2},
{name = 'mobs_crocs:crocodile', hp = 26, damage = 3, armor = 75, reach = 2},
{name = 'mobs_crocs:crocodile_swim', hp = 26, damage = 3, armor = 75, reach = 2},
{name = 'mobs_fish:clownfish', hp = 2, damage = 0, armor = 100, reach = 1},
{name = 'mobs_fish:tropical', hp = 2, damage = 0, armor = 100, reach = 1},
{name = 'mobs_jellyfish:jellyfish', hp = 2, damage = 2, armor = 200, reach = 1},
{name = 'mobs_monster:dirt_monster', hp = 20, damage = 2, armor = 100, reach = 2},
{name = 'mobs_monster:dungeon_master', hp = 30, damage = 5, armor = 50, reach = 2},
{name = 'mobs_monster:lava_flan', hp = 16, damage = 3, armor = 50, reach = 2},
{name = 'mobs_monster:mese_monster', hp = 10, damage = 2, armor = 40, reach = 2},
{name = 'mobs_monster:oerkki', hp = 16, damage = 2, armor = 100, reach = 2},
{name = 'mobs_monster:sand_monster', hp = 20, damage = 2, armor = 200, reach = 2},
{name = 'mobs_monster:spider', hp = 22, damage = 2, armor = 100, reach = 2},
{name = 'mobs_monster:stone_monster', hp = 20, damage = 2, armor = 50, reach = 2},
{name = 'mobs_monster:tree_monster', hp = 18, damage = 2, armor = 75, reach = 2},
{name = 'mobs_sandworm:sandworm', hp = 42, damage = 7, armor = 100, reach = 3},
{name = 'mobs_sharks:shark_lg', hp = 34, damage = 5, armor = 80, reach = 3},
{name = 'mobs_sharks:shark_md', hp = 25, damage = 3, armor = 80, reach = 2},
{name = 'mobs_sharks:shark_sm', hp = 16, damage = 2, armor = 80, reach = 1},
{name = 'mobs_turtles:seaturtle', hp = 18, damage = 2, armor = 75, reach = 1},
{name = 'mobs_turtles:turtle', hp = 10, damage = 1, armor = 50, reach = 1},
{name = 'mobs_yeti:yeti', hp = 22, damage = 2, armor = 100, reach = 2},
}
local colors = { 'black', 'blue', 'brown', 'cyan', 'dark_green', 'dark_grey', 'green', 'grey', 'magenta', 'orange', 'pink', 'red', 'violet', 'white', 'yellow',}
for _, color in pairs(colors) do
mob_stats[#mob_stats+1] = {name = 'mobs_animal:sheep_'..color, hp = 18, damage = 1, armor = 150}
end
for _, mob in pairs(mob_stats) do
if string.find(mob.name, 'mobs_monster') or string.find(mob.name, 'mobs_animal') then
local i, j = string.find(mob.name, ':')
local suff = string.sub(mob.name, i)
mob_stats[#mob_stats+1] = {name = 'mobs'..suff, hp = mob.hp, damage = mob.damage, armor = mob.armor}
end
end
for _, mob in pairs(mob_stats) do
if minetest.registered_entities[mob.name] then
minetest.registered_entities[mob.name].damage = mob.damage
minetest.registered_entities[mob.name].hp_min = math.ceil(mob.hp * 0.5)
minetest.registered_entities[mob.name].hp_max = math.ceil(mob.hp * 1.5)
minetest.registered_entities[mob.name].armor = mob.armor
if mob.reach then
minetest.registered_entities[mob.name].reach = mob.reach
end
if mob.meat then
minetest.registered_entities[mob.name].drops[#minetest.registered_entities[mob.name].drops+1] = {name = "mobs:meat_raw", chance = 1, min = 1, max = mob.damage ^ 2}
end
end
end
if minetest.registered_entities["mobs:bee"] then
mobs:register_spawn("mobs_animal:bee", {"group:flower"}, 20, 10, 300, 1, 31000, true)
end
if minetest.registered_entities["kpgmobs:wolf"] then
local m = table.copy(minetest.registered_entities["kpgmobs:wolf"])
m.name = 'loud_walking:white_wolf'
m.textures = { {"loud_walking_white_wolf.png"}, }
m.base_texture = m.textures[1]
minetest.registered_entities["loud_walking:white_wolf"] = m
mobs.spawning_mobs["loud_walking:white_wolf"] = true
mobs:register_spawn("loud_walking:white_wolf", {"default:dirt_with_snow"}, 20, -1, 11000, 3, 31000)
mobs:register_egg("loud_walking:white_wolf", "White Wolf", "wool_white.png", 1)
end
if minetest.registered_entities["kpgmobs:medved"] then
local m = table.copy(minetest.registered_entities["kpgmobs:medved"])
m.name = 'loud_walking:moon_bear'
m.textures = { {"loud_walking_moon_bear.png"}, }
m.type = 'monster'
m.base_texture = m.textures[1]
minetest.registered_entities["loud_walking:moon_bear"] = m
mobs.spawning_mobs["loud_walking:moon_bear"] = true
mobs:register_spawn("loud_walking:moon_bear", {"default:dirt_with_snow"}, 20, -1, 11000, 3, 31000, false)
mobs:register_egg("loud_walking:moon_bear", "Moon Bear", "wool_white.png", 1)
end
if minetest.registered_entities["mobs_monster:spider"] then
-- Deep spider
local m = table.copy(minetest.registered_entities["mobs_monster:spider"])
m.name = 'loud_walking:spider'
m.docile_by_day = false
m.drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
{name = "wool:black", chance = 1, min = 1, max = 3},
}
m.water_damage = 0
m.do_custom = function(self)
if not (self and loud_walking.custom_ready(self)) then
return
end
loud_walking.surface_damage(self)
end
minetest.registered_entities["loud_walking:spider"] = m
mobs.spawning_mobs["loud_walking:spider"] = true
mobs:register_spawn("loud_walking:spider", 'group:stone', 5, 0, 2000, 2, 31000)
mobs:register_egg("loud_walking:spider", "Deep Spider", "mobs_cobweb.png", 1)
-- ice spider
m = table.copy(minetest.registered_entities["mobs_monster:spider"])
m.name = 'loud_walking:spider_ice'
m.docile_by_day = false
m.textures = { {"loud_walking_spider_ice.png"}, }
m.base_texture = m.textures[1]
m.drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
{name = "wool:white", chance = 1, min = 1, max = 3},
}
m.water_damage = 0
m.do_custom = function(self)
if not (self and loud_walking.custom_ready(self)) then
return
end
loud_walking.surface_damage(self, true)
end
minetest.registered_entities["loud_walking:spider_ice"] = m
mobs.spawning_mobs["loud_walking:spider_ice"] = true
mobs:register_spawn("loud_walking:spider_ice", {"default:ice"}, 14, 0, 1000, 2, 31000)
mobs:register_egg("loud_walking:spider_ice", "Ice Spider", "mobs_cobweb.png", 1)
-- dangling spiders
m = table.copy(minetest.registered_entities["mobs_monster:spider"])
m.name = 'loud_walking:dangler'
m.docile_by_day = false
m.attacks_monsters = true
m.damage = 2
m.hp_min = 9
m.hp_max = 27
m.armor = 100
m.water_damage = 0
m.fall_damage = 0
m.collisionbox = {-0.32, -0.0, -0.25, 0.25, 0.25, 0.25}
m.visual_size = {x = 1.5, y = 1.5}
m.drops = {
{name = "mobs:meat_raw", chance = 2, min = 1, max = 4},
{name = "farming:cotton", chance = 2, min = 1, max = 4},
}
m.do_custom = function(self)
if not (self and loud_walking.custom_ready(self)) then
return
end
loud_walking.climb(self)
loud_walking.search_replace(self.object:getpos(), 30, {"air"}, "mobs:cobweb")
loud_walking.surface_damage(self)
end
minetest.registered_entities["loud_walking:dangler"] = m
mobs.spawning_mobs["loud_walking:dangler"] = true
--mobs:register_spawn("loud_walking:dangler", loud_walking_stones, 14, 0, 1000, 3, 31000)
mobs:register_egg("loud_walking:dangler", "Dangling Spider", "mobs_cobweb.png", 1)
-- tarantula
m = table.copy(minetest.registered_entities["mobs_monster:spider"])
m.name = 'loud_walking:tarantula'
m.type = "animal"
m.reach = 1
m.damage = 1
m.hp_min = 1
m.hp_max = 2
m.collisionbox = {-0.15, -0.01, -0.15, 0.15, 0.1, 0.15}
m.textures = { {"loud_walking_tarantula.png"}, }
m.base_texture = m.textures[1]
m.visual_size = {x = 1, y = 1}
m.sounds = {}
m.run_velocity = 2
m.jump = false
m.drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 1}, }
m.do_custom = function(self)
if not self then
return
end
if not self.loud_walking_damage_timer then
self.loud_walking_damage_timer = 0
end
loud_walking.surface_damage(self)
end
minetest.registered_entities["loud_walking:tarantula"] = m
mobs.spawning_mobs["loud_walking:tarantula"] = true
mobs:register_spawn("loud_walking:tarantula", {"default:desert_sand", "default:dirt_with_dry_grass"}, 99, 0, 4000, 2, 31000)
mobs:register_egg("loud_walking:tarantula", "Tarantula", "mobs_cobweb.png", 1)
end
if minetest.registered_entities["mobs_monster:sand_monster"] then
local m = table.copy(minetest.registered_entities["mobs_monster:sand_monster"])
m.name = 'loud_walking:tar_monster'
m.damage = 2
m.hp_min = 10
m.hp_max = 30
m.armor = 200
m.textures = { {"loud_walking_tar_monster.png"}, }
m.base_texture = m.textures[1]
m.drops = { {name = "default:coal_lump", chance = 1, min = 3, max = 5}, }
m.water_damage = 1
m.lava_damage = 2
m.light_damage = 1
minetest.registered_entities["loud_walking:tar_monster"] = m
mobs.spawning_mobs["loud_walking:tar_monster"] = true
--mobs:register_spawn("loud_walking:tar_monster", {"loud_walking:black_sand"}, 20, 0, 4000, 1, 31000)
mobs:register_egg("loud_walking:tar_monster", "Tar Monster", "loud_walking_black_sand.png", 1)
m = table.copy(minetest.registered_entities["mobs_monster:sand_monster"])
m.name = 'loud_walking:sand_monster'
m.textures = { {"loud_walking_sand_monster.png"}, }
m.base_texture = m.textures[1]
m.drops = { {name = "default:sand", chance = 1, min = 3, max = 5}, }
minetest.registered_entities["loud_walking:sand_monster"] = m
mobs.spawning_mobs["loud_walking:sand_monster"] = true
--mobs:register_spawn("loud_walking:sand_monster", {"default:sand"}, 20, 0, 4000, 3, 31000)
mobs:register_egg("loud_walking:sand_monster", "Deep Sand Monster", "default_sand.png", 1)
--mobs:register_spawn("loud_walking:sand_monster", {"loud_walking:pyramid_1"}, 20, 0, 150, 5, 31000)
end
if minetest.registered_entities["mobs_monster:stone_monster"] then
--mobs:register_spawn("mobs_monster:stone_monster", {"loud_walking:pyramid_1"}, 20, 0, 300, 5, 31000)
--local stones = table.copy(loud_walking_stones)
--stones[#stones+1] = 'loud_walking:hot_cobble'
--stones[#stones+1] = 'loud_walking:salt'
--mobs:register_spawn("mobs_monster:stone_monster", stones, 7, 0, 7000, 1, 31000)
m = table.copy(minetest.registered_entities["mobs_monster:stone_monster"])
m.name = 'loud_walking:radiated_stone_monster'
m.damage = 4
m.hp_min = 20
m.hp_max = 45
m.armor = 70
m.textures = { {"loud_walking_radiated_stone_monster.png"}, }
m.base_texture = m.textures[1]
m.drops = { {name = "loud_walking:radioactive_ore", chance = 1, min = 3, max = 5}, }
minetest.registered_entities["loud_walking:radiated_stone_monster"] = m
mobs.spawning_mobs["loud_walking:radiated_stone_monster"] = true
--mobs:register_spawn("loud_walking:radiated_stone_monster", {"loud_walking:salt"}, 20, 0, 7000, 3, 31000)
mobs:register_egg("loud_walking:radiated_stone_monster", "Radiated Stone Monster", "loud_walking_radioactive_ore.png", 1)
end
if minetest.registered_entities["mobs_monster:dungeon_master"] then
mobs:register_spawn("mobs_monster:dungeon_master", 'group:stone', 7, 0, 7000, 1, 31000)
end
if minetest.registered_entities["mobs_monster:oerkki"] then
mobs:register_spawn("mobs_monster:oerkki", 'group:stone', 7, 0, 7000, 1, 31000)
end
if minetest.registered_entities["mobs_monster:mese_monster"] then
mobs:register_spawn("mobs_monster:mese_monster", 'group:stone', 7, 0, 5000, 1, 31000)
end
if minetest.registered_entities["mobs_bat:bat"] then
mobs:spawn_specific("mobs_bat:bat", {"air"}, 'group:stone', 0, 6, 30, 20000, 2, -31000, 31000)
end
if minetest.registered_entities["mobs_monster:dirt_monster"] then
-- check this
mobs:register_spawn("mobs_monster:dirt_monster", {"default:dirt_with_dry_grass"}, 7, 0, 7000, 1, 31000, false)
end
if loud_walking.path then
dofile(loud_walking.path.."/greenslimes.lua")
dofile(loud_walking.path.."/dmobs.lua")
dofile(loud_walking.path.."/goblin.lua")
end

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +0,0 @@
The car model was created by Melkor, and distributed under the CC-BY-NC-SA license:
http://creativecommons.org/licenses/by-nc-sa/3.0/
The cars_car.obj model was taken from cheapie's non-laggy cars mod (https://github.com/cheapie/cars/blob/master/README), and is also CC-BY-NC-SA.
All of the goblin code and art are taken from FreeLikeGNU's Goblins mod,
distributed under the CC-by-SA license.
https://forum.minetest.net/viewtopic.php?f=9&t=13004&hilit=goblins
http://creativecommons.org/licenses/by-sa/3.0/
Many of the creatures were created by D00Med <heiselong@gmx.com> and are distributed under CC BY-SA 3.0.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

755
nodes.lua
View File

@ -4,556 +4,6 @@ local light_max = 12
local max_depth = 31000
local newnode = loud_walking.clone_node("farming:straw")
newnode.description = 'Bundle of Grass'
newnode.tiles = {'farming_straw.png^[colorize:#00FF00:50'}
minetest.register_node("loud_walking:bundle_of_grass", newnode)
minetest.register_craft({
output = 'loud_walking:bundle_of_grass',
recipe = {
{'default:grass_1', 'default:grass_1', 'default:grass_1'},
{'default:grass_1', 'default:grass_1', 'default:grass_1'},
{'default:grass_1', 'default:grass_1', 'default:grass_1'},
}
})
minetest.register_craft({
output = 'loud_walking:bundle_of_grass',
type = 'shapeless',
recipe = {
'default:junglegrass', 'default:junglegrass',
'default:junglegrass', 'default:junglegrass',
}
})
newnode = loud_walking.clone_node("farming:straw")
newnode.description = "Dry Fiber"
minetest.register_node("loud_walking:dry_fiber", newnode)
minetest.register_craft({
type = "cooking",
output = "loud_walking:dry_fiber",
recipe = 'loud_walking:bundle_of_grass',
cooktime = 3,
})
local function rope_remove(pos)
if not pos then
return
end
for i = 1, 100 do
local newpos = table.copy(pos)
newpos.y = newpos.y - i
local node = minetest.get_node_or_nil(newpos)
if node and node.name and node.name == 'loud_walking:rope_ladder_piece' then
minetest.set_node(newpos, {name='air'})
else
break
end
end
end
local good_params = {nil, true, true, true, true}
for length = 10, 50, 10 do
minetest.register_node("loud_walking:rope_ladder_"..length, {
description = "Rope Ladder ("..length.." meter)",
drawtype = "signlike",
tiles = {"loud_walking_rope_ladder.png"},
inventory_image = "loud_walking_rope_ladder.png",
wield_image = "loud_walking_rope_ladder.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
climbable = true,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
groups = {snappy = 2, oddly_breakable_by_hand = 3, flammable = 2},
legacy_wallmounted = true,
sounds = default.node_sound_leaves_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
if not (pointed_thing and pointed_thing.above) then
return
end
local pos_old = pointed_thing.above
local orig = minetest.get_node_or_nil(pos_old)
if orig and orig.name and orig.param2 and good_params[orig.param2] then
for i = 1, length do
local newpos = table.copy(pos_old)
newpos.y = newpos.y - i
local node = minetest.get_node_or_nil(newpos)
if node and node.name and node.name == 'air' then
minetest.set_node(newpos, {name='loud_walking:rope_ladder_piece', param2=orig.param2})
else
break
end
end
end
end,
on_destruct = rope_remove,
})
if length > 10 then
rec = {}
for i = 10, length, 10 do
rec[#rec+1] = 'loud_walking:rope_ladder_10'
end
minetest.register_craft({
output = 'loud_walking:rope_ladder_'..length,
type = 'shapeless',
recipe = rec,
})
end
end
minetest.register_node("loud_walking:rope_ladder_piece", {
description = "Rope Ladder",
drawtype = "signlike",
tiles = {"loud_walking_rope_ladder.png"},
inventory_image = "loud_walking_rope_ladder.png",
wield_image = "loud_walking_rope_ladder.png",
drop = '',
paramtype = "light",
paramtype2 = "wallmounted",
buildable_to = true,
sunlight_propagates = true,
walkable = false,
climbable = true,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
groups = {snappy = 2, oddly_breakable_by_hand = 3, flammable = 2},
legacy_wallmounted = true,
sounds = default.node_sound_leaves_defaults(),
on_destruct = rope_remove,
})
minetest.register_craft({
output = 'loud_walking:rope_ladder_10',
recipe = {
{'loud_walking:dry_fiber', '', 'loud_walking:dry_fiber'},
{'loud_walking:dry_fiber', 'loud_walking:dry_fiber', 'loud_walking:dry_fiber'},
{'loud_walking:dry_fiber', '', 'loud_walking:dry_fiber'},
}
})
minetest.register_craftitem("loud_walking:apple_pie_slice", {
description = "Apple Pie Slice",
inventory_image = "loud_walking_apple_pie_slice.png",
on_use = minetest.item_eat(5),
})
minetest.register_craft({
output = 'loud_walking:apple_pie_slice 6',
type = 'shapeless',
recipe = {
'loud_walking:apple_pie',
}
})
minetest.register_node("loud_walking:apple_pie", {
description = "Apple Pie",
drawtype = "raillike",
tiles = {"loud_walking_apple_pie.png"},
inventory_image = "loud_walking_apple_pie.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.5, -0.4, 0.4}
},
groups = {dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_craftitem("loud_walking:apple_pie_uncooked", {
description = "Uncooked Apple Pie",
inventory_image = "loud_walking_apple_pie_uncooked.png",
})
if minetest.registered_items['mobs:bucket_milk'] then
minetest.register_craft({
output = 'loud_walking:apple_pie_uncooked',
type = 'shapeless',
recipe = {
'default:apple',
'default:apple',
'farming:flour',
'mobs:bucket_milk',
},
replacements = {
{'mobs:bucket_milk', 'loud_walking:bucket_empty'},
},
})
end
if minetest.registered_items['mobs:honey'] then
minetest.register_craft({
output = 'loud_walking:apple_pie_uncooked',
type = 'shapeless',
recipe = {
'default:apple',
'default:apple',
'farming:flour',
'mobs:honey',
},
})
end
if minetest.registered_items['mobs:meat_raw'] then
minetest.register_craft({
output = 'loud_walking:meat_pie_uncooked',
type = 'shapeless',
recipe = {
'loud_walking:barely_edible_meat',
'loud_walking:barely_edible_meat',
'loud_walking:onion',
'loud_walking:onion',
'farming:flour',
},
})
minetest.register_craftitem("loud_walking:meat_pie_uncooked", {
description = "Uncooked Meat Pie",
inventory_image = "loud_walking_meat_pie_uncooked.png",
})
minetest.register_craft({
output = 'loud_walking:meat_pie_uncooked',
type = 'shapeless',
recipe = {
'mobs:meat_raw',
'mobs:meat_raw',
'loud_walking:onion',
'farming:flour',
},
})
minetest.register_craftitem("loud_walking:barely_edible_meat", {
description = "Barely edible meat",
inventory_image = "mobs_meat.png^[colorize:#000000:150",
on_use = minetest.item_eat(1),
})
minetest.register_node("loud_walking:meat_pie", {
description = "Meat Pie",
drawtype = "raillike",
tiles = {"loud_walking_meat_pie.png"},
inventory_image = "loud_walking_meat_pie.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.5, -0.4, 0.4}
},
groups = {dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "loud_walking:meat_pie",
recipe = "loud_walking:meat_pie_uncooked"
})
minetest.register_craftitem("loud_walking:meat_pie_slice", {
description = "Meat Pie Slice",
inventory_image = "loud_walking_meat_pie_slice.png",
on_use = minetest.item_eat(9),
})
minetest.register_craft({
output = 'loud_walking:meat_pie_slice 5',
type = 'shapeless',
recipe = {
'loud_walking:meat_pie',
}
})
end
farming.register_plant("loud_walking:onion", {
description = "Onion",
inventory_image = "loud_walking_onion.png",
steps = 3,
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"}
})
minetest.registered_items['loud_walking:seed_onion'] = nil
minetest.registered_nodes['loud_walking:seed_onion'] = nil
minetest.registered_craftitems['loud_walking:seed_onion'] = nil
minetest.register_alias('loud_walking:seed_onion', 'loud_walking:onion')
for i = 1, 3 do
local onion = minetest.registered_items['loud_walking:onion_'..i]
if onion then
onion.drop = {
max_items = i,
items = {
{ items = {'loud_walking:onion'}, rarity = 4 - i, },
{ items = {'loud_walking:onion'}, rarity = (4 - i) * 2, },
{ items = {'loud_walking:onion'}, rarity = (4 - i) * 4, },
},
}
end
end
minetest.register_node("loud_walking:onion", {
description = "Onion",
drawtype = "plantlike",
visual_scale = 0.75,
tiles = {"loud_walking_onion.png"},
inventory_image = "loud_walking_onion.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
fertility = {'grassland'},
groups = {seed = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
next_plant = 'loud_walking:onion_1',
on_timer = farming.grow_plant,
minlight = 10,
maxlight = 15,
on_place = function(itemstack, placer, pointed_thing)
local stack = farming.place_seed(itemstack, placer, pointed_thing, 'loud_walking:onion')
if stack then
return stack
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "loud_walking:apple_pie",
recipe = "loud_walking:apple_pie_uncooked"
})
for i = 3, 5 do
minetest.override_item("default:grass_" .. i, {
drop = {
max_items = 2,
items = {
{ items = { "default:grass_1"}, },
{ items = {'farming:seed_wheat'},rarity = 5 },
{ items = {"loud_walking:onion",}, rarity = 5 },
},
},
})
end
minetest.register_craftitem("loud_walking:wooden_bowl", {
description = "Wooden Bowl",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_wooden_bowl.png"},
inventory_image = "loud_walking_wooden_bowl.png",
groups = {bowl = 1, dig_immediate = 3},
})
minetest.register_craft({
output = 'loud_walking:wooden_bowl 20',
recipe = {
{'group:wood', '', 'group:wood'},
{'group:wood', '', 'group:wood'},
{'', 'group:wood', ''},
},
})
minetest.register_craft({
output = 'default:diamondblock',
recipe = {
{'default:coalblock', 'default:coalblock', 'default:coalblock'},
{'default:coalblock', 'default:mese_crystal_fragment', 'default:coalblock'},
{'default:coalblock', 'default:coalblock', 'default:coalblock'},
}
})
minetest.register_craft({
output = 'default:mese_crystal 2',
recipe = {
{'default:diamond', 'default:diamond', 'default:diamond'},
{'default:diamond', 'default:mese_crystal', 'default:diamond'},
{'default:diamond', 'default:diamond', 'default:diamond'},
}
})
minetest.register_craftitem("loud_walking:charcoal", {
description = "Charcoal Briquette",
inventory_image = "default_coal_lump.png",
groups = {coal = 1}
})
minetest.register_craft({
type = "fuel",
recipe = "loud_walking:charcoal",
burntime = 50,
})
minetest.register_craft({
type = "cooking",
output = "loud_walking:charcoal",
recipe = "group:tree",
})
minetest.register_craft({
output = 'default:torch 4',
recipe = {
{'group:coal'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:coalblock',
recipe = {
{'group:coal', 'group:coal', 'group:coal'},
{'group:coal', 'group:coal', 'group:coal'},
{'group:coal', 'group:coal', 'group:coal'},
}
})
if minetest.get_modpath('tnt') then
minetest.register_craft({
output = "tnt:gunpowder",
type = "shapeless",
recipe = {"group:coal", "default:gravel"}
})
end
minetest.register_craftitem("loud_walking:disgusting_gruel", {
description = "Disgusting Gruel",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_disgusting_gruel.png"},
inventory_image = "loud_walking_disgusting_gruel.png",
on_use = minetest.item_eat(2),
groups = {dig_immediate = 3},
})
minetest.register_craftitem("loud_walking:disgusting_gruel_raw", {
description = "Bowl Of Gluey Paste",
drawtype = "plantlike",
paramtype = "light",
tiles = {"loud_walking_disgusting_gruel_raw.png"},
inventory_image = "loud_walking_disgusting_gruel_raw.png",
groups = {dig_immediate = 3},
})
minetest.register_craft({
type = "cooking",
output = "loud_walking:disgusting_gruel",
recipe = 'loud_walking:disgusting_gruel_raw',
cooktime = 2,
})
minetest.register_craft({
output = "loud_walking:disgusting_gruel_raw",
type = 'shapeless',
recipe = {
'loud_walking:dry_fiber',
'group:water_bucket',
'group:bowl',
},
replacements = {
{'bucket:bucket_water', 'bucket:bucket_water'},
{'bucket:bucket_river_water', 'bucket:bucket_river_water'},
{'loud_walking:bucket_wood_water', 'loud_walking:bucket_wood_water'},
{'loud_walking:bucket_wood_river_water', 'loud_walking:bucket_wood_river_water'},
},
})
-- Glowing fungal stone provides an eerie light.
minetest.register_node("loud_walking:glowing_fungal_stone", {
description = "Glowing Fungal Stone",
tiles = {"default_stone.png^vmg_glowing_fungal.png",},
is_ground_content = true,
light_source = light_max - 4,
groups = {cracky=3, stone=1},
drop = {items={ {items={"default:cobble"},}, {items={"loud_walking:glowing_fungus",},},},},
sounds = default.node_sound_stone_defaults(),
})
-- Glowing fungus grows underground.
minetest.register_craftitem("loud_walking:glowing_fungus", {
description = "Glowing Fungus",
drawtype = "plantlike",
paramtype = "light",
tiles = {"vmg_glowing_fungus.png"},
inventory_image = "vmg_glowing_fungus.png",
groups = {dig_immediate = 3},
})
-- moon glass (glows)
newnode = loud_walking.clone_node("default:glass")
newnode.description = "Glowing Glass"
newnode.light_source = default.LIGHT_MAX
minetest.register_node("loud_walking:moon_glass", newnode)
-- Moon juice is extracted from glowing fungus, to make glowing materials.
minetest.register_craftitem("loud_walking:moon_juice", {
description = "Moon Juice",
drawtype = "plantlike",
paramtype = "light",
tiles = {"vmg_moon_juice.png"},
inventory_image = "vmg_moon_juice.png",
--groups = {dig_immediate = 3, attached_node = 1},
groups = {dig_immediate = 3, vessel = 1},
sounds = default.node_sound_glass_defaults(),
})
-- moon juice from fungus
minetest.register_craft({
output = "fun_caves:moon_juice",
recipe = {
{"fun_caves:glowing_fungus", "fun_caves:glowing_fungus", "fun_caves:glowing_fungus"},
{"fun_caves:glowing_fungus", "fun_caves:glowing_fungus", "fun_caves:glowing_fungus"},
{"fun_caves:glowing_fungus", "vessels:glass_bottle", "fun_caves:glowing_fungus"},
},
})
minetest.register_craft({
output = "fun_caves:moon_glass",
type = "shapeless",
recipe = {
"fun_caves:moon_juice",
"fun_caves:moon_juice",
"default:glass",
},
})
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",
@ -634,7 +84,7 @@ loud_walking.control_fun = function(pos, node, puncher, pointed_thing)
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)
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)
@ -734,3 +184,206 @@ minetest.register_node("loud_walking:control_plant_2", {
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)
newnode = loud_walking.clone_node("default:water_source")
newnode.description = "Poisonous Water"
newnode.groups.poison = 3
--newnode.light_source = 6
newnode.liquid_alternative_flowing = "loud_walking:water_poison_flowing"
newnode.liquid_alternative_source = "loud_walking:water_poison_source"
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
newnode.special_tiles[1].name = "loud_walking_water_poison_source_animated.png"
newnode.tiles[1].name = "loud_walking_water_poison_source_animated.png"
minetest.register_node("loud_walking:water_poison_source", newnode)
newnode = loud_walking.clone_node("default:water_flowing")
newnode.description = "Poisonous Water"
newnode.groups.poison = 3
--newnode.light_source = 6
newnode.liquid_alternative_flowing = "loud_walking:water_poison_flowing"
newnode.liquid_alternative_source = "loud_walking:water_poison_source"
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
newnode.special_tiles[1].name = "loud_walking_water_poison_flowing_animated.png"
newnode.tiles[1] = "loud_walking_water_poison.png"
minetest.register_node("loud_walking:water_poison_flowing", newnode)
minetest.register_node("loud_walking:basalt_raw", {
description = "Basalt",
tiles = {"loud_walking_basalt.png"},
is_ground_content = true,
groups = {cracky=1, level=2},
drop = {max_items=2, items={ {items={"loud_walking:basalt"},}, {items={"default:gold_lump",}, rarity=30,}, {items={"default:diamond",}, rarity=60,}, {items={"default:mese_crystal",}, rarity=60,},},},
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
newnode = loud_walking.clone_node("loud_walking:basalt_raw")
newnode.drop = nil
minetest.register_node('loud_walking:basalt', newnode)
minetest.register_node("loud_walking:granite_raw", {
description = "Granite",
tiles = {"loud_walking_granite.png"},
is_ground_content = true,
groups = {cracky=1, level=3},
drop = {max_items=2, items={ {items={"loud_walking:granite"},}, {items={"default:gold_lump",}, rarity=15,}, {items={"default:diamond",}, rarity=20,}, {items={"default:mese_crystal",}, rarity=20,},},},
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
newnode = loud_walking.clone_node("loud_walking:granite_raw")
newnode.drop = nil
minetest.register_node('loud_walking:granite', newnode)
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},
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

400
tools.lua
View File

@ -1,400 +0,0 @@
local function floor(pos, blocks, node_name, user_name)
if not (pos and blocks and node_name and user_name and type(blocks) == 'number' and type(node_name) == 'string' and type(user_name) == 'string') then
return
end
local p = {y = pos.y}
local count = 0
for r = 1, blocks do
for z = -r, r do
p.z = pos.z + z
for x = -r, r do
p.x = pos.x + x
local node = minetest.get_node_or_nil(p)
if node and (node.name == 'air' or node.name == 'default:water_source') and not minetest.is_protected(p, user_name) then
minetest.set_node(p, {name = node_name})
count = count + 1
if count > blocks then
return
end
end
end
end
end
end
if minetest.get_modpath('tnt') then
-- Floor bombs
local nodes = {{'default:sandstone', 'default:sandstone_block'}, {'default:wood', 'loud_walking:wood_block'}, {'default:stone', 'default:stone_block'},}
for _, node in pairs(nodes) do
local node_name = node[1]
local comp = node[2] or node_name
if not minetest.registered_items[node_name] or (not minetest.registered_items[comp] and not comp:find('^loud_walking')) then
break
end
local node_texture = minetest.registered_items[node_name].tiles
if type(node_texture) == 'table' then
node_texture = node_texture[1]
end
local _, d_name = node_name:match('(.*:)(.*)')
local bomb_name = "loud_walking:"..d_name..'_floor_bomb'
local d_name_u = d_name:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end)
local newnode = loud_walking.clone_node(node_name)
newnode.description = d_name_u.." Floor Bomb"
newnode.inventory_image = '[inventorycube{'..node_texture..'{'..node_texture..'{'..node_texture..'^loud_walking_expand.png'
newnode.drop = bomb_name
newnode.on_punch = function(pos, node, puncher, pointed_thing)
if not (pos and puncher) then
return
end
local wield = puncher:get_wielded_item()
if not wield or wield:get_name() ~= "default:torch" then
return
end
minetest.after(5, function()
local pos_node = minetest.get_node_or_nil(pos)
if not (pos_node and pos_node.name == bomb_name) then
return
end
floor(pos, 100, node_name, puncher:get_player_name())
minetest.set_node(pos, {name = node_name})
end)
end
minetest.register_node(bomb_name, newnode)
if not minetest.registered_items[comp] then
newnode = loud_walking.clone_node(node_name)
newnode.description = newnode.description .. ' Block'
minetest.register_node(comp, newnode)
minetest.register_craft({
output = comp,
recipe = {
{node_name, node_name, node_name},
{node_name, node_name, node_name},
{node_name, node_name, node_name}
}
})
end
minetest.register_craft({
output = "loud_walking:"..d_name..'_floor_bomb',
recipe = {
{comp, comp, comp},
{comp, "tnt:gunpowder", comp},
{comp, comp, comp}
}
})
end
end
local function power(player, pos, tool_type, max)
if not (player and pos and tool_type) then
return
end
local player_pos = vector.round(player:getpos())
local player_name = player:get_player_name()
local inv = player:get_inventory()
pos = vector.round(pos)
local node = minetest.get_node_or_nil(pos)
if not (node and player_pos and player_name and inv) then
return
end
local maxr, node_type
if tool_type == 'axe' then
node_type = 'choppy'
maxr = {x = 2, y = 20, z = 2}
elseif tool_type == 'pick' then
node_type = 'cracky'
maxr = {x = 2, y = 4, z = 2}
else
return
end
if minetest.get_item_group(node.name, node_type) == 0 then
return
end
local max_nodes = max or 60
local minp = vector.subtract(pos, 2)
local maxp = vector.add(pos, maxr)
local yloop_a, yloop_b, yloop_c
if pos.y >= player_pos.y then
minp.y = player_pos.y
yloop_a, yloop_b, yloop_c = minp.y, maxp.y, 1
if node_type == 'cracky' and pos.y - player_pos.y < 3 then
maxp.y = player_pos.y + 3
end
else
maxp.y = player_pos.y
yloop_a, yloop_b, yloop_c = maxp.y, minp.y, -1
end
local air = minetest.get_content_id('air')
local vm = minetest.get_voxel_manip()
if not vm then
return
end
local emin, emax = vm:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data()
local drops = {}
local names = {}
local diggable = {}
local tree_like = {}
local leaf_like = {}
local stone_like = {}
local count = 0
local p = {}
for y = yloop_a, yloop_b, yloop_c do
p.y = y
for z = minp.z, maxp.z do
p.z = z
local ivm = area:index(minp.x, y, z)
for x = minp.x, maxp.x do
p.x = x
if not names[data[ivm]] then
names[data[ivm]] = minetest.get_name_from_content_id(data[ivm])
end
if not diggable[data[ivm]] then
diggable[data[ivm]] = minetest.get_item_group(names[data[ivm]], node_type) or 0
if node_type == 'choppy' then
diggable[data[ivm]] = diggable[data[ivm]] + minetest.get_item_group(names[data[ivm]], 'snappy') or 0
diggable[data[ivm]] = diggable[data[ivm]] + minetest.get_item_group(names[data[ivm]], 'fleshy') or 0
end
if names[data[ivm]] and names[data[ivm]]:find('^door') then
diggable[data[ivm]] = 0
end
end
if count < max_nodes and diggable[data[ivm]] > 0 and not minetest.is_protected(p, player_name) then
drops[data[ivm]] = (drops[data[ivm]] or 0) + 1
data[ivm] = air
count = count + 1
end
ivm = ivm + 1
end
end
end
vm:set_data(data)
vm:write_to_map()
vm:update_map()
local tool = player:get_wielded_item()
for id, number in pairs(drops) do
for i = 1, number do
local drops = minetest.get_node_drops(names[id], tool:get_name())
minetest.handle_node_drops(pos, drops, player)
end
local tp = tool:get_tool_capabilities()
local def = ItemStack({name=names[id]}):get_definition()
local dp = minetest.get_dig_params(def.groups, tp)
if not dp then
return
end
tool:add_wear(dp.wear * number)
end
return tool
end
minetest.register_tool("loud_walking:chainsaw", {
description = "Chainsaw",
inventory_image = "loud_walking_chainsaw.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=80, maxlevel=2},
},
damage_groups = {fleshy=4},
},
on_use = function(itemstack, user, pointed_thing)
if not (user and pointed_thing) then
return
end
minetest.sound_play('chainsaw', {
object = user,
gain = 0.1,
max_hear_distance = 30
})
return power(user, pointed_thing.under, 'axe')
end,
})
minetest.register_tool("loud_walking:jackhammer", {
description = "Jackhammer",
inventory_image = "loud_walking_jackhammer.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=80, maxlevel=2},
},
damage_groups = {fleshy=4},
},
on_use = function(itemstack, user, pointed_thing)
if not (user and pointed_thing) then
return
end
minetest.sound_play('jackhammer', {
object = user,
gain = 0.1,
max_hear_distance = 30
})
return power(user, pointed_thing.under, 'pick')
end,
})
minetest.register_craft({
output = 'loud_walking:chainsaw',
recipe = {
{'', 'default:diamond', ''},
{'', 'default:steelblock', ''},
{'default:copper_ingot', 'default:coalblock', ''},
}
})
minetest.register_craft({
output = 'loud_walking:chainsaw',
recipe = {
{'', '', ''},
{'', 'loud_walking:chainsaw', ''},
{'', 'default:steelblock', 'default:coalblock'},
}
})
minetest.register_craft({
output = 'loud_walking:jackhammer',
recipe = {
{'default:copper_ingot', 'default:coalblock', ''},
{'', 'default:steelblock', ''},
{'', 'default:diamond', ''},
}
})
minetest.register_craft({
output = 'loud_walking:jackhammer',
recipe = {
{'', '', ''},
{'', 'loud_walking:jackhammer', ''},
{'', 'default:steelblock', 'default:coalblock'},
}
})
local function flares(player)
local dir = player:get_look_dir()
local pos = player:getpos()
if not pos then
return
end
pos.x = pos.x + dir.x * 10
pos.y = pos.y + dir.y * 10
pos.z = pos.z + dir.z * 10
pos = vector.round(pos)
local air = minetest.get_content_id('air')
local flare = minetest.get_content_id('loud_walking:flare')
local vm = minetest.get_voxel_manip()
if not vm then
return
end
local r = 8
local minp = vector.subtract(pos, r)
local maxp = vector.add(pos, r)
local emin, emax = vm:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data()
local count = 0
for i = 1, 50 do
local x = pos.x + math.random(2 * r + 1) - r - 1
local y = pos.y + math.random(2 * r + 1) - r - 1
local z = pos.z + math.random(2 * r + 1) - r - 1
local ivm = area:index(x, y, z)
if data[ivm] == air then
data[ivm] = flare
count = count + 1
end
end
vm:set_data(data)
vm:calc_lighting(minp, maxp)
vm:update_liquids()
vm:write_to_map()
vm:update_map()
return count
end
minetest.register_node("loud_walking:flare", {
description = "Fungal tree fruit",
drawtype = "plantlike",
visual_scale = 0.75,
tiles = {"loud_walking_flare.png"},
paramtype = "light",
sunlight_propagates = true,
light_source = 15,
walkable = false,
diggable = false,
pointable = false,
is_ground_content = false,
})
minetest.register_tool("loud_walking:flare_gun", {
description = "Flare Gun",
inventory_image = "loud_walking_flare_gun.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
on_use = function(itemstack, user, pointed_thing)
if not user then
return
end
local count = flares(user)
itemstack:add_wear(count * 400)
return itemstack
end,
})
minetest.register_craft({
output = 'loud_walking:flare_gun',
recipe = {
{'', '', ''},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'', 'tnt:gunpowder', 'group:stick'},
}
})
minetest.register_craft({
output = 'loud_walking:flare_gun',
recipe = {
{'', '', ''},
{'', 'loud_walking:flare_gun', ''},
{'', 'tnt:gunpowder', ''},
}
})

View File

@ -1,145 +0,0 @@
local function register_liquid_wood(source, itemname, inventory_image, name, groups)
if not (source and itemname and inventory_image and name and type(source) == 'string' and type(itemname) == 'string' and type(inventory_image) == 'string') then
return
end
inventory_image = inventory_image..'^loud_walking_wood_bucket_overlay.png'
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
if not (user and pointed_thing) then
return
end
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
user and not user:get_player_control().sneak then
return ndef.on_rightclick(pointed_thing.under, node, user, itemstack)
end
local lpos
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
lpos = pointed_thing.under
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
lpos = pointed_thing.above
local node = minetest.get_node_or_nil(lpos)
if not node then
return
end
local above_ndef = node and minetest.registered_nodes[node.name]
if not above_ndef or not above_ndef.buildable_to then
-- do not remove the bucket with the liquid
return itemstack
end
end
if minetest.is_protected(lpos, user and user:get_player_name() or "") then
return
end
minetest.set_node(lpos, {name = source})
return ItemStack("loud_walking:bucket_wood_empty")
end
})
end
for fluid, def in pairs(bucket.liquids) do
if not fluid:find('flowing') and not fluid:find('lava') and not fluid:find('molten') and not fluid:find('weightless') then
local item_name = def.itemname:gsub('[^:]+:bucket', 'loud_walking:bucket_wood')
local original = minetest.registered_items[def.itemname]
if original and item_name and item_name ~= def.itemname then
local new_name = original.description:gsub('Bucket', 'Wooden Bucket')
local new_image = original.inventory_image
register_liquid_wood(fluid, item_name, new_image, new_name, original.groups)
end
end
end
minetest.register_craft({
output = 'loud_walking:bucket_wood_empty 1',
recipe = {
{'group:wood', '', 'group:wood'},
{'', 'group:wood', ''},
}
})
minetest.register_craftitem("loud_walking:bucket_wood_empty", {
description = "Empty Wooden Bucket",
inventory_image = "loud_walking_wood_bucket.png",
stack_max = 99,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if not (user and pointed_thing and pointed_thing.type == "node") then
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
if not node then
return
end
local liquiddef = bucket.liquids[node.name]
if not liquiddef or node.name ~= liquiddef.source then
return
end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
return
end
if node and node.name:find('lava') or node.name:find('molten') then
itemstack:set_count(itemstack:get_count() - 1)
return itemstack
end
local item_count = user:get_wielded_item():get_count()
-- default set to return filled bucket
local giving_back = liquiddef.itemname:gsub('^[^:]+:bucket', 'loud_walking:bucket_wood')
-- check if holding more than 1 empty bucket
if item_count > 1 then
-- if space in inventory add filled bucket, otherwise drop as item
local inv = user:get_inventory()
if inv:room_for_item("main", {name=giving_back}) then
inv:add_item("main", giving_back)
else
local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, giving_back)
end
-- set to return empty buckets minus 1
giving_back = "loud_walking:bucket_wood_empty "..tostring(item_count-1)
end
minetest.add_node(pointed_thing.under, {name="air"})
return ItemStack(giving_back)
end,
})