This commit is contained in:
Crispy 2025-06-22 00:08:46 +02:00
parent f8fd2513c8
commit 491112768c
27 changed files with 1095 additions and 3537 deletions

View file

@ -2,6 +2,8 @@ require("pathfinding")
pretty = require("cc.pretty")
pp = pretty.pretty_print
tankCapacity = 2 * 10 * 81000
isFluid = {
water = true,
lava = true,
@ -70,7 +72,7 @@ end
function getFluidAmountInTanks(type, tanks)
for _, fluid in pairs(tanks) do
if stripModname(fluid.name) == type then
return fluid.amount
return mb2droplet(fluid.amount)
end
end
return 0
@ -91,14 +93,6 @@ end
function resetAllFluidDevices()
pumpToDevices(false)
pumpToTanks(false)
-- for name, pos in pairs(fluidDevicePos) do
-- goTo(pos)
-- setRedRouter(false)
-- end
-- for x = 2, -4, -1 do
-- goTo(vector.new(x, 0, -1))
-- setRedRouter(false)
-- end
end
function selectFluidDevice(name)
@ -159,14 +153,20 @@ function connectTank(name)
end
function fluidInvAdd(name, amount)
print("added", amount, "to", name)
print("added", droplet2string(amount), "to", name)
for index, tank in pairs(_G.fluidTanks) do
if tank.name == name then
tank.amount = tank.amount + amount
if tank.amount < 1 then
tank.amount = 0
end
-- TODO limit capacity
if tank.amount > tankCapacity then
tank.amount = tankCapacity
if name ~= "water" then
error("Warning: tank capacity for " ..
name .. "(tank " .. index .. ") exceeded by " .. droplet2string(tank.amount - tankCapacity))
end
end
end
end
saveFluids()