initial leaderboard tracking
This commit is contained in:
parent
d5924374b1
commit
90fadaf56d
29
mobs/_kill_count.lua
Normal file
29
mobs/_kill_count.lua
Normal file
@ -0,0 +1,29 @@
|
||||
nssm.leaderboard = {}
|
||||
|
||||
local function load_leaderboard()
|
||||
-- TODO
|
||||
end
|
||||
|
||||
local function save_leaderboard()
|
||||
-- TODO
|
||||
end
|
||||
|
||||
-- Globally accessible function
|
||||
function __NSSM_kill_count(self, pos)
|
||||
if self.cause_of_death and
|
||||
self.cause_of_death.type == "punch" and
|
||||
self.attack and
|
||||
self.attack.is_player and
|
||||
self.attack:is_player()
|
||||
then
|
||||
|
||||
local playername = self.attack:get_player_name()
|
||||
local playerstats = nssm.leaderboard[playername] or {}
|
||||
local killcount = playerstats[self.name] or 0
|
||||
|
||||
playerstats[self.name] = killcount + 1
|
||||
nssm.leaderboard[playername] = playerstats -- in case new stat
|
||||
|
||||
minetest.log("action", playername.." defeated "..self.name)
|
||||
end
|
||||
end
|
@ -1,3 +1,5 @@
|
||||
nssm:load("mobs/_kill_count.lua")
|
||||
|
||||
nssm:load("mobs/ant_queen.lua")
|
||||
nssm:load("mobs/ant_soldier.lua")
|
||||
nssm:load("mobs/ant_worker.lua")
|
||||
|
@ -101,5 +101,6 @@ mobs:register_mob("nssm:ant_queen", {
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -60,5 +60,6 @@ mobs:register_mob("nssm:ant_soldier", {
|
||||
run_end = 130,
|
||||
punch_start = 60,
|
||||
punch_end = 80,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -60,5 +60,6 @@ mobs:register_mob("nssm:ant_worker", {
|
||||
run_end = 160,
|
||||
punch_start = 50,
|
||||
punch_end = 70,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -64,4 +64,5 @@ mobs:register_mob("nssm:black_widow", {
|
||||
do_custom = function(self)
|
||||
webber_ability(self, "nssm:web", 2)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -61,5 +61,6 @@ mobs:register_mob("nssm:bloco", {
|
||||
run_end = 160,
|
||||
punch_start = 170,
|
||||
punch_end = 190,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -61,5 +61,6 @@ mobs:register_mob("nssm:crab", {
|
||||
run_end = 140,
|
||||
punch_start = 90,
|
||||
punch_end = 110,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -57,5 +57,6 @@ mobs:register_mob("nssm:crocodile", {
|
||||
punch_end = 220,
|
||||
--swim_start = 100,
|
||||
--swim_end = 140,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -55,5 +55,6 @@ mobs:register_mob("nssm:daddy_long_legs", {
|
||||
run_end = 120,
|
||||
punch_start = 140,
|
||||
punch_end = 165,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -54,5 +54,6 @@ mobs:register_mob("nssm:dolidrosaurus", {
|
||||
run_end = 180,
|
||||
punch_start = 190,
|
||||
punch_end = 220,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,6 +59,7 @@ mobs:register_mob("nssm:duck", {
|
||||
run_end = 40,
|
||||
punch_start = 40,
|
||||
punch_end = 60,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
--pathfinding = 1,
|
||||
})
|
||||
|
@ -74,5 +74,6 @@ mobs:register_mob("nssm:duckking", {
|
||||
punch_end = 220,
|
||||
shoot_start = 160,
|
||||
shoot_end = 180,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,5 +59,6 @@ mobs:register_mob("nssm:echidna", {
|
||||
punch_end = 190,
|
||||
shoot_start = 200,
|
||||
shoot_end = 240,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -62,5 +62,6 @@ mobs:register_mob("nssm:enderduck", {
|
||||
run_end = 130,
|
||||
punch_start = 60,
|
||||
punch_end = 90,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -58,5 +58,6 @@ mobs:register_mob("nssm:felucco", {
|
||||
run_end = 160,
|
||||
punch_start = 200,
|
||||
punch_end = 240,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,5 +59,6 @@ mobs:register_mob("nssm:flying_duck", {
|
||||
run_end = 220,
|
||||
punch_start = 110,
|
||||
punch_end = 140,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -56,4 +56,5 @@ mobs:register_mob("nssm:giant_sandworm", {
|
||||
punch_start = 150,
|
||||
punch_end = 180,
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -73,4 +73,5 @@ mobs:register_mob("nssm:icelamander", {
|
||||
do_custom = function(self)
|
||||
midas_ability(self, "default:ice", self.run_velocity,1, 3)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -64,4 +64,5 @@ mobs:register_mob("nssm:icesnake", {
|
||||
do_custom = function(self)
|
||||
putting_ability(self, "default:ice", self.run_velocity)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,5 +59,6 @@ mobs:register_mob("nssm:kraken", {
|
||||
run_end = 100,
|
||||
punch_start = 120,
|
||||
punch_end = 150,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -83,5 +83,6 @@ mobs:register_mob("nssm:larva", {
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -89,6 +89,7 @@ mobs:register_mob("nssm:lava_titan", {
|
||||
-- For now deactivate - it places lava under it, sinks, then places lava under it, sinks, etc ...
|
||||
--putting_ability(self, "default:lava_source", self.run_velocity)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
--[[
|
||||
custom_attack = function (self)
|
||||
-- digging_attack
|
||||
|
@ -61,5 +61,6 @@ mobs:register_mob("nssm:manticore", {
|
||||
punch_end = 143,
|
||||
shoot_start =180,
|
||||
shoot_end=230,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -61,5 +61,6 @@ mobs:register_mob("nssm:mantis", {
|
||||
punch_end = 140,
|
||||
punch2_start = 145,
|
||||
punch2_end = 165,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,5 +59,6 @@ mobs:register_mob("nssm:mantis_beast", {
|
||||
run_end = 110,
|
||||
punch_start = 140,
|
||||
punch_end = 165,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -61,6 +61,8 @@ mobs:register_mob("nssm:masticone", {
|
||||
},
|
||||
on_die = function(self, pos)
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self,pos)
|
||||
|
||||
core.after(2, function()
|
||||
minetest.add_particlespawner({
|
||||
amount = 200,
|
||||
|
@ -112,5 +112,6 @@ mobs:register_mob("nssm:mese_dragon", {
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -51,5 +51,6 @@ mobs:register_mob("nssm:moonheron", {
|
||||
run_end = 60,
|
||||
punch_start = 80,
|
||||
punch_end = 120,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -119,5 +119,6 @@ mobs:register_mob("nssm:mordain", {
|
||||
self.object:setpos(d)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -104,6 +104,7 @@ mobs:register_mob("nssm:morde", {
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
minetest.add_entity(pos, "nssm:mortick")
|
||||
__NSSM_kill_count(self,pos)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -139,6 +140,7 @@ minetest.register_entity("nssm:mortick", {
|
||||
name == "default:lava_flowing" then
|
||||
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self,s)
|
||||
end
|
||||
|
||||
--Find player to attack:
|
||||
|
@ -53,5 +53,6 @@ mobs:register_mob("nssm:morgre", {
|
||||
run_end = 140,
|
||||
punch_start = 100,
|
||||
punch_end = 110,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -183,5 +183,6 @@ mobs:register_mob("nssm:morgut", {
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self, pos)
|
||||
end,
|
||||
})
|
||||
|
@ -240,5 +240,6 @@ mobs:register_mob("nssm:morlu", {
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self,pos)
|
||||
end,
|
||||
})
|
||||
|
@ -837,6 +837,8 @@ mobs:register_mob("nssm:morvalar0", {
|
||||
on_die = function(self)
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self, pos)
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 500,
|
||||
time = 2,
|
||||
|
@ -276,5 +276,6 @@ mobs:register_mob("nssm:morbat3", {
|
||||
run_end = 50,
|
||||
punch_start = 100,
|
||||
punch_end = 115,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -68,4 +68,5 @@ mobs:register_mob("nssm:morwa", {
|
||||
minetest.env:set_node(pos, {name="nssm:morwa_statue"})
|
||||
end
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -186,5 +186,6 @@ mobs:register_mob("nssm:night_master_1", {
|
||||
run_end = 50,
|
||||
punch_start = 130,
|
||||
punch_end = 160,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -118,4 +118,5 @@ mobs:register_mob("nssm:xgaloctopus", {
|
||||
replace_what = {"default:torch"},
|
||||
replace_with = "default:water_source",
|
||||
replace_offset = 0,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -64,5 +64,6 @@ mobs:register_mob("nssm:phoenix", {
|
||||
punch_end = 110,
|
||||
shoot_start = 80,
|
||||
shoot_end = 110,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -44,7 +44,8 @@ local function register_pumpboom(sizename, params)
|
||||
run_end = 97,
|
||||
punch_start = 70,
|
||||
punch_end = 80,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -55,6 +55,8 @@ mobs:register_mob("nssm:pumpking", {
|
||||
},
|
||||
on_die=function(self,pos)
|
||||
self.object:remove()
|
||||
__NSSM_kill_count(self, pos)
|
||||
|
||||
minetest.after(0.2, function(pos)
|
||||
tnt.boom(pos, {damage_radius=5,radius=4,ignore_protection=false})
|
||||
end, pos)
|
||||
|
@ -55,5 +55,6 @@ mobs:register_mob("nssm:sand_bloco", {
|
||||
run_end = 200,
|
||||
punch_start = 100,
|
||||
punch_end = 130,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -61,4 +61,5 @@ mobs:register_mob("nssm:sandworm", {
|
||||
do_custom = function(self)
|
||||
digging_attack(self, "sand", self.run_velocity, {x=0, y=3, z=0})
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -52,5 +52,6 @@ mobs:register_mob("nssm:scrausics", {
|
||||
run_end = 210,
|
||||
punch_start = 20,
|
||||
punch_end = 50,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -52,5 +52,6 @@ mobs:register_mob("nssm:signosigno", {
|
||||
run_end = 220,
|
||||
punch_start = 160,
|
||||
punch_end = 190,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -69,4 +69,5 @@ mobs:register_mob("nssm:snow_biter", {
|
||||
do_custom = function(self)
|
||||
putting_ability(self, "default:ice", self.run_velocity)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -70,5 +70,6 @@ mobs:register_mob("nssm:spiderduck", {
|
||||
punch_end = 46,
|
||||
shoot_start = 150,
|
||||
shoot_end = 200,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,4 +59,5 @@ mobs:register_mob("nssm:stone_eater", {
|
||||
--digging_ability(self, "stone", self.run_velocity, {x=0, y=2, z=0})
|
||||
digging_attack(self, "stone", self.run_velocity, {x=0, y=1, z=0})
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -59,5 +59,6 @@ mobs:register_mob("nssm:swimming_duck", {
|
||||
run_end = 120,
|
||||
punch_start = 140,
|
||||
punch_end = 160,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -141,5 +141,6 @@ mobs:register_mob("nssm:tarantula_propower", {
|
||||
run_end = 160,
|
||||
punch_start = 180,
|
||||
punch_end = 200,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -64,4 +64,5 @@ mobs:register_mob("nssm:uloboros", {
|
||||
do_custom = function(self)
|
||||
webber_ability(self, "nssm:web", 2)
|
||||
end,
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -54,5 +54,6 @@ mobs:register_mob("nssm:werewolf", {
|
||||
run_end = 160,
|
||||
punch_start = 170,
|
||||
punch_end = 193,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
@ -54,5 +54,6 @@ mobs:register_mob("nssm:white_werewolf", {
|
||||
run_end = 160,
|
||||
punch_start = 170,
|
||||
punch_end = 193,
|
||||
}
|
||||
},
|
||||
on_die= __NSSM_kill_count,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user