Hopper compatibility and iron furnace fix #11

Merged
mrkubax10 merged 4 commits from HandfulOfFrogs/industrialtest:master into master 2024-05-10 21:38:37 +02:00
2 changed files with 33 additions and 2 deletions

View File

@ -357,9 +357,29 @@ function industrialtest.internal.registerMachine(config)
if config.sounds=="metal" then
definition.sounds=mcl_sounds.node_sound_metal_defaults()
end
definition.groups={pickaxey=1}
definition.groups={
pickaxey=1,
container=2
}
definition._mcl_blast_resistance=3.5
definition._mcl_hardness=3.9
definition._mcl_hoppers_on_try_pull=function(pos, hop_pos, hop_inv, hop_list)
mrkubax10 marked this conversation as resolved Outdated

Problem with this code is that not every machine has dst or src slots. For example Canning Machine has target slot instead of dst.

Problem with this code is that not every machine has `dst` or `src` slots. For example Canning Machine has `target` slot instead of `dst`.

I see, maybe this can be moved into registerSimpleElectricItemProcessor specifically?

I see, maybe this can be moved into `registerSimpleElectricItemProcessor` specifically?

Or, rather, have canning machine use dst slot too

Or, rather, have canning machine use dst slot too

Yeah this seems like a better solution though fact that src and dst are "special" should be documented somehow.

Yeah this seems like a better solution though fact that `src` and `dst` are "special" should be documented somehow.

Alright I renamed inventory list names to src and dst where it was making sense in 2669b7bc27.

Alright I renamed inventory list names to `src` and `dst` where it was making sense in 2669b7bc27.

Oh, great!

Oh, great!
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack("dst", 1)
if not stack:is_empty() and hop_inv:room_for_item(hop_list, stack) then
return inv, "dst", 1
end
return nil, nil, nil
end
definition._mcl_hoppers_on_try_push=function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src")
end
definition._mcl_hoppers_on_after_push=function(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
mrkubax10 marked this conversation as resolved Outdated

Use industrialtest.updateDelay instead of hardcoding 1.0.

Use `industrialtest.updateDelay` instead of hardcoding `1.0`.
end
end
definition.groups._industrialtest_wrenchUnmountable=1
if config.requiresWrench then

View File

@ -293,12 +293,21 @@ if industrialtest.mtgAvailable then
return not (inv:get_list("src")[1]:get_count()>0 or inv:get_list("fuel")[1]:get_count()>0 or inv:get_list("dst")[1]:get_count()>0)
end
elseif industrialtest.mclAvailable then
definition.groups={
pickaxey=1,
container=2
}
definition.after_dig_node=function(pos,oldnode,oldmeta)
industrialtest.internal.mclAfterDigNode(pos,oldmeta,{"src","fuel","dst"})
end
definition.sounds=mcl_sounds.node_sound_metal_defaults()
definition._mcl_blast_resistance=3
definition._mcl_hardness=3.5
definition._mcl_hoppers_on_try_pull = mcl_furnaces.hoppers_on_try_pull
definition._mcl_hoppers_on_try_push = mcl_furnaces.hoppers_on_try_push
definition._mcl_hoppers_on_after_push = function(pos)
mrkubax10 marked this conversation as resolved Outdated

Same as above.

Same as above.
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
end
minetest.register_node("industrialtest:iron_furnace",definition)
definition=table.copy(definition)
@ -317,7 +326,9 @@ definition.drop="industrialtest:iron_furnace"
definition.on_timer=ironFurnace.activeOnTimer
if industrialtest.mclAvailable then
definition.groups={
not_in_creative_inventory=1
not_in_creative_inventory=1,
pickaxey=1,
container=2
}
definition._doc_items_create_entry=false
end