From 2d6b16de43d1179c19369b34c48ef8efe16a261b Mon Sep 17 00:00:00 2001 From: MinetestSam <42088654+MinetestSam@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:19:03 +0530 Subject: [PATCH] Remove collision boxes of dead players (#468) --- mods/pvp/collisionbox/init.lua | 17 +++++++++++++++++ mods/pvp/collisionbox/mod.conf | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 mods/pvp/collisionbox/init.lua create mode 100644 mods/pvp/collisionbox/mod.conf diff --git a/mods/pvp/collisionbox/init.lua b/mods/pvp/collisionbox/init.lua new file mode 100644 index 0000000..4bd6e73 --- /dev/null +++ b/mods/pvp/collisionbox/init.lua @@ -0,0 +1,17 @@ +local collision_box = {} + +minetest.register_on_dieplayer(function(player) + local name = player:get_player_name() + if not collision_box[name] then + collision_box[name] = player:get_properties().collisionbox + end + player:set_properties({collisionbox = {0,0,0, 0,0,0}}) +end) + +minetest.register_on_respawnplayer(function(player) + player:set_properties({collisionbox = collision_box[player:get_player_name()]}) +end) + +minetest.register_on_leaveplayer(function(player) + collision_box[player:get_player_name()] = nil +end) diff --git a/mods/pvp/collisionbox/mod.conf b/mods/pvp/collisionbox/mod.conf new file mode 100644 index 0000000..cf72d58 --- /dev/null +++ b/mods/pvp/collisionbox/mod.conf @@ -0,0 +1,2 @@ +name = collisionbox +description = Changes the collision box of player on death to allow no obstructions when looting or fighting another player.