fix issue with players using numbers as nick
parent
311d8b5fc5
commit
ed8e759a9f
44
init.lua
44
init.lua
|
@ -400,6 +400,20 @@ minetest.register_on_punchnode(
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local function add_score(name, points, table, prize_index, player)
|
||||||
|
local key = name
|
||||||
|
if tonumber(key) ~= nil then
|
||||||
|
key = "_"..key.."_"
|
||||||
|
end
|
||||||
|
if table[key] then
|
||||||
|
table[key] = table[key] + points
|
||||||
|
check_prizes(player, table[key], prize_index)
|
||||||
|
else
|
||||||
|
table[key] = points
|
||||||
|
end
|
||||||
|
savelist()
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_entity("zombiestrd:zombie",{
|
minetest.register_entity("zombiestrd:zombie",{
|
||||||
-- common props
|
-- common props
|
||||||
physical = true,
|
physical = true,
|
||||||
|
@ -461,15 +475,7 @@ minetest.register_entity("zombiestrd:zombie",{
|
||||||
-- self.object:set_hp(99)
|
-- self.object:set_hp(99)
|
||||||
self.hp=0
|
self.hp=0
|
||||||
--PONCTUATION
|
--PONCTUATION
|
||||||
if tonumber(name) == nil then
|
add_score(name, 1, zombie_score, "zombie", puncher)
|
||||||
if zombie_score[name] then
|
|
||||||
zombie_score[name] = zombie_score[name] + 1
|
|
||||||
check_prizes(puncher, zombie_score[name], "zombie")
|
|
||||||
else
|
|
||||||
zombie_score[name] = 1
|
|
||||||
end
|
|
||||||
savelist()
|
|
||||||
end
|
|
||||||
--END PONCTUATION
|
--END PONCTUATION
|
||||||
else
|
else
|
||||||
mobkit.make_sound(self,'bodyhit')
|
mobkit.make_sound(self,'bodyhit')
|
||||||
|
@ -554,15 +560,7 @@ minetest.register_entity("zombiestrd:ghost",{
|
||||||
-- self.object:set_hp(99)
|
-- self.object:set_hp(99)
|
||||||
self.hp=0
|
self.hp=0
|
||||||
--PONCTUATION
|
--PONCTUATION
|
||||||
if tonumber(name) == nil then
|
add_score(name, 1, ghost_score, "ghost", puncher)
|
||||||
if ghost_score[name] then
|
|
||||||
ghost_score[name] = ghost_score[name] + 1
|
|
||||||
check_prizes(puncher, ghost_score[name], "ghost")
|
|
||||||
else
|
|
||||||
ghost_score[name] = 1
|
|
||||||
end
|
|
||||||
savelist()
|
|
||||||
end
|
|
||||||
--END PONCTUATION
|
--END PONCTUATION
|
||||||
else
|
else
|
||||||
mobkit.make_sound(self,'bodyhit')
|
mobkit.make_sound(self,'bodyhit')
|
||||||
|
@ -575,15 +573,7 @@ minetest.register_entity("zombiestrd:ghost",{
|
||||||
end
|
end
|
||||||
if self.hp<=0 then
|
if self.hp<=0 then
|
||||||
--PONCTUATION
|
--PONCTUATION
|
||||||
if tonumber(name) == nil then
|
add_score(name, 1, ghost_score, "ghost", puncher)
|
||||||
if ghost_score[name] then
|
|
||||||
ghost_score[name] = ghost_score[name] + 1
|
|
||||||
check_prizes(puncher, ghost_score[name], "ghost")
|
|
||||||
else
|
|
||||||
ghost_score[name] = 1
|
|
||||||
end
|
|
||||||
savelist()
|
|
||||||
end
|
|
||||||
--END PONCTUATION
|
--END PONCTUATION
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue