Skip to content
Snippets Groups Projects
Commit 9c8afa99 authored by magicfelix's avatar magicfelix
Browse files

Adapt to advanced category functionality

parent 68fcb513
No related branches found
No related tags found
No related merge requests found
...@@ -4,4 +4,6 @@ local srcpath = modpath .. "/src" ...@@ -4,4 +4,6 @@ local srcpath = modpath .. "/src"
magic_rush = {} magic_rush = {}
dofile(srcpath .. "/game.lua") if magic_stats then
dofile(srcpath .. "/stats.lua")
end
if magic_stats then
magic_rush.stats = magic_stats.Game.register("magic_rush", "mlg", "MLG-Rush", {
klls = {display_name = "Kills"},
beds = {display_name = "Beds"},
deaths = {display_name = "Deaths"},
})
end
local function calc_kd(self, player)
local kills = self.game.categories.kills:get_stat(player)
local deaths = self.game.categories.deaths:get_stat(player)
return kills / deaths
end
local game = magic_stats.Game.register("magic_rush", "mlg", "MLG-Rush")
local simple_categories = {
kills = "Kills",
deaths = "Deaths",
beds = "Beds",
}
for name, display_name in pairs(simple_categories) do
local category = magic_stats.Category.new(game, name, display_name)
game.categories[name] = category
end
local category_kd = magic_stats.Category.new(game, "kd", "K/D", calc_kd)
game.categories["kd"] = category_kd
magic_rush.stats = game
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment