Simple workbench

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Simple workbench

by MirceaKitsune » Sat Jun 14, 2014 20:40

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
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Simple workbench

by Casimir » Sat Jun 14, 2014 22:25

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?
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Simple workbench

by MirceaKitsune » Sun Jun 15, 2014 01:19

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.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Simple workbench

by MirceaKitsune » Sun Jun 15, 2014 14:43

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.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Simple workbench

by Calinou » Sun Jun 15, 2014 20:02

The texture looks too saturated to me.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron