mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-11 18:50:27 +01:00
add statues to underworld mapgen
This commit is contained in:
parent
14fcdd30c6
commit
92d9cb1399
@ -9,6 +9,8 @@ local bones_loot_path = minetest.get_modpath("bones_loot")
|
||||
local named_waypoints_path = minetest.get_modpath("named_waypoints")
|
||||
local namegen_path = minetest.get_modpath("namegen")
|
||||
|
||||
local hunters_enabled = minetest.get_modpath("hunter_statue") and df_underworld_items.config.underworld_hunter_statues
|
||||
|
||||
local name_pit = function() end
|
||||
local name_ruin = function() end
|
||||
|
||||
@ -555,6 +557,27 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
end
|
||||
|
||||
if hunters_enabled then
|
||||
local x = math.random(minp.x, maxp.x)
|
||||
local z = math.random(minp.z, maxp.z)
|
||||
local index2d = mapgen_helper.index2d(emin, emax, x, z)
|
||||
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
|
||||
local wave = nvals_wave[index2d] * wave_mult
|
||||
local floor_height = math.floor(abs_cave * floor_mult + median + floor_displace + wave)-1
|
||||
local zone = math.abs(nvals_zone[index2d])
|
||||
if math.random() < zone / 2 then -- hunters are more common in the built-up areas
|
||||
for y = floor_height, floor_height+20 do
|
||||
local target_pos = {x=x, y=y, z=z}
|
||||
local target_node = minetest.get_node(target_pos)
|
||||
if minetest.get_item_group(target_node.name, "slade") == 0 then
|
||||
minetest.set_node(target_pos, {name="df_underworld_items:hunter_statue"})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local time_taken = os.clock() - t_start -- how long this chunk took, in seconds
|
||||
mapgen_helper.record_time("df_caverns underworld", time_taken)
|
||||
end)
|
||||
|
@ -13,7 +13,10 @@ if minetest.get_modpath("hunter_statue") and df_underworld_items.config.underwor
|
||||
groups = {hunter_statue = 1, falling_node = 1, immortal = 1},
|
||||
other_overrides = {
|
||||
can_dig = function(pos, player)
|
||||
return minetest.check_player_privs(player, "server")
|
||||
if player then
|
||||
return minetest.check_player_privs(player, "server")
|
||||
end
|
||||
return false
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
@ -3,7 +3,10 @@ local S = df_underworld_items.S
|
||||
local invulnerable = df_underworld_items.config.invulnerable_slade and not minetest.settings:get_bool("creative_mode")
|
||||
|
||||
local server_diggable_only = function(pos, player)
|
||||
return minetest.check_player_privs(player, "server")
|
||||
if player then
|
||||
return minetest.check_player_privs(player, "server")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local add_immortality = function(slade_def)
|
||||
|
@ -139,6 +139,7 @@ hunter_statue.register_hunter_statue = function(node_name, statue_def)
|
||||
minetest.set_node(test_above, {name="air"}) -- some kind of filler node?
|
||||
node.param2 = new_facedir
|
||||
minetest.set_node(test_base, node)
|
||||
minetest.check_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
minetest.sound_play({name="hunter_statue_brick_step"}, {pos = pos})
|
||||
return
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user