| | |
| | | |
| | | local S = technic.getter |
| | | |
| | | minetest.register_craft({ |
| | | recipe = { |
| | | {"default:steelblock", "pipeworks:filter", "default:steelblock"}, |
| | | {"default:steelblock", "technic:motor", "default:steelblock"}, |
| | | {"default:steelblock", "technic:diamond_drill_head", "default:steelblock"}}, |
| | | {"technic:carbon_steel_block", "pipeworks:filter", "technic:carbon_steel_block"}, |
| | | {"technic:carbon_steel_block", "technic:motor", "technic:carbon_steel_block"}, |
| | | {"technic:carbon_steel_block", "technic:diamond_drill_head", "technic:carbon_steel_block"}}, |
| | | output = "technic:quarry", |
| | | }) |
| | | |
| | |
| | | local function get_quarry_formspec(size) |
| | | return "size[3,1.5]".. |
| | | "field[1,0.5;2,1;size;Radius;"..size.."]".. |
| | | "button[0,1;3,1;toggle;Enable/Disable]" |
| | | "button[0,1;3,1;toggle;"..S("Enable/Disable").."]" |
| | | end |
| | | |
| | | local function quarry_receive_fields(pos, formname, fields, sender) |
| | | local meta = minetest.get_meta(pos) |
| | | local size = tonumber(fields.size) |
| | | local size = tonumber(fields.size) or 0 |
| | | |
| | | if fields.toggle then |
| | | if meta:get_int("enabled") == 0 then |
| | |
| | | end |
| | | end |
| | | |
| | | -- Smallest size is 2. Anything less is asking for trouble. |
| | | -- Largest is 8. It is a matter of pratical node handling. |
| | | -- Smallest size is 2. Largest is 8. |
| | | size = math.max(size, 2) |
| | | size = math.min(size, 8) |
| | | |
| | |
| | | local meta = minetest.get_meta(pos) |
| | | local drops = {} |
| | | local dig_y = meta:get_int("dig_y") |
| | | local owner = meta:get_int("owner") |
| | | local owner = meta:get_string("owner") |
| | | |
| | | local vm = VoxelManip() |
| | | local p1 = vector.new( |
| | |
| | | end |
| | | if minetest.is_protected and minetest.is_protected(digpos, owner) then |
| | | meta:set_int("enabled", 0) |
| | | return |
| | | return {} |
| | | end |
| | | dig_y = digpos.y |
| | | local node = minetest.get_node(digpos) |
| | |
| | | |
| | | local function send_items(items, pos, node) |
| | | for _, item in pairs(items) do |
| | | local tube_item = tube_item(vector.new(pos), item) |
| | | local tube_item = pipeworks.tube_item(vector.new(pos), item) |
| | | tube_item:get_luaentity().start_pos = vector.new(pos) |
| | | tube_item:setvelocity(vector.new(0, 1, 0)) |
| | | tube_item:setacceleration({x=0, y=0, z=0}) |
| | |
| | | end |
| | | |
| | | minetest.register_node("technic:quarry", { |
| | | description = "Quarry", |
| | | tiles = {"default_steel_block.png", "default_steel_block.png", |
| | | "default_steel_block.png", "default_steel_block.png", |
| | | "default_steel_block.png^default_tool_mesepick.png", "default_steel_block.png"}, |
| | | description = S("Quarry"), |
| | | tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", |
| | | "technic_carbon_steel_block.png", "technic_carbon_steel_block.png", |
| | | "technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"}, |
| | | paramtype2 = "facedir", |
| | | groups = {cracky=2, tubedevice=1}, |
| | | tube = { |
| | |
| | | on_construct = function(pos) |
| | | local size = 4 |
| | | local meta = minetest.get_meta(pos) |
| | | meta:set_string("infotext", "Quarry") |
| | | meta:set_string("infotext", S("Quarry")) |
| | | meta:set_string("formspec", get_quarry_formspec(4)) |
| | | meta:set_int("size", size) |
| | | meta:set_int("dig_y", pos.y) |
| | |
| | | after_place_node = function(pos, placer, itemstack) |
| | | local meta = minetest.get_meta(pos) |
| | | meta:set_string("owner", placer:get_player_name()) |
| | | tube_scanforobjects(pos) |
| | | pipeworks.scan_for_tube_objects(pos) |
| | | end, |
| | | after_dig_node = tube_scanforobjects, |
| | | after_dig_node = pipeworks.scan_for_tube_objects, |
| | | on_receive_fields = quarry_receive_fields, |
| | | }) |
| | | |
| | |
| | | local demand = 10000 |
| | | local center = get_quarry_center(pos, size) |
| | | local dig_y = meta:get_int("dig_y") |
| | | local machine_name = S("Quarry") |
| | | |
| | | technic.switching_station_timeout_count(pos, "HV") |
| | | |
| | | if meta:get_int("enabled") == 0 then |
| | | meta:set_string("infotext", "Quarry Disabled") |
| | | meta:set_string("infotext", S("%s Disabled"):format(machine_name)) |
| | | meta:set_int("HV_EU_demand", 0) |
| | | return |
| | | end |
| | | |
| | | if eu_input < demand then |
| | | meta:set_string("infotext", "Quarry Unpowered") |
| | | meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |
| | | elseif eu_input >= demand then |
| | | meta:set_string("infotext", "Quarry Active") |
| | | meta:set_string("infotext", S("%s Active"):format(machine_name)) |
| | | |
| | | local items = quarry_dig(pos, center, size) |
| | | send_items(items, pos, node) |
| | | |
| | | if dig_y < pos.y - quarry_max_depth then |
| | | meta:set_string("infotext", "Quarry Finished") |
| | | meta:set_string("infotext", S("%s Finished"):format(machine_name)) |
| | | end |
| | | end |
| | | meta:set_int("HV_EU_demand", demand) |