avatar
scuti
thinks it as a feature not a bug
https://scuti.neocities.org/

Minetest: Digilines Ice & Drink Machine

Last Updated: 2024 September 17 (2024 Aug 18)

Beyond working as intended, this machine happens to create infinite buckets. Which would be an interesting bug report if I was inclined to file one.

In Minetest, some crafting recipes involve a bucket of water. Buckets of water are non-stackable, meaning each item will always occupy a single slot in the inventory. Because of this, any recipe involving a bucket of water can not be performed in bulk. (The player will have to remove the empty bucket from the crafting grid.)

To save the trouble, I built a machine for crafting any recipe with water buckets. Beyond the usual pipeworks:, digilines:, and so on, this machine uses an item from cottages:.

There are two parts to the machine.

The Crafter

This machine currently relies on permissions to load ice into the alloy furnace.

This consists of:

What this machine does is:

  1. (Alloy furnace) Melts ice into buckets of water.
  2. Send buckets of water to the autocrafter.
  3. (Touchscreen) Receive user input: which item and how many to craft.
  4. Send created items to the output chest.

Source Code (luacontroller)

A large portion of the source code involves loading recipes onto the autocrafter and drawing the interface on the touchscreen. It can be read at:

https://notabug.org/scuti/minetest-machines/src/master/watercrafts.lua

The Ice Maker

Also the infinite bucket maker. (This machine can be used by anyone, but needs someone with permissions to load empty glass cups into the autocrafter.)

The crafting portion of the machine relies on ice and an empty bucket to create buckets of water. The reason is that both ice and empty buckets can be stacked (thus conveniently stored.)

This portion consists of:

What happens is:

  1. the node breaker hits the tree trunk well with a bucket.
  2. the well fills the bucket with river water (bucket:bucket_river_water is different from bucket:bucket_water)
  3. if the lever is flipped upwards,
    • then the lua-controlled tube sends the bucket of river water to the autocrafter to create glass of water.
    • else, the lua-controlled tube sends the bucket of river water to the freezer to create ice.

As a result, the server I play on has an insane number of buckets in circulation.

The Source Code (lua-controlled tube)

The code loaded in the lua-controlled tube is trivial and operates on the state of the lever.

    local function main()
        local glass = "green";
        local ice = "blue"; 
        if pin.red == true then
            return glass
        end
        return ice
    end
    return main()

Where you can play with it

The ice and drink machine is in Subterra Lobby to the left of the point of arrival, beyond a stone ladder. You can find the teleporter to it at juneland.fr:30000 (-961, 12.5, 1911). There is also another machine (Digilines Vending Machine) in the vicinity at Subterra Market.

Have fun!

Thanks for reading! Who doesn't love comments? Let me know what you think on my guestbook by e-mail or neocities.