From 69c9f04b4ac16cb1214807791c14d0736ee75e4c Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Mon, 19 Jul 2021 20:11:26 +0200 Subject: [PATCH] Fix bugs --- liquid.lua | 4 ++-- networks.lua | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/liquid.lua b/liquid.lua index 17e2455..76b468b 100644 --- a/liquid.lua +++ b/liquid.lua @@ -188,7 +188,7 @@ end function networks.liquid.srv_put(nvm, name, amount, capa) assert(name) - assert(amount and amount > 0) + assert(amount and amount >= 0) assert(capa and capa > 0) nvm.liquid = nvm.liquid or {} @@ -212,7 +212,7 @@ function networks.liquid.srv_put(nvm, name, amount, capa) end function networks.liquid.srv_take(nvm, name, amount) - assert(amount and amount > 0) + assert(amount and amount >= 0) nvm.liquid = nvm.liquid or {} amount = amount or 0 diff --git a/networks.lua b/networks.lua index de7581d..bbed549 100644 --- a/networks.lua +++ b/networks.lua @@ -489,10 +489,16 @@ function networks.determine_netID(pos, tlib2, outdir) end -- Provide network with all node tables -function networks.get_network_table(pos, tlib2, outdir) +function networks.get_network_table(pos, tlib2, outdir, force) assert(outdir) local netID = get_netID(pos, outdir) if netID then return get_network(tlib2.tube_type, netID) end + if force then -- force the network load + local netID = networks.determine_netID(pos, tlib2, outdir) + if netID then + return get_network(tlib2.tube_type, netID) + end + end end