Compare commits

...

5 Commits

Author SHA1 Message Date
84648fd95f Change hell.DEPTH to -19640 to keep the compat. with legacy code 2020-07-04 18:56:21 +02:00
172d2c7501 Corrige alias 2020-06-27 18:14:17 +02:00
dd331a6868 Ajoute alias manquants (again) 2020-06-27 18:02:38 +02:00
e1fbfae304 Ajoute alias manquants 2020-06-27 17:48:49 +02:00
5fb7d30dbc Corrige la portée de téléportation 2020-03-22 19:20:37 +01:00
3 changed files with 32 additions and 19 deletions

View File

@ -19,7 +19,7 @@ hell.path = minetest.get_modpath(hell.modname)
hell.get_translator = S
-- Settings
hell.DEPTH = -20000 -- The y location of the Hell
hell.DEPTH = -19640 -- The y location of the Hell
hell.FASTTRAVEL_FACTOR = 10 -- 10 could be better value for Minetest, since there's no sprint, but ex-Minecraft players will be mathing for 8
hell.HELL_REALM_ENABLED = true -- Setting to false disables the Hell and Hell portal

View File

@ -37,6 +37,14 @@ local function add_more_nodes(name)
end
end
local function add_aliases(old, new)
minetest.register_alias("nether:"..old, "hell:"..new)
minetest.register_alias("nether:stair_"..old, "hell:stair_"..new)
minetest.register_alias("nether:slab_"..old, "hell:slab_"..new)
minetest.register_alias("stairs:stair_"..old, "hell:stair_"..new)
minetest.register_alias("stairs:slab_"..old, "hell:slab_"..new)
end
--[[
local function add_fence(name)
local def = minetest.registered_nodes[name]
@ -86,7 +94,7 @@ minetest.register_node("hell:hellrack", {
end,
})
add_more_nodes("hellrack")
minetest.register_alias("nether:netherrack", "hell:hellrack")
add_aliases("netherrack", "hellrack")
minetest.register_node("hell:hellrack_tiled", {
description = "Tiled Hellrack",
@ -98,7 +106,7 @@ minetest.register_node("hell:hellrack_tiled", {
end,
})
add_more_nodes("hellrack_tiled")
minetest.register_alias("nether:netherrack_tiled", "hell:hellrack_tiled")
add_aliases("netherrack_tiled", "hellrack_tiled")
minetest.register_node("hell:hellrack_soil", {
description = "Dirty Hellrack",
@ -109,7 +117,7 @@ minetest.register_node("hell:hellrack_soil", {
return digging_allowed(player, 2)
end,
})
minetest.register_alias("nether:netherrack_soil", "hell:hellrack_soil")
add_aliases("netherrack_soil", "hellrack_soil")
minetest.register_node("hell:hellrack_black", {
description = "Black Hellrack",
@ -121,7 +129,7 @@ minetest.register_node("hell:hellrack_black", {
end,
})
add_more_nodes("hellrack_black")
minetest.register_alias("nether:netherrack_black", "hell:hellrack_black")
add_aliases("netherrack_black", "hellrack_black")
minetest.register_node("hell:hellrack_blue", {
description = "Blue Hellrack",
@ -133,7 +141,7 @@ minetest.register_node("hell:hellrack_blue", {
end,
})
add_more_nodes("hellrack_blue")
minetest.register_alias("nether:netherrack_blue", "hell:hellrack_blue")
add_aliases("netherrack_blue", "hellrack_blue")
-- Hellbrick
minetest.register_node("hell:hellrack_brick", {
@ -146,7 +154,7 @@ minetest.register_node("hell:hellrack_brick", {
end,
})
add_more_nodes("hellrack_brick")
minetest.register_alias("nether:netherrack_brick", "hell:hellrack_brick")
add_aliases("netherrack_brick", "hellrack_brick")
minetest.register_node("hell:hellrack_brick_blue", {
description = "Blue Hellrack Brick",
@ -158,7 +166,7 @@ minetest.register_node("hell:hellrack_brick_blue", {
end,
})
add_more_nodes("hellrack_brick_blue")
minetest.register_alias("nether:netherrack_brick_blue", "hell:hellrack_brick_blue")
add_aliases("netherrack_brick_blue", "hellrack_brick_blue")
minetest.register_node("hell:hellrack_brick_black", {
description = "Black Hellrack Brick",
@ -170,7 +178,7 @@ minetest.register_node("hell:hellrack_brick_black", {
end,
})
add_more_nodes("hellrack_brick_black")
minetest.register_alias("nether:netherrack_brick_black", "hell:hellrack_brick_black")
add_aliases("netherrack_brick_black", "hellrack_brick_black")
minetest.register_node("hell:white", {
description = "Siwtonic block",

View File

@ -50,7 +50,7 @@ end
-- where the player appears after dying
local function get_player_died_target(player)
local target = vector.add(player:get_pos(),
{x=math.random(-100,100), y=0, z=math.random(-100,100)})
{x=math.random(-5,5), y=0, z=math.random(-5,5)})
target.y = portal_target + math.random(4)
return target
end
@ -61,10 +61,9 @@ local function obsidian_teleport(player, pname, target)
players_in_hell[pname] = true
save_hell_players()
update_background(player, true)
player:set_hp(0)
if target then
player:set_pos(target)
else
player:set_hp(0)
end
end
@ -336,7 +335,10 @@ local function hell_port(player, pos)
set_portal(known_portals_d, pos.z,pos.x, pos.y)
local my = tonumber(meta:get_string("y"))
local y = get_portal(known_portals_u, pos.z,pos.x)
local destination_pos = vector.multiply(pos, hell.FASTTRAVEL_FACTOR)
destination_pos.x = math.min(30900, math.max(-30900, destination_pos.x)) -- clip to world boundary
destination_pos.z = math.min(30900, math.max(-30900, destination_pos.z)) -- clip to world boundary
local y = get_portal(known_portals_u, destination_pos.z, destination_pos.x)
if y then
if y ~= my then
meta:set_string("y", y)
@ -344,14 +346,17 @@ local function hell_port(player, pos)
else
y = my or 100
end
pos.y = y - 0.3
destination_pos.y = y - 0.3
player_from_hell(player, pos)
player_from_hell(player, destination_pos)
else
set_portal(known_portals_u, pos.z,pos.x, pos.y)
local my = tonumber(meta:get_string("y"))
local y = get_portal(known_portals_d, pos.z,pos.x)
local destination_pos = vector.divide(pos, hell.FASTTRAVEL_FACTOR)
destination_pos.x = math.floor(0.5 + destination_pos.x) -- round to int
destination_pos.z = math.floor(0.5 + destination_pos.z) -- round to int
local y = get_portal(known_portals_d, destination_pos.z, destination_pos.x)
if y then
if y ~= my then
meta:set_string("y", y)
@ -359,9 +364,9 @@ local function hell_port(player, pos)
else
y = my or portal_target+math.random(4)
end
pos.y = y - 0.3
destination_pos.y = y - 0.3
player_to_hell(player, pos)
player_to_hell(player, destination_pos)
end
minetest.sound_play("hell_teleporter", {pos=pos})
return true
@ -487,7 +492,7 @@ if hell.HELL_REALM_ENABLED then
return
end
obsidian_teleport(player, pname)
obsidian_teleport(player, pname, new_playerPos)
minetest.sound_play("hell_portal_usual", {to_player=pname, gain=1})
end,
})