]> git.lizzy.rs Git - Crafter.git/commitdiff
Add disable fall damage group and add water and waterflow into it
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sun, 26 Apr 2020 15:42:23 +0000 (11:42 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sun, 26 Apr 2020 15:42:23 +0000 (11:42 -0400)
mods/main/nodes.lua
mods/player/player_interaction.lua

index 87cce93cb2178f3d8c634093915df54c77254f47..08547ad517ec8af82afa88b5f3147142c7d44860 100644 (file)
@@ -362,7 +362,7 @@ minetest.register_node("main:water", {
        liquid_alternative_source = "main:water",
        liquid_viscosity = 1,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
-       groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1},
+       groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1,disable_fall_damage=1},
        --sounds = default.node_sound_water_defaults(),
        
        --water explodes in the nether
@@ -426,7 +426,7 @@ minetest.register_node("main:waterflow", {
        liquid_alternative_source = "main:water",
        liquid_viscosity = 1,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
-       groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1},
+       groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1,disable_fall_damage=1},
        --sounds = default.node_sound_water_defaults(),
 })
 
index 4ca309ba72e895c286e106211a558d1247ad99d1..862a5901789a1c3d0521dafee3e323e79e58727c 100644 (file)
@@ -1,9 +1,15 @@
---hurt sound
+--hurt sound and disable fall damage group handling
 minetest.register_on_player_hpchange(function(player, hp_change, reason)
+       if reason.type == "fall" then
+               if minetest.get_node_group(minetest.get_node(player:get_pos()).name, "disable_fall_damage") > 0 then
+                       return(0)
+               end
+       end
        if hp_change < 0 then
                minetest.sound_play("hurt", {object=player, gain = 1.0, max_hear_distance = 60,pitch = math.random(80,100)/100})
        end
-end)
+       return(hp_change)
+end, true)
 
 --throw all items on death
 minetest.register_on_dieplayer(function(player, reason)