1
0
Disbranĉigi 0
Ĉi tiu deponejo arĥiviĝis je 2024-01-28. Vi povas vidi kaj elŝuti dosierojn, sed ne povas puŝi nek raporti problemojn nek tirpeti.
minetest_ocd3/mods/killme/init.lua

27 lines
765 B
Lua
Raw Permalink Normal View History

2018-03-18 14:50:17 -05:00
minetest.register_chatcommand("killme", {
description = "Kill yourself to respawn",
func = function(name)
local player = minetest.get_player_by_name(name)
2018-03-18 17:37:28 -05:00
local pos = vector.round(player:getpos())
2018-03-18 14:50:17 -05:00
if player then
if minetest.settings:get_bool("enable_damage") then
player:set_hp(0)
2018-03-18 17:37:28 -05:00
lightning.strike(pos)
2018-03-18 14:50:17 -05:00
return true
else
for _, callback in pairs(core.registered_on_respawnplayers) do
if callback(player) then
return true
end
end
-- There doesn't seem to be a way to get a default spawn pos from the lua API
return false, "No static_spawnpoint defined"
end
else
-- Show error message if used when not logged in, eg: from IRC mod
return false, "You need to be online to be killed!"
end
end
})