diff --git a/api/reservoir.lua b/api/reservoir.lua index 132247d..43d426a 100644 --- a/api/reservoir.lua +++ b/api/reservoir.lua @@ -167,10 +167,11 @@ end `liquidDesc`: a human readable liquid description, e.g. "Water"
`bucketItemName` : the name of the bucket that holds the liquid
`liquidTexture` : a single texture to use for the liquid
+ `sourceBlockName` : the name of the minetest liquid source node `optLight` : optional, if nil assumed 0. How much a non-empty reservoir will glow `emptyBucketName` : optional, if nil, bucket:bucket_empty will be used - the "empty" container to use
]] -function logistica.register_reservoir(liquidName, liquidDesc, bucketItemName, liquidTexture, optLight, optEmptyBucketName) +function logistica.register_reservoir(liquidName, liquidDesc, bucketItemName, liquidTexture, sourceNodeName, optLight, optEmptyBucketName) local lname = string.lower(liquidName:gsub(" ", "_")) for _, variantName in ipairs(variants) do @@ -186,6 +187,6 @@ function logistica.register_reservoir(liquidName, liquidDesc, bucketItemName, li minetest.register_node(nodeName, def) logistica.reservoirs[nodeName] = true - logistica.reservoir_register_names(lname, bucketItemName, optEmptyBucketName, liquidDesc, liquidTexture) + logistica.reservoir_register_names(lname, bucketItemName, optEmptyBucketName, liquidDesc, liquidTexture, sourceNodeName) end end diff --git a/logic/reservoir.lua b/logic/reservoir.lua index a874995..0be7656 100644 --- a/logic/reservoir.lua +++ b/logic/reservoir.lua @@ -5,6 +5,8 @@ local NAME_TO_BUCKET = {} local NAME_TO_EMPTY_BUCKET = {} local NAME_TO_DESC = {} local NAME_TO_TEXTURE = {} +local NAME_TO_SOURCE = {} +local SOURCE_TO_NAME = {} local EMPTY_BUCKET = logistica.itemstrings.empty_bucket local EMPTY_SUFFIX = "_empty" @@ -76,7 +78,7 @@ function logistica.reservoir_get_description(currBuckets, maxBuckets, liquidName return strDescription.."\n"..getStrContains(currBuckets, maxBuckets, liquidName) end -function logistica.reservoir_register_names(liquidName, bucketName, emptyBucketName, liquidDesc, liquidTexture) +function logistica.reservoir_register_names(liquidName, bucketName, emptyBucketName, liquidDesc, liquidTexture, sourceNodeName) BUCKET_TO_NAME[bucketName] = liquidName NAME_TO_BUCKET[liquidName] = bucketName if emptyBucketName then @@ -84,6 +86,10 @@ function logistica.reservoir_register_names(liquidName, bucketName, emptyBucketN end NAME_TO_DESC[liquidName] = liquidDesc NAME_TO_TEXTURE[liquidName] = liquidTexture + if sourceNodeName then + NAME_TO_SOURCE[liquidName] = sourceNodeName + SOURCE_TO_NAME[sourceNodeName] = liquidName + end end -- returns nil if item had no effect
diff --git a/mod.conf b/mod.conf index 0326565..f40dbdf 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name = logistica -optional_depends = default, bucket, i3, mcl_core, mcl_buckets, unified_inventory +optional_depends = default, bucket, i3, mcl_core, mcl_buckets, unified_inventory, mcl_mobitems, animalia, ethereal min_minetest_version = 5.4.0 author = ZenonSeth description = On-demand item transportation diff --git a/registration/machines_api_reg.lua b/registration/machines_api_reg.lua index 25bc6fe..f8bd377 100644 --- a/registration/machines_api_reg.lua +++ b/registration/machines_api_reg.lua @@ -254,9 +254,19 @@ elseif mcl2 then river_water_texture = "mcl_core_water_source_animation.png^[sheet:1x16:0,0^[multiply:#0084FF" end -logistica.register_reservoir("lava", "Lava", itemstrings.lava_bucket, lava_texture, 8) -logistica.register_reservoir("water", "Water", itemstrings.water_bucket, water_texture) -logistica.register_reservoir("river_water", "River Water", itemstrings.river_water_bucket, river_water_texture) +logistica.register_reservoir("lava", "Lava", itemstrings.lava_bucket, lava_texture, itemstrings.lava_source, 8) +logistica.register_reservoir("water", "Water", itemstrings.water_bucket, water_texture, itemstrings.water_source) +logistica.register_reservoir("river_water", "River Water", itemstrings.river_water_bucket, river_water_texture, itemstrings.river_water_source) +-- milk buckets +if minetest.registered_items["mcl_mobitems:milk_bucket"] then + logistica.register_reservoir("milk", "Milk", "mcl_mobitems:milk_bucket", "logistica_milk_liquid.png") +end +if minetest.registered_items["animalia:bucket_milk"] then + logistica.register_reservoir("milk", "Milk", "animalia:bucket_milk", "logistica_milk_liquid.png") +end +if minetest.registered_items["ethereal:bucket_cactus"] then + logistica.register_reservoir("cactus_pulp", "Cactus Pulp", "ethereal:bucket_cactus", "logistica_milk_liquid.png^[colorize:#697600:227") +end -------------------------------- -- Passive Supply Chest diff --git a/textures/logistica_milk_liquid.png b/textures/logistica_milk_liquid.png new file mode 100644 index 0000000..00b5187 Binary files /dev/null and b/textures/logistica_milk_liquid.png differ diff --git a/util/compat_mcl.lua b/util/compat_mcl.lua index 5120d82..0c5c737 100644 --- a/util/compat_mcl.lua +++ b/util/compat_mcl.lua @@ -2,6 +2,12 @@ local mcl = minetest.get_modpath("mcl_core") logistica.sound_mod = mcl and mcl_sounds or default +local function get_mcl_river_water_source() + if minetest.registered_nodes["mcl_core:river_water_source"] then return "mcl_core:river_water_source" + elseif minetest.registered_nodes["mclx_core:river_water_source"] then return "mclx_core:river_water_source" + else return "" end +end + -- Returns a player's inventory formspec with the correct width and hotbar position for the current game function logistica.player_inv_formspec(x,y) local formspec @@ -41,4 +47,7 @@ logistica.itemstrings = { ice = mcl and "mcl_core:ice" or "default:ice", glass = mcl and "mcl_core:glass" or "default:glass", cobble = mcl and "mcl_core:cobble" or "default:cobble", + water_source = mcl and "mcl_core:water_source" or "default:water_source", + river_water_source = mcl and get_mcl_river_water_source() or "default:river_water_source", + lava_source = mcl and "mcl_core:lava_source" or "default:lava_source", }