mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-02-03 22:10:24 +01:00
add a small bit of anti-griefing - the seal breach bell only tolls globally 13 times per activation
This commit is contained in:
parent
922181bba2
commit
e0b3b023b0
@ -397,7 +397,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
|
|
||||||
-- puzzle seal
|
-- puzzle seal
|
||||||
local puzzle_seal = nil
|
local puzzle_seal = nil
|
||||||
if pit_uninitialized and math.random() < 0.025 then
|
if pit_uninitialized and math.random() < 0.1 then
|
||||||
local index2d = mapgen_helper.index2d(emin, emax, minp.x + 3, minp.z + 3)
|
local index2d = mapgen_helper.index2d(emin, emax, minp.x + 3, minp.z + 3)
|
||||||
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
|
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 wave = nvals_wave[index2d] * wave_mult
|
||||||
|
@ -58,7 +58,10 @@ local test_key = function(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if valid then
|
if valid then
|
||||||
|
local unlocked = meta:get_int("unlocked")
|
||||||
|
if unlocked == 0 then
|
||||||
meta:set_int("unlocked", 1)
|
meta:set_int("unlocked", 1)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -105,7 +108,7 @@ local show_key = function(pos, index)
|
|||||||
minetest.sound_play("dfcaverns_seal_key", {
|
minetest.sound_play("dfcaverns_seal_key", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 0.125,
|
gain = 0.125,
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 32,
|
||||||
})
|
})
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local keystring = meta:get_string("key")
|
local keystring = meta:get_string("key")
|
||||||
@ -131,12 +134,13 @@ local show_key = function(pos, index)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local show_unlocked = function(pos)
|
local show_unlocked = function(pos, global)
|
||||||
-- Plays globally. This is deliberate.
|
-- Plays globally. This is deliberate.
|
||||||
minetest.sound_play("dfcaverns_seal_unlocked", {
|
if global then
|
||||||
gain = 1.0,
|
minetest.sound_play("dfcaverns_seal_unlocked", {})
|
||||||
pitch = 1.0,
|
else
|
||||||
})
|
minetest.sound_play("dfcaverns_seal_unlocked", {pos = pos, max_hear_distance = 128,})
|
||||||
|
end
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
pos = pos,
|
pos = pos,
|
||||||
velocity = {x=0, y=1, z=0},
|
velocity = {x=0, y=1, z=0},
|
||||||
@ -180,8 +184,10 @@ local puzzle_seal_def = {
|
|||||||
end,
|
end,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if meta:get_int("unlocked") > 0 then
|
local unlocked = meta:get_int("unlocked")
|
||||||
show_unlocked(pos)
|
if unlocked > 0 then
|
||||||
|
meta:set_int("unlocked", unlocked + 1)
|
||||||
|
show_unlocked(pos, unlocked <= 13)
|
||||||
else
|
else
|
||||||
local index = meta:get_int("key_index")
|
local index = meta:get_int("key_index")
|
||||||
show_key(pos, index)
|
show_key(pos, index)
|
||||||
|
Loading…
Reference in New Issue
Block a user