Can't figure out how to access fluidbox
Posted: Wed May 17, 2017 6:22 pm
Hi!
I can't figure out what I'm doing wrong...
I checked that I have the right entity reference by destroying it and watching it disappear in-game. Also double-checked that a fluid icon is actually visible the output slot of the building GUI.
(I called it on_tick.)
Output:
-__-
I can't figure out what I'm doing wrong...
I checked that I have the right entity reference by destroying it and watching it disappear in-game. Also double-checked that a fluid icon is actually visible the output slot of the building GUI.
Code: Select all
for i=1,#entity.fluidbox do
local fluidbox = entity.fluidbox[i]
if not fluidbox == nil then
print("Emptying " .. fluidbox["type"] .. "( " .. fluidbox["amount"] .. ")")
entity.damage(fluidbox["amount"], "player")
entity.fluidbox[i] = nil
else
print(i .. "nil")
end
end
Output:
Whyyyyyyyyy!?!?TTY wrote:...
1nil
2nil
1nil
2nil
...
-__-