123456789101112131415161718192021222324252627 |
- minetest.register_chatcommand("pointing", {
- description = "Print what you're pointing at",
- func = function(name)
- local player = minetest.get_player_by_name(name)
- local pos = vector.round(player:getpos())
- if player then
- if minetest.settings:get_bool("enable_damage") then
- player:set_hp(0)
- lightning.strike(pos)
- 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
- })
|