OpenComputerScripts/teleport_calc.lua

20 lines
532 B
Lua
Raw Normal View History

2018-07-02 16:47:02 +08:00
-- Teleport Calculator
2018-12-03 20:20:19 +08:00
2018-11-09 23:38:21 +08:00
local function getEUStr(eu)
if(eu<1000) then
2018-12-03 20:20:19 +08:00
return string.format("%d EU",eu)
elseif(eu<1000000) then
return string.format("%.2fK EU",eu/1000)
2018-11-09 23:38:21 +08:00
else
2018-12-03 20:20:19 +08:00
return string.format("%.2fM EU",eu/1000000)
2018-11-09 23:38:21 +08:00
end
end
2018-12-03 20:20:19 +08:00
local function teleport_calc(dis,item)
2018-07-02 16:47:02 +08:00
if(item==nil) then item=40 end
local ret=(1000+100*item)*math.pow(dis+10,0.7)
2018-12-03 20:20:19 +08:00
print("Teleport Steve with " .. item .. " items to " .. dis .. "m away needs " .. getEUStr(ret))
2018-07-02 16:47:02 +08:00
return ret
end
2018-12-03 20:20:19 +08:00
return teleport_calc