Upload mod

This commit is contained in:
chmodsayshello 2022-05-23 21:00:35 +02:00 committed by GitHub
parent 2bb86e333e
commit afab2b4376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

24
init.lua Normal file
View File

@ -0,0 +1,24 @@
local setting_get_pos = minetest.setting_get_pos
local spawn_pos = setting_get_pos("static_spawnpoint")
if not spawn_pos then
minetest.log("no custom spawnpoint, using default one (0, 100, 0)")
spawn_pos = {x=0, y=100,z=0}
end
mcl_damage.register_modifier(function(obj, damage, reason)
local all_objects = minetest.get_objects_inside_radius(spawn_pos, 250)
for _,obj2 in ipairs(all_objects) do
if obj2:is_player() then
if obj2.get_player_name(obj2) == obj.get_player_name(obj) then
if damage > 0 then
local new_hp = obj:get_hp() + damage
obj:set_hp(new_hp)
if reason.source then
minetest.kick_player(reason.source.get_player_name(reason.source), "Spawn killing is not allowed (250 block radius)")
minetest.log(reason.source.get_player_name(reason.source) .. " just got kicked for spawn killing!")
end
end
end
end
end
end, 0)

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name=antispawnkill
depends=mcl_damage
author=chmodsayshello