From 25325f579c8a590c3d4c485b6620b1e646a5ea19 Mon Sep 17 00:00:00 2001 From: MoNTE48 Date: Mon, 16 Mar 2020 02:07:49 +0100 Subject: [PATCH] Add little player damage --- interact.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/interact.lua b/interact.lua index 805d7f6..50791dc 100644 --- a/interact.lua +++ b/interact.lua @@ -45,5 +45,14 @@ minetest.register_on_protection_violation(function(pos, name) ("%s is protected by %s."):format( minetest.pos_to_string(pos), table.concat(owners, ", "))) + + -- Little damage player + local player = minetest.get_player_by_name(name) + if player and player:is_player() then + local hp = player:get_hp() + if hp and hp > 1 then + player:set_hp(hp - 1) + end + end end end)