From 32700340067bacd4d8b510e97f75f529c793fbf8 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Wed, 20 Jun 2018 21:58:41 +0300 Subject: [PATCH] Change infotext --- fluid_tanks/init.lua | 23 ++++++++++++----------- fluid_tanks/mod.conf | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fluid_tanks/init.lua b/fluid_tanks/init.lua index 186d504..6e7a869 100644 --- a/fluid_tanks/init.lua +++ b/fluid_tanks/init.lua @@ -71,8 +71,14 @@ local function tank_on_timer(pos, elapsed) meta:set_string("buffer_fluid", "") end + local fluid_desc = "Empty" + if buffer.fluid ~= "" then + fluid_desc = fluid_lib.cleanse_node_description(buffer.fluid) + end + -- Update infotext - meta:set_string("infotext", ("%s (%d/%d %s)"):format(ndef.description, buffer.amount, buffer.capacity, fluid_lib.unit)) + meta:set_string("infotext", ("%s\nContains: %s (%d/%d %s)"):format(ndef.description, fluid_desc, + buffer.amount, buffer.capacity, fluid_lib.unit)) local param2 = math.min(percentile * 63, 63) @@ -107,9 +113,6 @@ local function create_tank_node(tankname, def, fluid_name) if fdef and fdef.tiles then special_tiles = fdef.tiles end - - local fluid_desc = fluid_lib.cleanse_node_description(fluid_name) - desc = desc .. " of "..fluid_desc end minetest.register_node(tankname, { @@ -188,10 +191,8 @@ function fluid_tanks.register_tank(tankname, def) end end ---minetest.after(0.2, function () - fluid_tanks.register_tank("fluid_tanks:tank", { - description = "Fluid Tank", - capacity = 16000, - accepts = true, - }) ---end) +fluid_tanks.register_tank("fluid_tanks:tank", { + description = "Fluid Tank", + capacity = 16000, + accepts = true, +}) diff --git a/fluid_tanks/mod.conf b/fluid_tanks/mod.conf index 0103f7a..88d080c 100644 --- a/fluid_tanks/mod.conf +++ b/fluid_tanks/mod.conf @@ -1,3 +1,3 @@ name = fluid_tanks description = API for fluid storage. -depends = bucket +depends = fluid_lib,bucket