From 0f2787cd16ab3bab52a6f0a759183354a88ce86b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 20 Feb 2017 06:56:17 +0100 Subject: [PATCH] Handle player void handling in playerplus --- mods/ITEMS/mcl_core/nodes.lua | 28 ++++------------------------ mods/MAPGEN/mcl_mapgen_core/init.lua | 9 +++------ mods/PLAYER/playerplus/init.lua | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index 2b5e393eea..ae196437b5 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -21,8 +21,8 @@ minetest.register_node("mcl_core:barrier", { on_blast = function() end, }) --- The harmless void directly below the bottom bedrock layer. It doesn't hurt. -minetest.register_node("mcl_core:void_top", { +-- The void below the bedrock. Void damage is handled in playerplus +minetest.register_node("mcl_core:void", { description = "Void", drawtype = "airlike", paramtype = "light", @@ -30,8 +30,8 @@ minetest.register_node("mcl_core:void_top", { walkable = false, floodable = false, buildable_to = false, - inventory_image = "default_barrier.png", - wield_image = "default_barrier.png", + inventory_image = "unknown_node.png", + wield_image = "unknown_node.png", stack_max = 64, sunlight_propagates = true, is_ground_content = false, @@ -39,26 +39,6 @@ minetest.register_node("mcl_core:void_top", { on_blast = function() end, }) --- The deadly void way below bedrock. It hurts very much! -minetest.register_node("mcl_core:void_deep", { - description = "Deep Void", - drawtype = "airlike", - paramtype = "light", - pointable = false, - walkable = false, - floodable = false, - buildable_to = false, - inventory_image = "default_barrier.png", - wield_image = "default_barrier.png", - stack_max = 64, - sunlight_propagates = true, - is_ground_content = false, - groups = { not_in_creative_inventory = 1 }, - on_blast = function() end, - -- Minecraft Wiki: 4 damage each 0.5 seconds - damage_per_second = 8, -}) - minetest.register_node("mcl_core:stone", { description = "Stone", tiles = {"default_stone.png"}, diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index cc18dd9935..a71e62251c 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -479,8 +479,7 @@ minetest.register_on_generated(function(minp, maxp) local data = vm:get_data() local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax}) local c_bedrock = minetest.get_content_id("mcl_core:bedrock") - local c_void_top = minetest.get_content_id("mcl_core:void_top") - local c_void_deep = minetest.get_content_id("mcl_core:void_deep") + local c_void = minetest.get_content_id("mcl_core:void") local c_air = minetest.get_content_id("air") for y = minp.y, math.min(maxp.y, BEDROCK_MAX) do @@ -503,10 +502,8 @@ minetest.register_on_generated(function(minp, maxp) elseif y == BEDROCK_MAX -4 then -- 100% setdata = c_bedrock - elseif y < BEDROCK_MIN and y > BEDROCK_MIN - 64 then - setdata = c_void_top - elseif y <= BEDROCK_MIN - 64 then - setdata = c_void_deep + elseif y < BEDROCK_MIN then + setdata = c_void end if setdata then data[p_pos] = setdata diff --git a/mods/PLAYER/playerplus/init.lua b/mods/PLAYER/playerplus/init.lua index b22d28e202..298651daa0 100644 --- a/mods/PLAYER/playerplus/init.lua +++ b/mods/PLAYER/playerplus/init.lua @@ -115,6 +115,20 @@ minetest.register_globalstep(function(dtime) end + -- Apply black sky in the Void and deal Void damage + if pos.y < -64 then + -- Player reached the void, set black sky box + player:set_sky("#000000", "plain") + else + player:set_sky(nil, "regular") + end + if pos.y < -64 -64 then + -- Player is deep into the void, deal void damage + if player:get_hp() > 0 then + player:set_hp(player:get_hp() - 4) + end + end + end end)