add mesecons interface for the quarry

This commit is contained in:
BuckarooBanzay 2020-06-11 12:24:08 +02:00
parent 529d09d98e
commit c41722bf9c
2 changed files with 19 additions and 12 deletions

View File

@ -1125,16 +1125,7 @@ capture the output without sorting, but is liable to overflow.
If the quarry encounters something that cannot be dug, such as a liquid, If the quarry encounters something that cannot be dug, such as a liquid,
a locked chest, or a protected area, it will skip past that and attempt a locked chest, or a protected area, it will skip past that and attempt
to continue digging. However, anything remaining in the quarry area to continue digging.
after the machine has attempted to dig there will prevent the machine
from digging anything directly below it, all the way to the bottom
of the quarry. An undiggable block therefore casts a shadow of undug
blocks below it. If liquid is encountered, it is quite likely to flow
across the entire cross section of the quarry, preventing all digging.
The depth at which the quarry is currently attempting to dig is reported
in its interaction form, and can be manually reset to the top of the
quarry, which is useful to do if an undiggable obstruction has been
manually removed.
The quarry consumes 10 kEU per block dug, which is quite a lot of energy. The quarry consumes 10 kEU per block dug, which is quite a lot of energy.
With most of what is dug being mere stone, it is usually not economically With most of what is dug being mere stone, it is usually not economically
@ -1151,6 +1142,8 @@ world anchor is used the digging can be speeded up by placing multiple
quarry machines with overlapping digging areas. Four can be placed to quarry machines with overlapping digging areas. Four can be placed to
dig identical areas, one on each side of the square cross section. dig identical areas, one on each side of the square cross section.
The quarry can be toggled on and off with a mesecons signal.
### forcefield emitter ### ### forcefield emitter ###
The forcefield emitter is an HV powered machine that generates a The forcefield emitter is an HV powered machine that generates a

View File

@ -17,7 +17,7 @@ local quarry_formspec =
"listring[current_player;main]".. "listring[current_player;main]"..
"label[0,0;"..machine_name.."]".. "label[0,0;"..machine_name.."]"..
"button[5,1.9;2,1;restart;"..S("Restart").."]" "button[5,1.9;2,1;restart;"..S("Restart").."]"
-- hard-coded spiral dig pattern for up to 17x17 dig area -- hard-coded spiral dig pattern for up to 17x17 dig area
local quarry_dig_pattern = { local quarry_dig_pattern = {
0,1,2,2,3,3,0,0,0,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,1,1,1,1,1,2,2, 0,1,2,2,3,3,0,0,0,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,1,1,1,1,1,2,2,
@ -290,7 +290,21 @@ minetest.register_node("technic:quarry", {
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
return minetest.is_protected(pos, player:get_player_name()) and 0 or stack:get_count() return minetest.is_protected(pos, player:get_player_name()) and 0 or stack:get_count()
end end,
mesecons = {
effector = {
action_on = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("enabled", 1)
set_quarry_status(pos)
end,
action_off = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("enabled", 0)
set_quarry_status(pos)
end
}
}
}) })
minetest.register_craft({ minetest.register_craft({