From 3b01f2b9b7b05ac5ddf298a5b8278d732d5de8bc Mon Sep 17 00:00:00 2001 From: sys4 Date: Sun, 15 Mar 2020 13:47:32 +0100 Subject: [PATCH] Modifie le sang cuit qui devient mangeable Nettoyage du code --- hell.lua | 6 ++---- items.lua | 3 ++- portal.lua | 52 ++-------------------------------------------------- 3 files changed, 6 insertions(+), 55 deletions(-) diff --git a/hell.lua b/hell.lua index 18837ac..2b13e6a 100644 --- a/hell.lua +++ b/hell.lua @@ -121,6 +121,8 @@ end local path = minetest.get_modpath("hell") dofile(path.."/weird_mapgen_noise.lua") dofile(path.."/items.lua") +minetest.register_privilege("hell", + "Allows sending players to hell and extracting them") dofile(path.."/portal.lua") --dofile(path.."/furnace.lua") dofile(path.."/pearl.lua") @@ -1027,10 +1029,6 @@ minetest.register_abm({ end }) - -minetest.register_privilege("hell", - "Allows sending players to hell and extracting them") - dofile(path.."/crafting.lua") dofile(path.."/guide.lua") diff --git a/items.lua b/items.lua index dbf51f4..4093fb7 100644 --- a/items.lua +++ b/items.lua @@ -831,7 +831,8 @@ minetest.register_craftitem("hell:hotbed", { itemstack:take_item() return itemstack - end + end, + on_use = minetest.item_eat(1), }) minetest.register_alias("nether:hotbed", "hell:hotbed") diff --git a/portal.lua b/portal.lua index 75ad1ce..2095253 100644 --- a/portal.lua +++ b/portal.lua @@ -47,21 +47,6 @@ else function update_background() end end --- returns nodename if area is generated, else calls generation function -local function generated_or_generate(pos) - local node = minetest.get_node_or_nil(pos) - if node then - return node.name - end - minetest.get_voxel_manip():read_from_map(pos, pos) - node = minetest.get_node_or_nil(pos) - if not node then - minetest.emerge_area(vector.subtract(pos, 80), vector.add(pos, 80)) - return false - end - return node.name -end - -- where the player appears after dying local function get_player_died_target(player) local target = vector.add(player:get_pos(), @@ -166,7 +151,6 @@ minetest.register_chatcommand("from_hell", { end }) - if hell_prisons then -- randomly set player position when he/she dies in hell minetest.register_on_respawnplayer(function(player) @@ -264,39 +248,6 @@ else end) end --- teleports player to hell (obsidian portal) -local function obsi_teleport_player(player, pos, target) - local pname = player:get_player_name() - if players_in_hell[pname] then - return - end - - local objpos = player:get_pos() - objpos.y = objpos.y+0.1 -- Fix some glitches at -8000 - if minetest.get_node(vector.round(objpos)).name ~= "hell:portal" then - return - end - - local has_teleported - if obsidian_portal_kills then - obsidian_teleport(player, pname) - has_teleported = true - elseif not mclike_portal then - local target = vector.round(get_player_died_target(player)) - if generated_or_generate(target) then - obsidian_teleport(player, pname, target) - has_teleported = true - end - end - - if not has_teleported then - -- e.g. ungenerated area - return - end - - minetest.sound_play("hell_portal_usual", {to_player=pname, gain=1}) -end - -- a not filled square vector.square = vector.square or function(r) @@ -381,7 +332,7 @@ local function hell_port(player, pos) end minetest.sound_play("hell_teleporter", {pos=pos}) local meta = minetest.get_meta({x=pos.x, y=pos.y-1, z=pos.z}) - if pos.y < hell.start then + if pos.y < hell.start and pos.y > hell.DEPTH-510 then set_portal(known_portals_d, pos.z,pos.x, pos.y) local my = tonumber(meta:get_string("y")) @@ -537,6 +488,7 @@ if hell.HELL_REALM_ENABLED then end obsidian_teleport(player, pname) + minetest.sound_play("hell_portal_usual", {to_player=pname, gain=1}) end, }) end