Solar tribute
./lua/solar tribute.lua
/silent-command
--[[
Calculates who has places the most solar pannels on the map.
]]
local cred={}
for k,v in pairs(game.player.surface.find_entities_filtered(
{type={'solar-panel','accumulator'}})) do
local usr = v.last_user.name
if cred[usr] then
cred[usr] = cred[usr] + 1
else
cred[usr] = 1
end
end
for k,v in pairs(cred) do game.print(k .. ' ' .. v) end