From c47102ca8a460c90dba96224a9f6c3042224fd8d Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Thu, 1 Nov 2018 00:22:39 -0500 Subject: [PATCH] Update stats command. --- README.md | 4 ++++ chatcommands.lua | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cb33a4..e45fb86 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ faction territory titles. faction territories (Like a faction within a faction) +faction color. + +Color tags based on faction color(add support for entity tag mods). + More claim and unclaim commands. faction access manage command. diff --git a/chatcommands.lua b/chatcommands.lua index 404854d..2395236 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -1315,7 +1315,16 @@ factions.register_command("stats", { format = {"faction"}, on_success = function(player, faction, pos, parcelpos, args) local f = args.factions[1] - minetest.chat_send_player(player, "Power: "..f.power.."/"..f.maxpower - f.usedpower.."/"..f.maxpower) + local pps = 0 + if factions_config.enable_power_per_player then + local t = f.onlineplayers + local count = 0 + for _ in pairs(t) do count = count + 1 end + pps = factions_config.power_per_player * count + else + fpps = factions_config.power_per_tick + end + minetest.chat_send_player(player, "Power: "..f.power.." / "..f.maxpower - f.usedpower.."\nPower per "..factions_config.tick_time.." seconds: "..pps.."\nPower per death: -"..factions_config.power_per_death) return true end },false)