commit ec27d805b2e0929e2313eced371f1a12150c45ac Author: Auke Kok Date: Tue Oct 15 16:01:47 2019 -0700 Initial commit. diff --git a/README.md b/README.md new file mode 100644 index 0000000..beb7906 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ + +## YOLO - You Only Live Once + +A simple ban-based hardcode mod. Simply install and enable and players +who die will get banned. Other players will see a "RIP" message with a +reason why the player died. The player is instantly kicked and banned +on death. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..717f23d --- /dev/null +++ b/init.lua @@ -0,0 +1,38 @@ + +--[[ + +Copyright (C) 2019 - Auke Kok + +"yolo" is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 +of the license, or (at your option) any later version. + +--]] + +local reasontbl = { + set_hp = "lost their health", + punch = "got their lights punched out", + fall = "fell to their death", + node_damage = "burnt to a crips", + drown = "swam with the fish", + respawn = "tried to cheat death" +} + +minetest.register_on_dieplayer(function(player, reason) + local name = player:get_player_name() + local reasonstr = reasontbl[reason.type] or "expired" + minetest.chat_send_all( + "RIP " .. name .. ", who " .. reasonstr) + local meta = player:get_meta() + meta:set_int("dead", 1) + minetest.kick_player(name, "You died on a hardcore server.") +end) + +minetest.register_on_joinplayer(function(player) + local meta = player:get_meta() + if meta:get_int("dead") == 1 then + local name = player:get_player_name() + minetest.kick_player(name, "You died on a hardcore server.") + end +end) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..0381353 --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = yolo +license = LGPL-2.1 +description = You Only Live Once - AKA hardcore mode - death is permanent.