mirror of
https://github.com/BrownHedgehog78/death_pos.git
synced 2024-11-27 09:23:51 +01:00
Improve the mod a bit
This commit is contained in:
commit
cb36097a2f
18
init.lua
18
init.lua
@ -1,4 +1,5 @@
|
|||||||
local death_pos = {}
|
local death_pos = {}
|
||||||
|
<<<<<<< HEAD
|
||||||
local was_killed = {}
|
local was_killed = {}
|
||||||
local tip_sent = {}
|
local tip_sent = {}
|
||||||
|
|
||||||
@ -20,6 +21,14 @@ minetest.register_on_dieplayer(function(player, reason)
|
|||||||
minetest.after(10, function()
|
minetest.after(10, function()
|
||||||
tip_sent[name] = nil
|
tip_sent[name] = nil
|
||||||
end)
|
end)
|
||||||
|
=======
|
||||||
|
|
||||||
|
minetest.register_on_dieplayer(function(player, reason)
|
||||||
|
local send_tip = minetest.settings:get("death_pos.send_tip_on_die") or true -- Sends tip to use 'death_pos' command when player dies (if true)
|
||||||
|
death_pos[player:get_player_name()] = player:get_pos()
|
||||||
|
if player and send_tip == true then
|
||||||
|
minetest.chat_send_player(player:get_player_name(), minetest.colorize("#60e645", "You died. You can return back to your last death position by using /death_pos command"))
|
||||||
|
>>>>>>> a5a15c5b63d94afe0a9a552ec460e26d7112af91
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -28,6 +37,7 @@ minetest.register_chatcommand("death_pos", {
|
|||||||
privs = {interact = true},
|
privs = {interact = true},
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
|
<<<<<<< HEAD
|
||||||
local pos = death_pos[name]
|
local pos = death_pos[name]
|
||||||
local clear_pos = minetest.settings:get("death_pos.clear_pos") or true -- Clears the death position when 'death_pos' command is used (if true)
|
local clear_pos = minetest.settings:get("death_pos.clear_pos") or true -- Clears the death position when 'death_pos' command is used (if true)
|
||||||
if was_killed[name] then
|
if was_killed[name] then
|
||||||
@ -37,6 +47,14 @@ minetest.register_chatcommand("death_pos", {
|
|||||||
player:set_pos(pos)
|
player:set_pos(pos)
|
||||||
if clear_pos == true then
|
if clear_pos == true then
|
||||||
death_pos[name] = nil
|
death_pos[name] = nil
|
||||||
|
=======
|
||||||
|
local pos = death_pos[player:get_player_name()]
|
||||||
|
local clear_pos = minetest.settings:get("death_pos.clear_pos") or true -- Clears the death position when 'death_pos' command is used (if true)
|
||||||
|
if pos then
|
||||||
|
player:set_pos(pos)
|
||||||
|
if clear_pos == true then
|
||||||
|
death_pos[player:get_player_name()] = nil
|
||||||
|
>>>>>>> a5a15c5b63d94afe0a9a552ec460e26d7112af91
|
||||||
end
|
end
|
||||||
return false, minetest.colorize("#60e645", "Teleported you back to your death position!")
|
return false, minetest.colorize("#60e645", "Teleported you back to your death position!")
|
||||||
else
|
else
|
||||||
|
3
mod.conf
3
mod.conf
@ -1,5 +1,8 @@
|
|||||||
name = death_pos
|
name = death_pos
|
||||||
description = Adds a command to return back to position where you died
|
description = Adds a command to return back to position where you died
|
||||||
|
<<<<<<< HEAD
|
||||||
release = 9430
|
release = 9430
|
||||||
title = Death Position
|
title = Death Position
|
||||||
author = BlueR23
|
author = BlueR23
|
||||||
|
=======
|
||||||
|
>>>>>>> a5a15c5b63d94afe0a9a552ec460e26d7112af91
|
||||||
|
Loading…
Reference in New Issue
Block a user