[Mod] Hoppers

Rate85
New member
 
Posts: 5
Joined: Tue Mar 22, 2016 19:31
In-game: Rate85

Re: [Mod] Hoppers

by Rate85 » Mon May 30, 2016 16:48

I Have Old Version With Coal TYexture, And Same Inventory As A Chest
 

User avatar
wilkgr76
Member
 
Posts: 680
Joined: Wed Feb 18, 2015 02:44
GitHub: wilkgr76
IRC: wilkgr
In-game: wilkgr

Re: [Mod] Hoppers

by wilkgr76 » Mon May 30, 2016 21:29

Rate85 wrote:2: Do I Need To Update To Make It Look Like Steel Blocks?

On lines 21 & 72 change it from:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
tiles = {"default_coal_block.png"},

to
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
tiles = {"default_steel_block.png"},


(Comma is not accidental)
I do not care.
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Re: [Mod] Hoppers

by jordan4ibanez » Fri Jul 15, 2016 03:11

TenPlus1 wrote:Updated to 1.0:

- New node timer furnaces don't work properly so reverted back to abm one's instead

https://github.com/tenplus1/hopper

Merged and updated license to wtfpl
If you can think it, you can make it.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Sat Nov 12, 2016 11:01

Update: Hoppers now have 2x lucky blocks added when mod available.
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Re: [Mod] Hoppers

by jordan4ibanez » Sun Nov 13, 2016 19:09

TenPlus1 wrote:Update: Hoppers now have 2x lucky blocks added when mod available.

Why don't you create a new forum topic and I'll redirect my topic to yours? Your version is way more advanced!
If you can think it, you can make it.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Sun Nov 13, 2016 20:31

You sure ? it was originally your mod, I just helped it along in places :)
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Re: [Mod] Hoppers

by jordan4ibanez » Mon Nov 14, 2016 04:30

TenPlus1 wrote:You sure ? it was originally your mod, I just helped it along in places :)

Well I abandoned this mod long ago so yes! It's now your mod :)
If you can think it, you can make it.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Mon Nov 14, 2016 20:33

You get full credits dude :)
 

LordNevar
Member
 
Posts: 14
Joined: Wed Dec 14, 2016 19:46

Re: [Mod] Hoppers

by LordNevar » Wed Dec 21, 2016 02:07

Hello, I'm not sure this is a "Bug" ,but when you connect the hopper to the side of a furnace the coal dose go in but it dose not activate it. as in it dose not burn
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Wed Dec 21, 2016 09:38

Are you using 0.4.14 stable or the latest dev builds ? I do recall that the latest had some furnace changes made, so will have to look into those.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] Hoppers

by sofar » Wed Dec 21, 2016 15:40

Why isn't this submitted to minetest-mods? then we can all help maintain it.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Wed Dec 21, 2016 20:51

sofar: because I enjoy maintaining my own set of mods (hoppers being a joint project with jordan).

Update: Timer issues fixed, hoppers should work a-ok with furnaces again :)
 

LordNevar
Member
 
Posts: 14
Joined: Wed Dec 14, 2016 19:46

Re: [Mod] Hoppers

by LordNevar » Thu Dec 22, 2016 17:14

cool thanks for the reply im new to this but would enjoy being more apart of this wonderful community
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Sun Jan 22, 2017 23:51

A few weeks back I was working on a mod of my own that included chest- and furnace-like inventory-bearing blocks, and one of my testers suggested that I should make my mod compatible with Hoppers. Unfortunately, when I cracked open the code for Hoppers I found that the source and target node types were hard-coded within it.

So I got started on adding a modding API, and I kiiiind of went a little bit crazy and did a bunch of other tweaks and fixes and stuff in the process. :) Here's a summary of the changes I made:

  • Hoppers now call on_metadata_inventory_put and on_metadata_inventory_take, triggering furnace timers via their standard callbacks. This approach also prevents hoppers from inserting "illegal" items into the furnace's fuel inventory slot.
  • Hoppers record the identity of the player that placed them in their metadata, which should in theory allow them to work correctly with locked chests (they'll only be able to take/place items in locked chests if the player that placed the hopper has the permissions needed to do so). I haven't tried that yet though.
  • Added an API to allow other mods to add new "source" and "target" blocks to hoppers without having to edit this mod's code.
  • Updated side hopper rotation handling to allow it to function in any orientation.
  • Added settings options to use 16-pixel or 32-pixel textures so that the mod can fit in better with whatever other textures the world is using.
  • Added settings option to allow explicit crafting of standard/side hoppers or to allow crafting of a single item that selects which type to use on place. The original version of the mod had the single-crafting-item approach and I liked it, but this way both approaches are supported.
  • Added in-game documentation via optional "doc" mod dependency
  • Updated the screenshot

My fork is here: https://github.com/minetest-mods/hopper (Download).

If you're curious to see how the API works for allowing other mods to add hopper support, here's where I make use of it in my own mod.

tenplus1, want me to send you a pull request? I think I'm about done with this particular coding spree for now.
Last edited by FaceDeer on Tue Feb 07, 2017 00:17, edited 1 time in total.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] Hoppers

by sofar » Mon Jan 23, 2017 03:40

FaceDeer wrote:A few weeks back I was working on a mod of my own that included chest- and furnace-like inventory-bearing blocks, and one of my testers suggested that I should make my mod compatible with Hoppers. Unfortunately, when I cracked open the code for Hoppers I found that the source and target node types were hard-coded within it.

So I got started on adding a modding API, and I kiiiind of went a little bit crazy and did a bunch of other tweaks and fixes and stuff in the process. :) Here's a summary of the changes I made:

  • Hoppers now call on_metadata_inventory_put and on_metadata_inventory_take, triggering furnace timers via their standard callbacks. This approach also prevents hoppers from inserting "illegal" items into the furnace's fuel inventory slot.
  • Hoppers record the identity of the player that placed them in their metadata, which should in theory allow them to work correctly with locked chests (they'll only be able to take/place items in locked chests if the player that placed the hopper has the permissions needed to do so). I haven't tried that yet though.
  • Added an API to allow other mods to add new "source" and "target" blocks to hoppers without having to edit this mod's code.
  • Updated side hopper rotation handling to allow it to function in any orientation.
  • Added settings options to use 16-pixel or 32-pixel textures so that the mod can fit in better with whatever other textures the world is using.
  • Added settings option to allow explicit crafting of standard/side hoppers or to allow crafting of a single item that selects which type to use on place. The original version of the mod had the single-crafting-item approach and I liked it, but this way both approaches are supported.
  • Added in-game documentation via optional "doc" mod dependency
  • Updated the screenshot

My fork is here: https://github.com/FaceDeer/hopper/ (Download).

If you're curious to see how the API works for allowing other mods to add hopper support, here's where I make use of it in my own mod.

tenplus1, want me to send you a pull request? I think I'm about done with this particular coding spree for now.



This is some pretty cool and well-thought out work.

I'd really think this mod is better off maintained on minetest-mods as a *team* and not just in a personal repo. Commits like these are hard to review, and in minetest-mods we have a few core devs and senior minetest folks helping out reviewing changes like these.

So @tenplus1, please consider maintaining this in minetest-mods.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Fri Jan 27, 2017 13:33

It seems that FaceDeer and myself have both been working on our own API's for the Hopper mod :)
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Fri Jan 27, 2017 22:47

TenPlus1 wrote:It seems that FaceDeer and myself have both been working on our own API's for the Hopper mod :)


How far along are you with yours? I'd like to release Digtron fairly soon now, I could substitute your API into my fork to keep it forward-compatible if you've got the interface defined.

How about the other changes I made? I think many of them will be necessary for robustness when other mods are calling on Hoppers to move stuff in and out of their blocks' inventories, they should probably be merged in either way the API goes.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Sat Jan 28, 2017 13:56

Initially there was three different api examples and I've settled for the simplest to implement and fastest to use. It's finished and on my git page listed in this thread.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Sat Jan 28, 2017 19:23

TenPlus1 wrote:Initially there was three different api examples and I've settled for the simplest to implement and fastest to use. It's finished and on my git page listed in this thread.


Nice API, simple is good in these situations and I like how it's all packaged up in one table of values. I've merged it into my fork and updated Digtron to make use of it.

I'll send you a pull request now for the rest of the stuff I did. I note you put in the ability for hoppers to add to locked chests, my code handles player permissions via the standard callbacks so I was able to put in the ability for them to take from locked chests as well - a hopper will only be able to take items from a locked chest if the owner of the chest placed the hopper there, other players' hoppers won't be able to.

I'd like to second sofar's request to put this on minetest-mods, by the way. I'm going to be moving my own mods there shortly (if they'll take them) and it looks like a great way to help keep collaborations like this compatible.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Thu Feb 02, 2017 04:20

I've synched up my fork to your latest changes. Are you going to take my pull request? Please let me know what you think of it.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Hoppers

by TenPlus1 » Thu Feb 02, 2017 09:13

Thanks for your ideas FaceDeer but for now I'm going to keep hoppers simple and fast...

Updated to 1.3:

- Tweaked code to use single abm, performance increase.
- Added intllib support, german language conversion by Xanthin
- Side-hopper inventory items can be crafted back into standard hoppers

Download: https://github.com/tenplus1/hopper/archive/master.zip
 

User avatar
texmex
Member
 
Posts: 226
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Hoppers

by texmex » Wed Feb 22, 2017 18:07

There's a "reverse hopper" item with this mod, I believe it could be useful to possibly merge the concept into the more established hopper mod.
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Fri Feb 24, 2017 03:40

texmex wrote:There's a "reverse hopper" item with this mod, I believe it could be useful to possibly merge the concept into the more established hopper mod.


I've taken a stab at this with the minetest-mods branch of this mod, I added an "eject items"/"don't eject" button to the inventory formspecs that you can use to set a hopper to eject items out into the "real world" if there's no suitable inventory to receive them. Let me know if this is what you were thinking of.
 

User avatar
texmex
Member
 
Posts: 226
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Hoppers

by texmex » Fri Feb 24, 2017 10:14

FaceDeer wrote:
texmex wrote:I've taken a stab at this with the minetest-mods branch of this mod, I added an "eject items"/"don't eject" button to the inventory formspecs that you can use to set a hopper to eject items out into the "real world" if there's no suitable inventory to receive them. Let me know if this is what you were thinking of.

Awesome. No time to test the changes right now but here's what I think.

For me the most intuitive usage flow would be for hoppers to become ejectors whenever they're placed (or screwdrived) upside down, connecting to a chest, furnace, regular hopper or chute. Like so:

Image Image Image
Image Image Image

Image Image Image
I spend all my days going down to the mines. Under the ground where the sun never shines. Breaking my back I put heat in your house. I’ve got the roar of a digtron, the breath of a mouse.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Fri Feb 24, 2017 17:35

texmex wrote:For me the most intuitive usage flow would be for hoppers to become ejectors whenever they're placed (or screwdrived) upside down, connecting to a chest, furnace, regular hopper or chute.


I'm kind of the opposite on that - it seems unintuitive to me to have the direction of item flow through hoppers, and their overall behaviour, change based on its orientation. Right now items always go from wide end to narrow end, making it straightforward to trace the path items will take with a visual glance. They're like big three-dimensional arrowheads.

I'd also like to make it hard to accidentally rig up a hopper to eject items out into the world. Items sitting in the world as entities can easily be lost for good, whereas a hopper that's merely sticking stuff into the wrong inventory will at worst get clogged up and sit there quiescently until a user comes along to clear the jam and correct the problem.

Give the toggle-button version I've implemented a shot, I hope it will satisfy. If only because I dread the complexity of trying to code up the alternative (the toggle button version was quite easy to hook into the existing methods :)
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Hoppers

by Wuzzy » Fri Feb 24, 2017 23:06

I haven't looked at this mod for a while, but for MineClone 2 I use this mod, but heavily modified it for my needs. In MineClone 2, the hoppers already interact with chests, furnaces, shulker boxes, dispensers, other hoppers and droppers, without actually depending on any of these. I have also heavily refactored the code to remove tons of code duplication which was an endless source of bugs (in MineClone 2).

I'm just writing this here because I think it might interest you.

I can give you some insights on what I have done:
I defined a group “container” which is defined like this:

container=<any value>: For nodes with an inventory
container=2: Node with a singe inventory list, called “main”
container=3: Same as above, but does not allow shulker boxes to be stored inside (shulker boxes are a special kind of chest in MineClone 2 / Minecraft)
container=4: For furnaces, it must have 3 inventory lists: src, dst and fuel (like in Minetest Game).

Chests, hoppers, dispensers and droppers (these are all nodes with a simple chest-like inventory) have the group “container=2”.
Shulker boxes are in container=3.
Furnaces are of course in container=4.

Now the hopper basically just looks at the group of the node and not at the node itself. The hopper does not depend on chests, shulker boxes, or furnaces or any particular node for its operation. Because it knows how the nodes behave based on their group and what the names of the inventory lists are, it can act accordingly. It is trivially easy to add hopper support for a custom chest from a mod. Just make sure you only use the inventory list “main”, add container=2 to the groups list, done. Not even a soft dependency is required. :-)

Now this works for MineClone 2 and mods for MineClone 2 but not for the rest because this is not a standard.

I think we, the modders, should REALLY establish some sort of “standard groups”, that is, we agree on a set of useful and clearly-defined groups which are generic enough that they can be used without problems in any mod or subgame. The container group above could be something like that, but this is off-topic now.

I hope you find my insights useful. I'm not suggesting you to do anything, just giving you an explanation on what I've done with your mod so far. :-)
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Fri Feb 24, 2017 23:44

I think it may be both possible and a good idea to support both approaches. Off the top of my head, it seems like it'd be pretty straightforward to add the ability to use the Hopper API to register hopper behaviour for a node group instead of a specific node name. I'm going to be out late tonight but I'll take a look at the code when I get home and see how it goes.

Having different hopper behaviours for different node group *values* might be a bit trickier, but I'll see how that goes. Might be workable.

Maybe once I'm done the mod will be suitable for use by your subgame out-of-the-box. I'll see if I can swing that. I've heavily refactored the code myself with an eye toward making it as efficient and general-purpose as possible, so I'd love the opportunity to test it out "in the field" like that.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] Hoppers

by sofar » Sat Feb 25, 2017 00:45

I'd argue that a callback type implementation may help solve this problem in an easier way than groups. Groups still mean that every node has to determine how to handle the items (reject? move to secondary list? eject?)

A callback would solve this problem - every node could just call the call back of the "other" node and if the return values contain the modified itemstack, everything would be possible without knowing anything about the node or even writing generic code in the first place.

e.g. if the itemstack is returned verbatim, the item is should be put back or ejected, depending on what makes sense for the "giver"
if the itemstack is empty on return, it was accepted. Maybe the other block ejected it
maybe a different item was given back.

direction may be relevant, so a callback should involve a `dir` vector to signal the directionality.

`item_handoff(otherpos, dir, itemstack)` or something like that.

(yes yes I know wuzzy is going to complain about the complexity of this, he generally dislikes interfaces like these, but I think they're better suited than overloading the group bitfields since they allow arbitrary (and yet-to-be-written) code to deal with any situation.)
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Hoppers

by Wuzzy » Sat Feb 25, 2017 02:18

I still think having defined groups for containers is useful in general. There are use cases which go beyond hoppers. Maybe all a mod wants to know if there are chest-like nodes nearby, and just read the inventory contents, not move it. Or for vending machines above chests. It is soooo annoying that you have to depend on 1000 chest mods only to do the same thing for all mods.
I intended these groups mostly for informational purposes. Like “hey! I'm a chest! I have an inventory list called ‘main’.”. How mods deal with this information is their business. Item transfer with hoppers is just one use case.
These groups all have defined underlying assumptions. E.g. “container=2” also means you can freely take and put items into it. So Minetest Game's bones are already excluded.

I don't really understand your callback approach, to be honest. But if you say that every chest-like node now must supply its own callback functions, this is clearly the wrong way. There are many many nodes in Minetest mods which are basically just chest variants which behave like the Minetest Game chest. And the callback code would essentially be the same for all chests.

But maybe I just misunderstood you a bit. Because I am not against callbacks as such. I also have to admit that my hoppers mod does not work solely work on groups. It makes use of an utility mod which I also wrote in order to handle item transfer. But it's not so bad, I think.
At the end of the day, there's still some code needed somewhere. I know from experience that my approach works just fine for my subgame.
Or did you maybe mean new callbacks in the Lua API? That would be interesting, and I would like to read more about it.

But now I can't really comment on your callback approach since I have no real idea on how exactly it is supposed to work, let alone how it works in practice. But thanks for your thoughtwork so far. :-)

EDIT:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Maybe once I'm done the mod will be suitable for use by your subgame out-of-the-box. I'll see if I can swing that. I've heavily refactored the code myself with an eye toward making it as efficient and general-purpose as possible, so I'd love the opportunity to test it out "in the field" like that.

Don't bother trying to tailor your mod directly towards MineClone 2. It would be pointless, MineClone 2 already has working hoppers and you would end up just repeating what I already did. I would be unlikely I include it.
This is just a heads-up for you. Do what you mod what you have to do, but I don't guarantee a re-inclusion into MineClone 2 at all.
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

Re: [Mod] Hoppers

by FaceDeer » Sat Feb 25, 2017 06:51

Wuzzy wrote:I still think having defined groups for containers is useful in general.


Oh, certainly, and I agree. I think our approaches may ultimately be completely compatible, to the benefit of both.

Wuzzy wrote:I don't really understand your callback approach, to be honest.


Much of it's not my callback approach per se, my fork of Hopper is hooking into the existing callbacks that are defined in the basic Minetest lua API.

I'll describe an overview of how my version of Hopper works under the hood, and how I think it might integrate with your approach (bearing in mind that I still haven't actually looked at your subgame's code yet, I just got in the door after my Friday night RPG session. :)

First, Hopper now maintains a table that tells its item-transfer ABM which nodes have what inventories and in what ways they're accessible. That table gets entries added to it via a public API call that the Hopper mod exposes for other mods to use.

As a concrete example, I just yesterday hooked up the "workbench" node from the castle mod to be hopper-compatible. The workbench has two inventories, "src" (where raw materials are placed) and "dst" (where finished products are put after the workbench auto-crafts things from the raw materials in "src"). I wanted hoppers that injected stuff into the top and sides to inject into the "src" inventories and hoppers drawing from the bottom of the workbench to take stuff from the "dst" inventory. So I added this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then
   hopper:add_container({
      {"top", "castle:workbench", "dst"},
      {"side", "castle:workbench", "src"},
      {"bottom", "castle:workbench", "src"},
   })
end


(the extra ~=nil checks are because earlier versions of hopper don't have this API, I don't want to crash if someone's got an old version of hopper installed).

That's all that's necessary on the part of the other mod, hopper handles everything else after that through standard Minetest API calls. The Hopper ABM detects what nodes are adjacent to a hopper and looks up what inventories are being interacted with from the information provided by this call.

Then once the ABM knows what node and inventory name it's interacting with, it uses the allow_metadata_inventory_put and allow_metadata_inventory_take methods defined by that node's node def to determine whether the action it's trying to do is allowed. This method is what furnaces use to disallow any non-fuel items from being put into the fuel slot, for example, and what locked chests use to prevent non-owners from taking items out of it.

If the item transfer is permitted, the hopper goes ahead and does it. Then it calls the respective on_metadata_inventory_put and on_metadata_inventory_take methods from the target node's definition to let the node know that the transfer took place. This is where the furnace checks to see whether it should "ignite" itself when stuff gets dropped into its src and fuel inventories, for example. These methods are also part of the standard Minetest API and are used when the player inserts or takes things from inventories so they can generally be relied upon.

What I'm proposing, based on your description of what you want out of group-based hopper actions, would be something like this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then
   hopper:add_container({
      {"top", "group:container", "main"},
      {"side", "group:container", "main"},
      {"bottom", "group:container", "main"},
   })
end


which would then cause hopper to treat all nodes belonging to group "container" as having a "main" inventory to insert into and draw from. Or use "{"top", "group:container=2", "main"}" to be specific as to the group value to treat like that.

You'd only need to put that hopper:add_container call into a subgame once, and then any node that belongs to those groups would be handled by hoppers without having to declare a dependency.

Wuzzy wrote:EDIT:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Maybe once I'm done the mod will be suitable for use by your subgame out-of-the-box. I'll see if I can swing that. I've heavily refactored the code myself with an eye toward making it as efficient and general-purpose as possible, so I'd love the opportunity to test it out "in the field" like that.

Don't bother trying to tailor your mod directly towards MineClone 2. It would be pointless, MineClone 2 already has working hoppers and you would end up just repeating what I already did. I would be unlikely I include it.
This is just a heads-up for you. Do what you mod what you have to do, but I don't guarantee a re-inclusion into MineClone 2 at all.


if I do this right then I won't have to tailor hopper directly towards MineClone 2. :)

Edit: I couldn't sleep, so I've gone ahead and made the changes described above to the minetest-mods fork of hopper. While I was in there I also made the "default" mod dependency into an optional dependency, though without the default mod hopper no longer defines its own crafting recipes. Also the formspecs might be a little bland without the default background image. I can add something to the API for inserting stuff into the formspec if you like.
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 16 guests

cron