Page 1 of 1

Simple workbench

PostPosted: Sat Jun 14, 2014 20:40
by MirceaKitsune
Some time ago, I made my own 3x3 workbench and issued a pull request. Since it was rejected due to minetest_game being frozen and no longer accepting new features, I converted it to a mod today.

This simply adds the classic 3x3 workbench (crafted out of 4 wood blocks) while forcing a 2x2 crafting grid in the inventory window (non-creative only). Textures and code by me and licensed PD / WTFPL / whatever.

The nice part about this workbench is that it only modifies the player's own crafting area and inventory formspec, rather than using node inventories. This allows local prediction to work for crafting, whereas using meta inventory is horribly laggy. It also guarantees that other players can't steal your materials while you're crafting, since they never leave your inventory.

Short description of how it works: When you right-click the workbench, your craft grid is resized and your inventory formspec updated and shown. However, your existing inventory formspec is first persisted. When you close the workbench, your previous inventory settings are restored. This allows the workbench to be compatible with mods that set their own inventory formspec, unless they change it during the moment you use a workbench of course.

https://github.com/MirceaKitsune/minete ... _workbench

Image

Re: Simple workbench

PostPosted: Sat Jun 14, 2014 22:25
by Casimir
Nice mod. I especially like the textures. One bug: when exiting the workbench and keeping items in there the items are gone.

This allows local prediction to work for crafting, whereas using meta inventory is horribly laggy.

Couldn't you do the same for chests? By only sending/loading the inventory when the chest is closed/opened?

Re: Simple workbench

PostPosted: Sun Jun 15, 2014 01:19
by MirceaKitsune
Casimir wrote:Nice mod. I especially like the textures. One bug: when exiting the workbench and keeping items in there the items are gone.

Couldn't you do the same for chests? By only sending/loading the inventory when the chest is closed/opened?


It's likely the item movement formula, triggered when you leave stuff in the craft area and it gets resized, in which case the items are sent back to main inventory. I remember all bugs with it were fixed however. Someone wrote that formula for me since I couldn't understand it, and maybe someone else can tell what might be wrong? If anyone wishes to try, take a look at it over here.

And no, for chests it isn't possible. You actually store items in chests and furnaces, so unlike the workbench you need to use meta inventory. Even if some hack to use local player fields was possible, it would be much uglier here. Minetest needs to fix this by adding prediction to node inventories, as I brought up in another thread.

Re: Simple workbench

PostPosted: Sun Jun 15, 2014 14:43
by MirceaKitsune
In case anyone's interested and this information is helpful: I've tested this mod with Inventory++, and apparently there are no conflicts. Including the option to modify the default formspec in on_joinplayer and set a 2x2 crafting grid. Intenrory++ notices the custom formspec accordingly and adds buttons to the window, whereas using the workbench doesn't conflict with the I++ menus and features either.

Re: Simple workbench

PostPosted: Sun Jun 15, 2014 20:02
by Calinou
The texture looks too saturated to me.