ores_stats/core/functions.lua

39 lines
1.1 KiB
Lua
Raw Normal View History

2020-07-23 00:53:00 +02:00
--[[
Ores' Statistics - Provides informations about ores' percentages
Copyright © 2018, 2020 Hamlet and contributors.
Licensed under the EUPL, Version 1.2 or as soon they will be
approved by the European Commission subsequent versions of the
EUPL (the "Licence");
You may not use this work except in compliance with the Licence.
You may obtain a copy of the Licence at:
https://joinup.ec.europa.eu/software/page/eupl
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
Unless required by applicable law or agreed to in writing,
software distributed under the Licence is distributed on an
"AS IS" basis,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the Licence for the specific language governing permissions
and limitations under the Licence.
--]]
--
-- Functions
--
-- Used to calculate an ore's percentage
ores_stats.fn_CalcPercentage = function(a_i_ore, a_i_total_ores)
local f_percentage = 0.0
if (a_i_total_ores ~= 0) then
f_percentage = ((a_i_ore * 100) / a_i_total_ores)
end
return f_percentage
end