prizes fix
parent
6963c256a0
commit
e0c15bd050
3
init.lua
3
init.lua
|
@ -253,6 +253,7 @@ local function spawnstep(dtime)
|
||||||
--minetest.add_entity(pos2, "zombiestrd:target") --debug target
|
--minetest.add_entity(pos2, "zombiestrd:target") --debug target
|
||||||
pos2.y=pos2.y-5
|
pos2.y=pos2.y-5
|
||||||
local height, liquidflag = mobkit.get_terrain_height(pos2,32)
|
local height, liquidflag = mobkit.get_terrain_height(pos2,32)
|
||||||
|
if height == nil then height = 0 end
|
||||||
local position_at_terrain_height = {x=pos2.x,y=height-0.01,z=pos2.z}
|
local position_at_terrain_height = {x=pos2.x,y=height-0.01,z=pos2.z}
|
||||||
|
|
||||||
--force the spawn area be inside the area
|
--force the spawn area be inside the area
|
||||||
|
@ -387,7 +388,7 @@ minetest.register_entity("zombiestrd:zombie",{
|
||||||
--PONCTUATION
|
--PONCTUATION
|
||||||
if zombie_score[name] then
|
if zombie_score[name] then
|
||||||
zombie_score[name] = zombie_score[name] + 1
|
zombie_score[name] = zombie_score[name] + 1
|
||||||
check_prizes(puncher,zombie_score[name] + 1)
|
check_prizes(puncher)
|
||||||
else
|
else
|
||||||
zombie_score[name] = 1
|
zombie_score[name] = 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,14 @@ local storage = minetest.get_mod_storage()
|
||||||
zombie_score = {}
|
zombie_score = {}
|
||||||
|
|
||||||
local prizes = {
|
local prizes = {
|
||||||
{500, "default:mese", 1, "mese block"},
|
{250, "binoculars:binoculars", 1, "binoculars"},
|
||||||
{1000, "default:diamondblock", 1, "diamond block"},
|
{500, "default:mese_crystal", 5, "mese crystal"},
|
||||||
{1500, "default:diamondblock", 2, "diamond block"},
|
{750, "default:mese", 1, "mese block"},
|
||||||
|
{1000, "default:steel_ingot", 18, "steel ingot"},
|
||||||
|
{1250, "default:diamond", 5, "diamond"},
|
||||||
|
{1500, "default:diamondblock", 1, "diamond block"},
|
||||||
|
{1750, "default:diamondblock", 2, "diamond block"},
|
||||||
|
{2000, "default:obsidian", 99, "obsidian"},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- load scoreboard
|
-- load scoreboard
|
||||||
|
@ -65,19 +70,19 @@ local function sortscore()
|
||||||
return fname
|
return fname
|
||||||
end
|
end
|
||||||
|
|
||||||
function check_prizes(user,number)
|
function check_prizes(user)
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
for i in ipairs(prizes) do
|
for i in ipairs(prizes) do
|
||||||
local goal = prizes[i][1]
|
local goal = prizes[i][1]
|
||||||
local nodename = prizes[i][2]
|
local nodename = prizes[i][2]
|
||||||
local howmuch = prizes[i][3]
|
local howmuch = prizes[i][3]
|
||||||
local sayit = prizes[i][4]
|
local sayit = prizes[i][4]
|
||||||
|
|
||||||
if zombie_score[name] + number == goal then
|
if zombie_score[name] == goal then
|
||||||
minetest.chat_send_player(name, core.colorize("#FF6700", "Congratulation: You killed your "..goal.."s zombies !! Keep up the good work. "..howmuch.." "..sayit.." have been added to your inv"))
|
minetest.chat_send_player(name, core.colorize("#FF6700", "Congratulation: You killed your "..goal.."s zombies !! Keep up the good work. "..howmuch.." "..sayit.." have been added to your inv"))
|
||||||
inv:add_item("main", {name=nodename, count=howmuch})
|
inv:add_item("main", {name=nodename, count=howmuch})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue