mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
Nether portal delay settings
This commit is contained in:
parent
814a3337f3
commit
7c27cd395e
2 changed files with 16 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
name = mcl_portals
|
name = mcl_portals
|
||||||
description = Adds buildable portals to the Nether and End dimensions.
|
description = Adds buildable portals to the Nether and End dimensions.
|
||||||
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits, mcl_structures
|
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits, mcl_structures, vl_tuning
|
||||||
optional_depends = awards, doc
|
optional_depends = awards, doc
|
||||||
|
|
|
@ -85,7 +85,14 @@ local LIM_MIN, LIM_MAX = mcl_vars.mapgen_edge_min, mcl_vars.mapgen_edge_max
|
||||||
local PLAYER_COOLOFF, MOB_COOLOFF = 3, 14 -- for this many seconds they won't teleported again
|
local PLAYER_COOLOFF, MOB_COOLOFF = 3, 14 -- for this many seconds they won't teleported again
|
||||||
local TOUCH_CHATTER_TIME = 1 -- prevent multiple teleportation attempts caused by multiple portal touches, for this number of seconds
|
local TOUCH_CHATTER_TIME = 1 -- prevent multiple teleportation attempts caused by multiple portal touches, for this number of seconds
|
||||||
local CHATTER_US = TOUCH_CHATTER_TIME * 1000000
|
local CHATTER_US = TOUCH_CHATTER_TIME * 1000000
|
||||||
local DELAY = 3 -- seconds before teleporting in Nether portal in Survival mode (4 minus ABM interval time)
|
|
||||||
|
local nether_portal_creative_delay = vl_tuning.setting("gamerule:playersNetherPortalCreativeDelay", "number", {
|
||||||
|
default = 0,
|
||||||
|
})
|
||||||
|
local nether_port_survival_delay = vl_tuning.setting("gamerule:playersNetherPortalDefaultDelay", "number", {
|
||||||
|
default = 4,
|
||||||
|
})
|
||||||
|
|
||||||
-- Speeds up the search by allowing some non-air nodes to be replaced when
|
-- Speeds up the search by allowing some non-air nodes to be replaced when
|
||||||
-- looking for acceptable portal locations. Setting this lower means the
|
-- looking for acceptable portal locations. Setting this lower means the
|
||||||
-- algorithm will do more searching. Even at 0, there is no risk of finding
|
-- algorithm will do more searching. Even at 0, there is no risk of finding
|
||||||
|
@ -1477,12 +1484,16 @@ local function teleport(obj, portal_pos)
|
||||||
|
|
||||||
if cooloff[obj] then return end
|
if cooloff[obj] then return end
|
||||||
|
|
||||||
|
local delay = math.max(0, nether_portal_survival_delay[1] - 1)
|
||||||
if minetest.is_creative_enabled(name) then
|
if minetest.is_creative_enabled(name) then
|
||||||
teleport_no_delay(obj, portal_pos)
|
delay = math.max(0, nether_portal_creative_delay[1] - 1)
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after(DELAY, teleport_no_delay, obj, portal_pos)
|
if delay == 0 then
|
||||||
|
teleport_no_delay(obj, portal_pos)
|
||||||
|
else
|
||||||
|
minetest.after(delay, teleport_no_delay, obj, portal_pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
|
Loading…
Reference in a new issue