get atvomat ready to be programmed
BIN
blends/BlockBreaker.blend
Normal file
BIN
blends/BlockBreaker.blend1
Normal file
1
mods/atvomat/autoblockbreaker/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
78
mods/atvomat/autoblockbreaker/init.lua
Normal file
@ -0,0 +1,78 @@
|
||||
-- AutoBlockBreaker mod by sfan5
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'autoblockbreaker:breaker',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:wood', 'default:cobble'},
|
||||
{'default:cobble', 'default:cobble', "default:pick_stone"},
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
},
|
||||
})
|
||||
|
||||
local autoblockbreaker_texture = "default_cobble.png^(default_wood.png^[mask:autoblockbreaker_mask.png)"
|
||||
|
||||
minetest.register_node("autoblockbreaker:breaker", {
|
||||
tiles = {autoblockbreaker_texture .. "^autoblockbreaker_off.png", "default_cobble.png", "default_cobble.png",
|
||||
"default_cobble.png", "default_cobble.png", "default_cobble.png^autoblockbreaker_drill.png"},
|
||||
paramtype2 = "facedir",
|
||||
description = "Auto Block Breaker",
|
||||
groups = {cracky=2},
|
||||
on_construct = function(pos)
|
||||
minetest.get_meta(pos):set_string("infotext", "Auto Block Breaker (disabled)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "autoblockbreaker:breaker_on"
|
||||
minetest.set_node(pos, node)
|
||||
minetest.get_meta(pos):set_string("infotext", "Auto Block Breaker (enabled)")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("autoblockbreaker:breaker_on", {
|
||||
tiles = {
|
||||
autoblockbreaker_texture .. "^autoblockbreaker_on.png", "default_cobble.png", "default_cobble.png",
|
||||
"default_cobble.png", "default_cobble.png",
|
||||
{
|
||||
image = "[combine:16x32:0,0=default_cobble.png:0,16=default_cobble.png^autoblockbreaker_drill_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1
|
||||
},
|
||||
},
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "autoblockbreaker:breaker"
|
||||
minetest.set_node(pos, node)
|
||||
minetest.get_meta(pos):set_string("infotext", "Auto Block Breaker (disabled)")
|
||||
end,
|
||||
drop = "autoblockbreaker:breaker",
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"autoblockbreaker:breaker_on"},
|
||||
interval = 1.25,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local p = pos
|
||||
local p2 = minetest.facedir_to_dir(node.param2)
|
||||
p = {x=p.x - p2.x, y=p.y, z=p.z - p2.z}
|
||||
p2 = nil
|
||||
local n = minetest.get_node(p)
|
||||
if n.name == "air" or n.name == "ignore" then return end
|
||||
minetest.remove_node(p)
|
||||
nodeupdate(p)
|
||||
local drops = minetest.get_node_drops(n.name, "default:pick_stone")
|
||||
local haschest = (minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:chest")
|
||||
for _, drop in ipairs(drops) do
|
||||
if haschest then
|
||||
minetest.get_meta({x=pos.x, y=pos.y-1, z=pos.z}):get_inventory():add_item("main", drop)
|
||||
else
|
||||
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, drop)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 231 B |
BIN
mods/atvomat/autoblockbreaker/textures/autoblockbreaker_mask.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
mods/atvomat/autoblockbreaker/textures/autoblockbreaker_off.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
mods/atvomat/autoblockbreaker/textures/autoblockbreaker_on.png
Normal file
After Width: | Height: | Size: 129 B |
3
mods/atvomat/breaker.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/compressor.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/crusher.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
1
mods/atvomat/crushingfurnace/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
295
mods/atvomat/crushingfurnace/init.lua
Normal file
@ -0,0 +1,295 @@
|
||||
--CrushingFurnace mod by sfan5
|
||||
--v1.0
|
||||
|
||||
|
||||
local function get_furnace_active_formspec(pos, percent)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;crushingfurnace_crush_bg.png^[lowpart:"..
|
||||
(100-percent)..":crushingfurnace_crush_fg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
local furnace_inactive_formspec =
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;crushingfurnace_crush_bg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
local crushingfurnace_receipes = {
|
||||
--input output time
|
||||
{"default:cobble", "default:gravel", 8},
|
||||
{"default:gravel", "default:sand", 5},
|
||||
{"default:coalblock", "default:diamond", 35},
|
||||
{"default:stone", "default:iron_lump", 12},
|
||||
}
|
||||
|
||||
function crushingfurnace_get_craft_result(input)
|
||||
if input.method ~= "cooking" then return nil end
|
||||
if input.width ~= 1 then return nil end
|
||||
for _, e in ipairs(crushingfurnace_receipes) do
|
||||
if e[1] == input.items[1]:get_name() then
|
||||
local outstack = input.items[1]
|
||||
outstack:take_item()
|
||||
return {item = ItemStack(e[2]), time=e[3]}, {items = {outstack}}
|
||||
end
|
||||
end
|
||||
return {item = ItemStack(""), time=0}, {items = ItemStack("")}
|
||||
end
|
||||
|
||||
minetest.register_node("crushingfurnace:furnace", {
|
||||
description = "Crushing Furnace",
|
||||
tiles = {"crushingfurnace_top.png", "crushingfurnace_bottom.png", "crushingfurnace_side.png",
|
||||
"crushingfurnace_side.png", "crushingfurnace_side.png", "crushingfurnace_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", furnace_inactive_formspec)
|
||||
meta:set_string("infotext", "Crushing Furnace")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
elseif not inv:is_empty("dst") then
|
||||
return false
|
||||
elseif not inv:is_empty("src") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
if inv:is_empty("src") then
|
||||
meta:set_string("infotext","Crushing Furnace is empty")
|
||||
end
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
if inv:is_empty("src") then
|
||||
meta:set_string("infotext","Crushing Furnace is empty")
|
||||
end
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif to_list == "src" then
|
||||
return count
|
||||
elseif to_list == "dst" then
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("crushingfurnace:furnace_active", {
|
||||
tiles = {"crushingfurnace_top.png", "crushingfurnace_bottom.png", "crushingfurnace_side.png",
|
||||
"crushingfurnace_side.png", "crushingfurnace_side.png", "crushingfurnace_front_active.png"},
|
||||
paramtype2 = "facedir",
|
||||
light_source = 8,
|
||||
drop = "crushingfurnace:furnace",
|
||||
groups = {cracky=2, not_in_creative_inventory=1,hot=1},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", furnace_inactive_formspec)
|
||||
meta:set_string("infotext", "Crushing Furnace");
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
elseif not inv:is_empty("dst") then
|
||||
return false
|
||||
elseif not inv:is_empty("src") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
if inv:is_empty("src") then
|
||||
meta:set_string("infotext","Crushing Furnace is empty")
|
||||
end
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
if inv:is_empty("src") then
|
||||
meta:set_string("infotext","Crushing Furnace is empty")
|
||||
end
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif to_list == "src" then
|
||||
return count
|
||||
elseif to_list == "dst" then
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function hacky_swap_node(pos,name)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
local meta0 = meta:to_table()
|
||||
node.name = name
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"crushingfurnace:furnace","crushingfurnace:furnace_active"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
for i, name in ipairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
"src_totaltime",
|
||||
"src_time"
|
||||
}) do
|
||||
if meta:get_string(name) == "" then
|
||||
meta:set_float(name, 0.0)
|
||||
end
|
||||
end
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
local aftercooked
|
||||
|
||||
if srclist then
|
||||
cooked, aftercooked = crushingfurnace_get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
local was_active = false
|
||||
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
|
||||
meta:set_float("src_time", meta:get_float("src_time") + 1)
|
||||
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
|
||||
-- check if there's room for output in "dst" list
|
||||
if inv:room_for_item("dst",cooked.item) then
|
||||
-- Put result in "dst" list
|
||||
inv:add_item("dst", cooked.item)
|
||||
-- take stuff from "src" list
|
||||
inv:set_stack("src", 1, aftercooked.items[1])
|
||||
else
|
||||
print("Could not insert '"..cooked.item:to_string().."'")
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Crushing Furnace active: "..percent.."%")
|
||||
hacky_swap_node(pos,"crushingfurnace:furnace_active")
|
||||
meta:set_string("formspec", get_furnace_active_formspec(pos, percent))
|
||||
return
|
||||
end
|
||||
|
||||
local fuel = nil
|
||||
local afterfuel
|
||||
local cooked = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
|
||||
if srclist then
|
||||
cooked = crushingfurnace_get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
if fuellist then
|
||||
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
end
|
||||
|
||||
if fuel.time <= 0 then
|
||||
meta:set_string("infotext", "Crushing Furnace out of fuel")
|
||||
hacky_swap_node(pos, "crushingfurnace:furnace")
|
||||
meta:set_string("formspec", furnace_inactive_formspec)
|
||||
return
|
||||
end
|
||||
|
||||
if cooked.item:is_empty() then
|
||||
if was_active then
|
||||
meta:set_string("infotext", "Crushing Furnace is empty")
|
||||
hacky_swap_node(pos, "crushingfurnace:furnace")
|
||||
meta:set_string("formspec", furnace_inactive_formspec)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
meta:set_string("fuel_totaltime", fuel.time)
|
||||
meta:set_string("fuel_time", 0)
|
||||
|
||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'crushingfurnace:furnace',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:shovel_stone', 'default:cobble'},
|
||||
{'default:cobble', '', 'default:cobble'},
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
}
|
||||
})
|
BIN
mods/atvomat/crushingfurnace/textures/crushingfurnace_bottom.png
Normal file
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 380 B |
BIN
mods/atvomat/crushingfurnace/textures/crushingfurnace_front.png
Normal file
After Width: | Height: | Size: 610 B |
After Width: | Height: | Size: 882 B |
BIN
mods/atvomat/crushingfurnace/textures/crushingfurnace_side.png
Normal file
After Width: | Height: | Size: 769 B |
BIN
mods/atvomat/crushingfurnace/textures/crushingfurnace_top.png
Normal file
After Width: | Height: | Size: 769 B |
138
mods/atvomat/init.lua
Normal file
@ -0,0 +1,138 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
||||
atvomat = {} -- i like global namespaces for people who like making silly dependancies
|
||||
|
||||
dofile(minetest.get_modpath("atvomat").."/breaker.lua") -- automated block breaker
|
||||
dofile(minetest.get_modpath("atvomat").."/compressor.lua") -- compresses ingots/gems into block form
|
||||
dofile(minetest.get_modpath("atvomat").."/crusher.lua") -- crushes ore blocks, and other blocks
|
||||
dofile(minetest.get_modpath("atvomat").."/logger.lua") -- automatically kills and plants trees
|
||||
dofile(minetest.get_modpath("atvomat").."/mover.lua") -- takes and inserts items into containers
|
||||
dofile(minetest.get_modpath("atvomat").."/scrapper.lua") -- destroys items every now and then
|
||||
dofile(minetest.get_modpath("atvomat").."/sorter.lua") -- sorts items all the time, everytime
|
||||
dofile(minetest.get_modpath("atvomat").."/switchsort.lua") -- sends items elsewhere if it cant put items into the container
|
||||
dofile(minetest.get_modpath("atvomat").."/tools.lua") -- engineers tools.
|
||||
|
||||
-- crafting recipes here, meatbag
|
||||
|
||||
atvomat.compressor_recipes = {}
|
||||
|
||||
atvomat.crusher_recipes = {}
|
||||
|
||||
atvomat.logger_control = {}
|
||||
|
||||
atvomat.ingot_sort = {}
|
||||
|
||||
atvomat.ingot_block_sort = {}
|
||||
|
||||
atvomat.ore_sort = {}
|
||||
|
||||
atvomat.dye_sort = {}
|
||||
|
||||
-- items that can be compressed, format is input, amount -> output, amount
|
||||
|
||||
atvomat.compressor_recipes["iron"] = {"core:iron_ingot", 9, "core:iron_block", 1}
|
||||
atvomat.compressor_recipes["copper"] = {"core:copper_ingot", 9, "core:copper_block", 1}
|
||||
atvomat.compressor_recipes["ironze"] = {"core:ironze_ingot", 9, "core:ironze_block", 1}
|
||||
atvomat.compressor_recipes["gold"] = {"core:gold_ingot", 9, "core:gold_block", 1}
|
||||
atvomat.compressor_recipes["silver"] = {"core:silver_ingot", 9, "core:silver_block", 1}
|
||||
atvomat.compressor_recipes["mese"] = {"core:mese_crystal", 9, "core:mese", 1}
|
||||
atvomat.compressor_recipes["diamond"] = {"core:diamond", 9, "core:diamond_block", 1}
|
||||
|
||||
-- crusher recipes, input, amount -> output, amount
|
||||
|
||||
atvomat.crusher_recipes["cobble"] = {"core:stone", 1, "core:cobble", 1}
|
||||
atvomat.crusher_recipes["gravel"] = {"core:cobble", 1, "core:gravel", 1}
|
||||
atvomat.crusher_recipes["sand"] = {"core:gravel", 1, "core:sand", 1}
|
||||
atvomat.crusher_recipes["clay"] = {"core:dirt", 1, "core:clay", 1}
|
||||
|
||||
--atvomat.crusher_recipes["brick"] = {"core:bricks", 1, "core:brick", 4}
|
||||
|
||||
atvomat.crusher_recipes["iron"] = {"core:iron_ore", 1, "core:iron_dust", 4}
|
||||
atvomat.crusher_recipes["copper"] = {"core:copper_ore", 1, "core:copper_dust", 4}
|
||||
atvomat.crusher_recipes["gold"] = {"core:gold_ore", 1, "core:gold_dust", 4}
|
||||
atvomat.crusher_recipes["silver"] = {"core:silver_ore", 1, "core:silver_dust", 4}
|
||||
atvomat.crusher_recipes["mese"] = {"core:mese_ore", 1, "core:mese_crystal", 4}
|
||||
atvomat.crusher_recipes["diamond"] = {"core:diamond_ore", 1, "core:diamond", 4}
|
||||
|
||||
-- dyes (15 colours currently)
|
||||
atvomat.crusher_recipes["reddye"] = {"", 1, "dye:red", 4}
|
||||
atvomat.crusher_recipes["orangedye"] = {"", 1, "dye:orange", 4}
|
||||
atvomat.crusher_recipes["yellowdye"] = {"", 1, "dye:yellow", 4}
|
||||
atvomat.crusher_recipes["limedye"] = {"", 1, "dye:lime", 4}
|
||||
atvomat.crusher_recipes["greendye"] = {"", 1, "dye:green", 4}
|
||||
atvomat.crusher_recipes["darkgreendye"] = {"", 1, "dye:dark_green", 4}
|
||||
atvomat.crusher_recipes["cyandye"] = {"", 1, "dye:cyan", 4}
|
||||
atvomat.crusher_recipes["bluedye"] = {"", 1, "dye:blue", 4}
|
||||
atvomat.crusher_recipes["magenta"] = {"", 1, "dye:magenta", 4}
|
||||
atvomat.crusher_recipes["purple"] = {"", 1, "dye:purple", 4}
|
||||
atvomat.crusher_recipes["violet"] = {"", 1, "dye:violet", 4}
|
||||
atvomat.crusher_recipes["white"] = {"", 1, "dye:white", 4}
|
||||
atvomat.crusher_recipes["lightgrey"] = {"", 1, "dye:light_grey", 4}
|
||||
atvomat.crusher_recipes["grey"] = {"", 1, "dye:grey", 4}
|
||||
atvomat.crusher_recipes["black"] = {"", 1, "dye:black", 4}
|
||||
|
||||
-- logger control, register trees here, format: tree_log, leaves, sapling_name
|
||||
|
||||
-- note, evergreen trees are currently unsupported.
|
||||
|
||||
atvomat.logger_control["oak"] = {"core:oak_log", "core:oak_leaves", "core:oak_sapling"}
|
||||
atvomat.logger_control["birch"] = {"core:birch_log", "core:birch_leaves", "core:birch_sapling"}
|
||||
atvomat.logger_control["cherry"] = {"core:cherry_log", "core:cherry_leaves", "core:cherry_sapling"}
|
||||
|
||||
-- sorting control card for sorting blocks, format: "name:ingot", "etc", "etc", "etc"
|
||||
|
||||
atvomat.ingot_sort = {
|
||||
|
||||
"core:iron_ingot",
|
||||
"core:copper_ingot",
|
||||
"core:ironze_ingot",
|
||||
"core:gold_ingot",
|
||||
"core:silver_ingot",
|
||||
"core:mese_crystal",
|
||||
"core:diamond"
|
||||
|
||||
}
|
||||
|
||||
atvomat.ingot_block_sort = {
|
||||
|
||||
"core:iron_block",
|
||||
"core:copper_block",
|
||||
"core:ironze_block",
|
||||
"core:gold_block",
|
||||
"core:silver_block",
|
||||
"core:mese",
|
||||
"core:diamond_block",
|
||||
|
||||
}
|
||||
|
||||
atvomat.ore_sort = {
|
||||
|
||||
"core:iron_ore",
|
||||
"core:copper_ore",
|
||||
"core:gold_ore",
|
||||
"core:silver_ore",
|
||||
"core:mese_ore",
|
||||
"core:diamond_ore",
|
||||
|
||||
}
|
||||
|
||||
atvomat.dye_sort = {
|
||||
|
||||
"dye:red"
|
||||
"dye:orange"
|
||||
"dye:yellow"
|
||||
"dye:lime"
|
||||
"dye:green"
|
||||
"dye:dark_green"
|
||||
"dye:cyan"
|
||||
"dye:blue"
|
||||
"dye:magenta"
|
||||
"dye:purple"
|
||||
"dye:violet"
|
||||
"dye:white"
|
||||
"dye:light_grey"
|
||||
"dye:grey"
|
||||
"dye:black"
|
||||
|
||||
}
|
3
mods/atvomat/logger.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
1
mods/atvomat/logger/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
224
mods/atvomat/logger/init.lua
Normal file
@ -0,0 +1,224 @@
|
||||
|
||||
logger = {}
|
||||
logger.saplings = {["default:sapling"]=1, ["default:junglesapling"]=1}
|
||||
logger.trees = {["default:tree"]=1, ["default:jungletree"]=1}
|
||||
logger.fruit = {["default:apple"]=1}
|
||||
|
||||
minetest.register_craft({
|
||||
recipe = {{"default:wood", "default:wood", "default:wood"},
|
||||
{"default:wood", "default:cobble", "default:axe_stone"},
|
||||
{"default:wood", "default:wood", "default:wood"}},
|
||||
output = "logger:logger_off"
|
||||
})
|
||||
|
||||
|
||||
local function allow_put(pos, listname, index, stack, player)
|
||||
local cap = stack:get_tool_capabilities()
|
||||
local is_good_tool = false
|
||||
if cap and cap.groupcaps and cap.groupcaps.choppy and
|
||||
cap.groupcaps.choppy.uses and cap.groupcaps.choppy.uses > 0 then
|
||||
is_good_tool = true
|
||||
end
|
||||
if listname == "saplings" and logger.saplings[stack:get_name()] or
|
||||
listname == "tool" and is_good_tool then
|
||||
return stack:get_stack_max()
|
||||
end
|
||||
return 0 -- Disallow the move
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local metatable = meta:to_table()
|
||||
node.name = name
|
||||
minetest.set_node(pos, node)
|
||||
meta:from_table(metatable)
|
||||
end
|
||||
|
||||
local function setup(meta)
|
||||
local inv = meta:get_inventory()
|
||||
meta:set_string("formspec",
|
||||
"size[8,5]"..
|
||||
"label[0,0;Logger]"..
|
||||
"label[1.6,0;Saplings]"..
|
||||
"list[current_name;saplings;3,0;1,1;]"..
|
||||
"label[4,0;Tool]"..
|
||||
"list[current_name;tool;5,0;1,1;]"..
|
||||
"list[current_player;main;0,1;8,4;]")
|
||||
inv:set_size("saplings", 1)
|
||||
inv:set_size("tool", 1)
|
||||
end
|
||||
|
||||
local function fdir_to_pos(pos, node, back)
|
||||
x = 1
|
||||
if back then x = -1 end
|
||||
local facedir_pos = {
|
||||
{x=pos.x, y=pos.y, z=pos.z-x},
|
||||
{x=pos.x-x, y=pos.y, z=pos.z},
|
||||
{x=pos.x, y=pos.y, z=pos.z+x},
|
||||
{x=pos.x+x, y=pos.y, z=pos.z}
|
||||
}
|
||||
return facedir_pos[node.param2+1]
|
||||
end
|
||||
|
||||
local function store_item(pos, node, itemstring)
|
||||
local bpos = fdir_to_pos(pos, node, true)
|
||||
local bnode = minetest.get_node(bpos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local binv = minetest.get_meta(bpos):get_inventory()
|
||||
local stack = ItemStack(itemstring)
|
||||
|
||||
-- Fill ourselves up with saplings first
|
||||
if (inv:get_stack("saplings", 1):get_name() == stack:get_name()) or
|
||||
(inv:is_empty("saplings") and logger.saplings[stack:get_name()]) then
|
||||
stack = inv:add_item("saplings", stack)
|
||||
end
|
||||
if stack:get_count() <= 0 then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Dump the item in a chest or <del>add it as an item</del> <ins>fail</ins>
|
||||
if bnode.name ~= "default:chest" or not binv:room_for_item("main", stack) then
|
||||
-- This can kill a server...
|
||||
--minetest.add_item(pos, itemstring)
|
||||
--return true
|
||||
return false
|
||||
end
|
||||
binv:add_item("main", stack)
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node("logger:logger_off", {
|
||||
description = "Logger",
|
||||
tiles = {"default_wood.png^logger_top_off.png", "default_wood.png",
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png", "default_wood.png^default_tool_stoneaxe.png"},
|
||||
groups = {choppy=1},
|
||||
paramtype2 = "facedir",
|
||||
on_punch = function(pos, node, puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
swap_node(pos, "logger:logger_on")
|
||||
meta:set_string("infotext", "Logger (enabled)")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Logger (disabled)")
|
||||
setup(meta)
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("saplings") or not inv:is_empty("tool") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Logger cannot be removed because it is not empty");
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("logger:logger_on", {
|
||||
description = "Logger enabled (you hacker you)",
|
||||
tiles = {"default_wood.png^logger_top_on.png", "default_wood.png",
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png", "default_wood.png^default_tool_stoneaxe.png"},
|
||||
groups = {choppy=1, not_in_creative_inventory=1},
|
||||
paramtype2 = "facedir",
|
||||
drop = "logger:logger_off",
|
||||
on_punch = function(pos, node, puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
swap_node(pos, "logger:logger_off")
|
||||
meta:set_string("infotext", "Logger (disabled)")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Logger (enabled)")
|
||||
setup(meta)
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("saplings") or not inv:is_empty("tool") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Logger cannot be removed because it is not empty");
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"logger:logger_on"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local fpos = fdir_to_pos(pos, node, false)
|
||||
local fnode = minetest.get_node(fpos)
|
||||
|
||||
-- Vacum up saplings and fruit
|
||||
-- The nesting here is a bit deep, but Lua doesn't have
|
||||
-- continue so I don't know how to make it shalower. :-(
|
||||
for _, object in pairs(minetest.get_objects_inside_radius(fpos, 3)) do
|
||||
if object:get_entity_name() == "__builtin:item" then
|
||||
local entity = object:get_luaentity()
|
||||
local itemname = ItemStack(entity.itemstring):get_name()
|
||||
if logger.saplings[itemname] or logger.fruit[itemname] then
|
||||
if store_item(pos, node, entity.itemstring) then
|
||||
-- This prevents a duplication glitch
|
||||
-- because objects aren't removed immediately.
|
||||
-- (Nearby loggers will also add the item
|
||||
-- while it is still there)
|
||||
entity:set_item("")
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Place a sapling
|
||||
if fnode.name == "air" and not inv:is_empty("saplings") then
|
||||
local stack = inv:get_stack("saplings", 1)
|
||||
if not logger.saplings[stack:get_name()] then
|
||||
return
|
||||
end
|
||||
inv:remove_item("saplings", ItemStack(stack:get_name()))
|
||||
minetest.set_node(fpos, {name=stack:get_name()})
|
||||
-- Fell a tree
|
||||
elseif logger.trees[fnode.name] and not inv:is_empty("tool") then
|
||||
np = vector.new(fpos)
|
||||
local stack = inv:get_stack("tool", 1)
|
||||
-- This assumes that the tool has a choppy group
|
||||
-- allow_put ensures that this is a axe from default
|
||||
-- so it should be a safe assumption.
|
||||
local uses = stack:get_tool_capabilities().groupcaps.choppy.uses
|
||||
-- Be more eficient because you can chop down trees by hand
|
||||
uses = uses * 4
|
||||
-- I looked at Jeija's timber mod to design this.
|
||||
while minetest.get_node(np).name == fnode.name do
|
||||
-- Slightly above 65535 so
|
||||
-- that the tool runs out in time.
|
||||
-- (For some reason you got one extra use)
|
||||
-- Note that this will work after the tool
|
||||
-- has broken if it is halfway up a tree.
|
||||
if not store_item(pos, node, fnode.name) then
|
||||
break
|
||||
end
|
||||
stack:add_wear(65540/uses)
|
||||
minetest.remove_node(np)
|
||||
np = {x=np.x, y=np.y+1, z=np.z}
|
||||
end
|
||||
inv:set_stack("tool", 1, stack)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
BIN
mods/atvomat/logger/textures/logger_top_off.png
Normal file
After Width: | Height: | Size: 180 B |
BIN
mods/atvomat/logger/textures/logger_top_on.png
Normal file
After Width: | Height: | Size: 182 B |
3
mods/atvomat/mover.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/scrapper.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/sorter.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/switchsort.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
3
mods/atvomat/tools.lua
Normal file
@ -0,0 +1,3 @@
|
||||
-- avtomat - (automatico, automation)
|
||||
-- part of solar plains, by jordach
|
||||
|
@ -30,5 +30,4 @@ minetest.register_node("plants:daisy2", {
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
sounds = mcore.sound_plants,
|
||||
})
|
||||
|
||||
})
|
@ -6,29 +6,47 @@ solarinfuser = {}
|
||||
|
||||
-- create the pipe nodeboxes
|
||||
|
||||
solarinfuser.pipe_middle = {-0.125, -0.125, -0.125, 0.125, 0.125, 0.125}
|
||||
solarinfuser.pipe_middle = {-0.125, -0.125, -0.125, 0.125, 0.125, 0.125}, -- Core
|
||||
|
||||
solarinfuser.pipe_up = {
|
||||
{-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875}, -- ring (will always be this format and )
|
||||
{-0.125, 0.125, -0.125, }, -- pipe
|
||||
}
|
||||
solarinfuser.pipe_north = {
|
||||
|
||||
solarinfuser.pipe_down = {
|
||||
{-0.125, -0.125, 0.125, 0.125, 0.125, 0.5}, -- PipeNorth
|
||||
{-0.1875, -0.1875, 0.3125, 0.1875, 0.1875, 0.375}, -- RingNorth
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_left = {
|
||||
solarinfuser.pipe_east = {
|
||||
|
||||
{0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- PipeEast
|
||||
{0.3125, -0.1875, -0.1875, 0.375, 0.1875, 0.1875}, -- RingEast
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_south = {
|
||||
|
||||
{-0.125, -0.125, -0.5, 0.125, 0.125, -0.125}, -- PipeSouth
|
||||
{-0.1875, -0.1875, -0.375, 0.1875, 0.1875, -0.3125}, -- RingSouth
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_west = {
|
||||
|
||||
{-0.5, -0.125, -0.125, -0.125, 0.125, 0.125}, -- PipeWest
|
||||
{-0.375, -0.1875, -0.1875, -0.3125, 0.1875, 0.1875}, -- RingWest
|
||||
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_top = {
|
||||
|
||||
{-0.125, 0.125, -0.125, 0.125, 0.5, 0.125}, -- PipeTop
|
||||
{-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875}, -- RingTop
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_right = {
|
||||
solarinfuser.pipe_bottom = {
|
||||
|
||||
}
|
||||
{-0.125, -0.5, -0.125, 0.125, -0.125, 0.125}, -- PipeBottom
|
||||
{-0.1875, -0.375, -0.1875, 0.1875, -0.3125, 0.1875}, -- RingBottom
|
||||
|
||||
solarinfuser.pipe_front = {
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_back = {
|
||||
|
||||
}
|
||||
}
|
28
mods/solarinfusion/connector.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- GENERATED CODE
|
||||
-- Node Box Editor, version 0.8.1 - Glass
|
||||
-- Namespace: test
|
||||
|
||||
minetest.register_node("test:node_1", {
|
||||
tiles = {
|
||||
"solarcatcher_pipe.png",
|
||||
"solarcatcher_pipe.png",
|
||||
"solarcatcher_pipe.png",
|
||||
"solarcatcher_pipe.png",
|
||||
"solarcatcher_pipe.png",
|
||||
"solarcatcher_pipe.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1875, -0.1875, 0.375, 0.1875, 0.1875, 0.5}, -- ConnectorNorth
|
||||
{-0.1875, -0.1875, -0.5, 0.1875, 0.1875, -0.375}, -- ConnectorSouth
|
||||
{0.375, -0.1875, -0.1875, 0.5, 0.1875, 0.1875}, -- ConnectorEast
|
||||
{-0.5, -0.1875, -0.1875, -0.375, 0.1875, 0.1875}, -- ConnectorWest
|
||||
{-0.1875, 0.375, -0.1875, 0.1875, 0.5, 0.1875}, -- ConnectorTop
|
||||
{-0.1875, -0.5, -0.1875, 0.1875, -0.375, 0.1875}, -- ConnectorBottom
|
||||
}
|
||||
}
|
||||
})
|
||||
|
78
mods/solarinfusion/init.lua
Normal file
@ -0,0 +1,78 @@
|
||||
--solarinfuser, a neat and fancy energy mod
|
||||
|
||||
-- namespacing, as per usual.
|
||||
|
||||
solarinfuser = {}
|
||||
|
||||
-- create the pipe nodeboxes
|
||||
|
||||
solarinfuser.pipe_middle = {-0.125, -0.125, -0.125, 0.125, 0.125, 0.125} -- Core
|
||||
|
||||
solarinfuser.pipe_south = {
|
||||
|
||||
{-0.125, -0.125, 0.125, 0.125, 0.125, 0.5}, -- PipeNorth
|
||||
--{-0.1875, -0.1875, 0.3125, 0.1875, 0.1875, 0.375}, -- RingNorth
|
||||
--{-0.1875, -0.1875, 0.375, 0.1875, 0.1875, 0.5}, -- ConnectorNorth
|
||||
}
|
||||
|
||||
solarinfuser.pipe_east = {
|
||||
|
||||
{0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- PipeEast
|
||||
--{0.3125, -0.1875, -0.1875, 0.375, 0.1875, 0.1875}, -- RingEast
|
||||
--{0.375, -0.1875, -0.1875, 0.5, 0.1875, 0.1875}, -- ConnectorEast
|
||||
}
|
||||
|
||||
solarinfuser.pipe_north = {
|
||||
|
||||
{-0.125, -0.125, -0.5, 0.125, 0.125, -0.125}, -- PipeSouth
|
||||
--{-0.1875, -0.1875, -0.375, 0.1875, 0.1875, -0.3125}, -- RingSouth
|
||||
--{-0.1875, -0.1875, -0.5, 0.1875, 0.1875, -0.375}, -- ConnectorSouth
|
||||
}
|
||||
|
||||
solarinfuser.pipe_west = {
|
||||
|
||||
{-0.5, -0.125, -0.125, -0.125, 0.125, 0.125}, -- PipeWest
|
||||
--{-0.375, -0.1875, -0.1875, -0.3125, 0.1875, 0.1875}, -- RingWest
|
||||
--{-0.5, -0.1875, -0.1875, -0.375, 0.1875, 0.1875}, -- ConnectorWest
|
||||
|
||||
}
|
||||
|
||||
solarinfuser.pipe_top = {
|
||||
|
||||
{-0.125, 0.125, -0.125, 0.125, 0.5, 0.125}, -- PipeTop
|
||||
--{-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875}, -- RingTop
|
||||
--{-0.1875, 0.375, -0.1875, 0.1875, 0.5, 0.1875}, -- ConnectorTop
|
||||
}
|
||||
|
||||
solarinfuser.pipe_bottom = {
|
||||
|
||||
{-0.125, -0.5, -0.125, 0.125, -0.125, 0.125}, -- PipeBottom
|
||||
--{-0.1875, -0.375, -0.1875, 0.1875, -0.3125, 0.1875}, -- RingBottom
|
||||
--{-0.1875, -0.5, -0.1875, 0.1875, -0.375, 0.1875}, -- ConnectorBottom
|
||||
}
|
||||
|
||||
minetest.register_node("solarinfusion:pipe", {
|
||||
tiles = { "solarcatcher_pipe.png" },
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
|
||||
node_box = {
|
||||
|
||||
type = "connected",
|
||||
|
||||
fixed = solarinfuser.pipe_middle,
|
||||
|
||||
connect_front = solarinfuser.pipe_north,
|
||||
connect_right = solarinfuser.pipe_east,
|
||||
connect_back = solarinfuser.pipe_south,
|
||||
connect_left = solarinfuser.pipe_west,
|
||||
connect_top = solarinfuser.pipe_top,
|
||||
connect_bottom = solarinfuser.pipe_bottom,
|
||||
|
||||
},
|
||||
|
||||
connects_to = {"core:furnace", "solarinfusion:pipe"},
|
||||
groups = {oddly_breakable_by_hand = 2},
|
||||
sunlight_propagates = true,
|
||||
|
||||
})
|
BIN
mods/solarinfusion/textures/solarcatcher_pipe.png
Normal file
After Width: | Height: | Size: 350 B |