mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-24 17:20:19 +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
|
||||
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 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
|
||||
|
@ -58,7 +58,10 @@ local test_key = function(pos)
|
||||
end
|
||||
end
|
||||
if valid then
|
||||
meta:set_int("unlocked", 1)
|
||||
local unlocked = meta:get_int("unlocked")
|
||||
if unlocked == 0 then
|
||||
meta:set_int("unlocked", 1)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -105,7 +108,7 @@ local show_key = function(pos, index)
|
||||
minetest.sound_play("dfcaverns_seal_key", {
|
||||
pos = pos,
|
||||
gain = 0.125,
|
||||
max_hear_distance = 16,
|
||||
max_hear_distance = 32,
|
||||
})
|
||||
local meta = minetest.get_meta(pos)
|
||||
local keystring = meta:get_string("key")
|
||||
@ -131,12 +134,13 @@ local show_key = function(pos, index)
|
||||
})
|
||||
end
|
||||
|
||||
local show_unlocked = function(pos)
|
||||
local show_unlocked = function(pos, global)
|
||||
-- Plays globally. This is deliberate.
|
||||
minetest.sound_play("dfcaverns_seal_unlocked", {
|
||||
gain = 1.0,
|
||||
pitch = 1.0,
|
||||
})
|
||||
if global then
|
||||
minetest.sound_play("dfcaverns_seal_unlocked", {})
|
||||
else
|
||||
minetest.sound_play("dfcaverns_seal_unlocked", {pos = pos, max_hear_distance = 128,})
|
||||
end
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=0, y=1, z=0},
|
||||
@ -180,8 +184,10 @@ local puzzle_seal_def = {
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("unlocked") > 0 then
|
||||
show_unlocked(pos)
|
||||
local unlocked = meta:get_int("unlocked")
|
||||
if unlocked > 0 then
|
||||
meta:set_int("unlocked", unlocked + 1)
|
||||
show_unlocked(pos, unlocked <= 13)
|
||||
else
|
||||
local index = meta:get_int("key_index")
|
||||
show_key(pos, index)
|
||||
|
Loading…
Reference in New Issue
Block a user