From c41722bf9cb8c254800591bda34556475445d10a Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Thu, 11 Jun 2020 12:24:08 +0200 Subject: [PATCH] add mesecons interface for the quarry --- manual.md | 13 +++---------- technic/machines/HV/quarry.lua | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manual.md b/manual.md index 071cc6a..c63741e 100644 --- a/manual.md +++ b/manual.md @@ -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, a locked chest, or a protected area, it will skip past that and attempt -to continue digging. However, anything remaining in the quarry area -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. +to continue digging. 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 @@ -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 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 ### The forcefield emitter is an HV powered machine that generates a diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 0b28ffd..d410480 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -17,7 +17,7 @@ local quarry_formspec = "listring[current_player;main]".. "label[0,0;"..machine_name.."]".. "button[5,1.9;2,1;restart;"..S("Restart").."]" - + -- hard-coded spiral dig pattern for up to 17x17 dig area 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, @@ -290,7 +290,21 @@ minetest.register_node("technic:quarry", { end, 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() - 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({