mirror of
https://github.com/Sokomine/cottages.git
synced 2025-07-12 12:50:20 +02:00
refactor, cleanup, API, bugfixes (#1)
This commit is contained in:
55
modules/straw/api.lua
Normal file
55
modules/straw/api.lua
Normal file
@ -0,0 +1,55 @@
|
||||
local S = cottages.S
|
||||
|
||||
local api = cottages.straw
|
||||
|
||||
local has_ui = cottages.has.unified_inventory
|
||||
|
||||
if has_ui then
|
||||
unified_inventory.register_craft_type("cottages:quern", {
|
||||
description = S("quern-stone"),
|
||||
icon = "cottages_quern.png",
|
||||
width = 1,
|
||||
height = 1,
|
||||
uses_crafting_grid = false,
|
||||
})
|
||||
|
||||
unified_inventory.register_craft_type("cottages:threshing", {
|
||||
description = S("threshing floor"),
|
||||
icon = "cottages_junglewood.png^farming_wheat.png",
|
||||
width = 1,
|
||||
height = 1,
|
||||
uses_crafting_grid = false,
|
||||
})
|
||||
end
|
||||
|
||||
api.registered_quern_crafts = {}
|
||||
|
||||
function api.register_quern_craft(recipe)
|
||||
api.registered_quern_crafts[recipe.input] = recipe.output
|
||||
|
||||
if has_ui then
|
||||
unified_inventory.register_craft({
|
||||
output = recipe.output,
|
||||
type = "cottages:quern",
|
||||
items = {recipe.input},
|
||||
width = 1,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
api.registered_threshing_crafts = {}
|
||||
|
||||
function api.register_threshing_craft(recipe)
|
||||
api.registered_threshing_crafts[recipe.input] = recipe.output
|
||||
|
||||
if has_ui then
|
||||
for _, output in ipairs(recipe.output) do
|
||||
unified_inventory.register_craft({
|
||||
output = output,
|
||||
type = "cottages:threshing",
|
||||
items = {recipe.input},
|
||||
width = 1,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
93
modules/straw/crafts.lua
Normal file
93
modules/straw/crafts.lua
Normal file
@ -0,0 +1,93 @@
|
||||
local ci = cottages.craftitems
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_mat 6",
|
||||
recipe = {
|
||||
{ci.stone, "", ""},
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat", },
|
||||
},
|
||||
replacements = {{ci.stone, ci.seed_wheat .. " 3"}},
|
||||
})
|
||||
|
||||
-- this is a better way to get straw mats
|
||||
minetest.register_craft({
|
||||
output = "cottages:threshing_floor",
|
||||
recipe = {
|
||||
{ci.junglewood, ci.chest_locked, ci.junglewood, },
|
||||
{ci.junglewood, ci.stone, ci.junglewood, },
|
||||
},
|
||||
})
|
||||
|
||||
-- and a way to turn wheat seeds into flour
|
||||
minetest.register_craft({
|
||||
output = "cottages:quern",
|
||||
recipe = {
|
||||
{ci.stick, ci.stone, "", },
|
||||
{"", ci.steel, "", },
|
||||
{"", ci.stone, "", },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_bale",
|
||||
recipe = {
|
||||
{"cottages:straw_mat"},
|
||||
{"cottages:straw_mat"},
|
||||
{"cottages:straw_mat"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw",
|
||||
recipe = {
|
||||
{"cottages:straw_bale"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_bale",
|
||||
recipe = {
|
||||
{"cottages:straw"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_mat 3",
|
||||
recipe = {
|
||||
{"cottages:straw_bale"},
|
||||
},
|
||||
})
|
||||
|
||||
---------------------------------
|
||||
|
||||
if ci.flour then
|
||||
if ci.seed_barley then
|
||||
cottages.straw.register_quern_craft({input = ci.seed_barley, output = ci.flour})
|
||||
end
|
||||
if ci.seed_oat then
|
||||
cottages.straw.register_quern_craft({input = ci.seed_oat, output = ci.flour})
|
||||
end
|
||||
if ci.seed_rye then
|
||||
cottages.straw.register_quern_craft({input = ci.seed_rye, output = ci.flour})
|
||||
end
|
||||
if ci.seed_wheat then
|
||||
cottages.straw.register_quern_craft({input = ci.seed_wheat, output = ci.flour})
|
||||
end
|
||||
end
|
||||
|
||||
if ci.rice and ci.rice_flour then
|
||||
cottages.straw.register_quern_craft({input = ci.rice, output = ci.rice_flour})
|
||||
end
|
||||
|
||||
if ci.barley and ci.seed_barley then
|
||||
cottages.straw.register_threshing_craft({input = ci.barley, output = {ci.seed_barley, ci.straw_mat}})
|
||||
end
|
||||
if ci.oat and ci.seed_oat then
|
||||
cottages.straw.register_threshing_craft({input = ci.oat, output = {ci.seed_oat, ci.straw_mat}})
|
||||
end
|
||||
if ci.rye and ci.seed_rye then
|
||||
cottages.straw.register_threshing_craft({input = ci.rye, output = {ci.seed_rye, ci.straw_mat}})
|
||||
end
|
||||
if ci.wheat and ci.seed_wheat then
|
||||
cottages.straw.register_threshing_craft({input = ci.wheat, output = {ci.seed_wheat, ci.straw_mat}})
|
||||
end
|
7
modules/straw/init.lua
Normal file
7
modules/straw/init.lua
Normal file
@ -0,0 +1,7 @@
|
||||
cottages.straw = {}
|
||||
|
||||
cottages.dofile("modules", "straw", "api")
|
||||
cottages.dofile("modules", "straw", "nodes")
|
||||
cottages.dofile("modules", "straw", "quern")
|
||||
cottages.dofile("modules", "straw", "threshing")
|
||||
cottages.dofile("modules", "straw", "crafts")
|
71
modules/straw/nodes.lua
Normal file
71
modules/straw/nodes.lua
Normal file
@ -0,0 +1,71 @@
|
||||
local S = cottages.S
|
||||
|
||||
if not (minetest.registered_nodes["farming:straw"]) then
|
||||
minetest.register_node("cottages:straw", {
|
||||
drawtype = "normal",
|
||||
description = S("straw"),
|
||||
tiles = {cottages.textures.straw},
|
||||
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
|
||||
sounds = cottages.sounds.leaves,
|
||||
-- the bale is slightly smaller than a full node
|
||||
is_ground_content = false,
|
||||
})
|
||||
else
|
||||
minetest.register_alias("cottages:straw", "farming:straw")
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("cottages:straw_mat", {
|
||||
description = S("layer of straw"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {cottages.textures.straw}, -- done by VanessaE
|
||||
wield_image = cottages.textures.straw,
|
||||
inventory_image = cottages.textures.straw,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = false,
|
||||
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
|
||||
sounds = cottages.sounds.leaves,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5, -0.48, 0.48, -0.45, 0.48},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5, -0.48, 0.48, -0.25, 0.48},
|
||||
}
|
||||
},
|
||||
is_ground_content = false,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return cottages.sleep_in_bed(pos, node, clicker, itemstack, pointed_thing)
|
||||
end
|
||||
})
|
||||
|
||||
-- straw bales are a must for farming environments; if you for some reason do not have the darkage mod installed, this
|
||||
-- here gets you a straw bale
|
||||
minetest.register_node("cottages:straw_bale", {
|
||||
drawtype = "nodebox",
|
||||
description = S("straw bale"),
|
||||
tiles = {"cottages_darkage_straw_bale.png"},
|
||||
paramtype = "light",
|
||||
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
|
||||
sounds = cottages.sounds.leaves,
|
||||
-- the bale is slightly smaller than a full node
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.45, -0.5, -0.45, 0.45, 0.45, 0.45},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.45, -0.5, -0.45, 0.45, 0.45, 0.45},
|
||||
}
|
||||
},
|
||||
is_ground_content = false,
|
||||
})
|
180
modules/straw/quern.lua
Normal file
180
modules/straw/quern.lua
Normal file
@ -0,0 +1,180 @@
|
||||
local straw = cottages.straw
|
||||
|
||||
local S = cottages.S
|
||||
local F = minetest.formspec_escape
|
||||
local FS = function(...) return F(S(...)) end
|
||||
|
||||
local get_safe_short_description = futil.get_safe_short_description
|
||||
|
||||
local has_stamina = cottages.has.stamina
|
||||
local stamina_use = cottages.settings.straw.quern_stamina
|
||||
local quern_min_per_turn = cottages.settings.straw.quern_min_per_turn
|
||||
local quern_max_per_turn = cottages.settings.straw.quern_max_per_turn
|
||||
|
||||
|
||||
function straw.get_quern_fs_parts()
|
||||
return {
|
||||
("size[8,8]"),
|
||||
("image[0,1;1,1;%s]"):format(F(cottages.textures.wheat_seed)),
|
||||
("label[0,0.5;%s]"):format(FS("Input:")),
|
||||
("label[3,0.5;%s]"):format(FS("Output:")),
|
||||
("label[0,-0.3;%s]"):format(FS("Quern")),
|
||||
("label[0,2.5;%s]"):format(FS("Punch this hand-driven quern")),
|
||||
("label[0,3.0;%s]"):format(FS("to grind suitable items.")),
|
||||
("list[context;seeds;1,1;1,1;]"),
|
||||
("list[context;flour;4,1;2,2;]"),
|
||||
("list[current_player;main;0,4;8,4;]"),
|
||||
("listring[current_player;main]"),
|
||||
("listring[context;seeds]"),
|
||||
("listring[current_player;main]"),
|
||||
("listring[context;flour]"),
|
||||
}
|
||||
end
|
||||
|
||||
function straw.get_quern_info(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if meta:get_int("used") == 0 then
|
||||
return S("quern, powered by punching")
|
||||
|
||||
else
|
||||
local inv = meta:get_inventory()
|
||||
local input = inv:get_stack("seeds", 1)
|
||||
local count = input:get_count()
|
||||
|
||||
if count > 0 then
|
||||
local input_description = get_safe_short_description(input)
|
||||
return S("quern, @1 @2 remaining", count, input_description)
|
||||
|
||||
else
|
||||
return S("quern, none remaining")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_quern_results(input)
|
||||
local item = input:get_name()
|
||||
local output_def = straw.registered_quern_crafts[item]
|
||||
if type(output_def) == "string" then
|
||||
return {ItemStack(output_def)}
|
||||
|
||||
elseif type(output_def) == "table" and #output_def > 0 then
|
||||
local outputs = {}
|
||||
for _, output_item in ipairs(output_def) do
|
||||
if type(output_item) == "string" then
|
||||
table.insert(outputs, ItemStack(output_item))
|
||||
|
||||
elseif type(output_item) == "table" then
|
||||
local chance
|
||||
output_item, chance = unpack(output_item)
|
||||
if math.random() <= chance then
|
||||
table.insert(outputs, ItemStack(output_item))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return outputs
|
||||
|
||||
elseif type(output_def) == "function" then
|
||||
return output_def()
|
||||
end
|
||||
end
|
||||
|
||||
function straw.use_quern(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local input = inv:get_stack("seeds", 1)
|
||||
|
||||
if input:is_empty() then
|
||||
return
|
||||
end
|
||||
|
||||
local input_count = input:get_count()
|
||||
local number_to_process = math.min(math.random(quern_min_per_turn, quern_max_per_turn), input_count)
|
||||
|
||||
local above = vector.add(pos, vector.new(0, 1, 0))
|
||||
for _ = 1, number_to_process do
|
||||
local results = get_quern_results(input:take_item(1))
|
||||
|
||||
for _, result in ipairs(results) do
|
||||
local leftovers = inv:add_item("flour", result)
|
||||
if not leftovers:is_empty() then
|
||||
minetest.add_item(above, leftovers)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
inv:set_stack("seeds", 1, input)
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
node.param2 = (node.param2 + 1) % 4
|
||||
minetest.swap_node(pos, node)
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
time = 0.1,
|
||||
collisiondetection = true,
|
||||
texture = cottages.textures.dust,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
minexptime = 0.4,
|
||||
maxexptime = 0.8,
|
||||
minpos = vector.subtract(pos, 0.1),
|
||||
maxpos = vector.add(pos, vector.new(0.1, 0, 0.1)),
|
||||
minvel = vector.new(-1, -0.5, -1),
|
||||
maxvel = vector.new(1, 0.5, 1),
|
||||
minacc = vector.new(0, -3, 0),
|
||||
maxacc = vector.new(0, -3, 0),
|
||||
})
|
||||
|
||||
minetest.sound_play(
|
||||
{name = cottages.sounds.use_quern},
|
||||
{pos = pos, gain = 1, pitch = 0.25},
|
||||
true
|
||||
)
|
||||
|
||||
if has_stamina then
|
||||
stamina.exhaust_player(player, stamina_use, "cottages:quern")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
cottages.api.register_machine("cottages:quern", {
|
||||
description = S("quern-stone\npunch to operate"),
|
||||
short_description = S("quern-stone"),
|
||||
drawtype = "mesh",
|
||||
mesh = "cottages_quern.obj",
|
||||
tiles = {"cottages_stone.png"},
|
||||
selection_box = {type = "fixed", fixed = {{-0.50, -0.5, -0.50, 0.50, 0.25, 0.50}}},
|
||||
groups = {cracky = 2},
|
||||
sounds = cottages.sounds.stone,
|
||||
|
||||
inv_info = {
|
||||
seeds = 1,
|
||||
flour = 4,
|
||||
},
|
||||
|
||||
update_infotext = straw.update_quern_infotext,
|
||||
update_formspec = straw.update_quern_formspec,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "flour" then
|
||||
return 0
|
||||
end
|
||||
|
||||
if listname == "seeds" and not cottages.straw.registered_quern_crafts[stack:get_name()] then
|
||||
return 0
|
||||
end
|
||||
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
use = straw.use_quern,
|
||||
get_fs_parts = straw.get_quern_fs_parts,
|
||||
get_info = straw.get_quern_info,
|
||||
})
|
243
modules/straw/threshing.lua
Normal file
243
modules/straw/threshing.lua
Normal file
@ -0,0 +1,243 @@
|
||||
local straw = cottages.straw
|
||||
|
||||
local S = cottages.S
|
||||
local F = minetest.formspec_escape
|
||||
local FS = function(...) return F(S(...)) end
|
||||
|
||||
local get_safe_short_description = futil.get_safe_short_description
|
||||
|
||||
local has_stamina = cottages.has.stamina
|
||||
local stamina_use = cottages.settings.straw.threshing_stamina
|
||||
local threshing_min_per_punch = cottages.settings.straw.threshing_min_per_punch
|
||||
local threshing_max_per_punch = cottages.settings.straw.threshing_max_per_punch
|
||||
|
||||
function straw.get_threshing_fs_parts()
|
||||
return {
|
||||
("size[8,8]"),
|
||||
("image[3,1;1,1;%s]"):format(F(cottages.textures.stick)),
|
||||
("image[0,1;1,1;%s]"):format(F(cottages.textures.wheat)),
|
||||
("label[1,0.5;%s]"):format(FS("Input:")),
|
||||
("label[3,0.0;%s]"):format(FS("Output:")),
|
||||
("label[0,0;%s]"):format(FS("Threshing Floor")),
|
||||
("label[0,2.5;%s]"):format(FS("Punch threshing floor with a stick")),
|
||||
("label[0,3.0;%s]"):format(FS("to get straw and seeds from wheat.")),
|
||||
("list[context;harvest;1,1;2,1;]"),
|
||||
("list[context;straw;4,0;2,2;]"),
|
||||
("list[context;seeds;4,2;2,2;]"),
|
||||
("list[current_player;main;0,4;8,4;]"),
|
||||
("listring[current_player;main]"),
|
||||
("listring[context;harvest]"),
|
||||
("listring[current_player;main]"),
|
||||
("listring[context;straw]"),
|
||||
("listring[current_player;main]"),
|
||||
("listring[context;seeds]"),
|
||||
}
|
||||
end
|
||||
|
||||
function straw.get_threshing_info(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if meta:get_int("used") == 0 then
|
||||
return S("threshing floor")
|
||||
|
||||
else
|
||||
local inv = meta:get_inventory()
|
||||
local input1 = inv:get_stack("harvest", 1)
|
||||
local input2 = inv:get_stack("harvest", 2)
|
||||
local count = input1:get_count() + input2:get_count()
|
||||
|
||||
if count > 0 then
|
||||
local input_description
|
||||
if input1:is_empty() then
|
||||
input_description = get_safe_short_description(input2)
|
||||
|
||||
else
|
||||
input_description = get_safe_short_description(input1)
|
||||
end
|
||||
return S("threshing floor, @1 @2 remaining", count, input_description)
|
||||
|
||||
else
|
||||
return S("threshing floor, none remaining")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_threshing_results(input)
|
||||
local item = input:get_name()
|
||||
local output_def = straw.registered_threshing_crafts[item]
|
||||
if type(output_def) == "string" then
|
||||
return {ItemStack(output_def)}
|
||||
|
||||
elseif type(output_def) == "table" and #output_def > 0 then
|
||||
local outputs = {}
|
||||
for _, output_item in ipairs(output_def) do
|
||||
if type(output_item) == "string" then
|
||||
table.insert(outputs, ItemStack(output_item))
|
||||
|
||||
elseif type(output_item) == "table" then
|
||||
local chance
|
||||
output_item, chance = unpack(output_item)
|
||||
if math.random() <= chance then
|
||||
table.insert(outputs, ItemStack(output_item))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return outputs
|
||||
|
||||
elseif type(output_def) == "function" then
|
||||
return output_def()
|
||||
end
|
||||
end
|
||||
|
||||
function straw.use_threshing(pos, player)
|
||||
-- only punching with a normal stick is supposed to work
|
||||
local wielded = player:get_wielded_item()
|
||||
if minetest.get_item_group(wielded:get_name(), "stick") == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local input1 = inv:get_stack("harvest", 1)
|
||||
local input2 = inv:get_stack("harvest", 2)
|
||||
|
||||
local input_count = input1:get_count() + input2:get_count()
|
||||
|
||||
if input_count == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local number_to_process = math.min(math.random(threshing_min_per_punch, threshing_max_per_punch), input_count)
|
||||
|
||||
for _ = 1, number_to_process do
|
||||
local results
|
||||
if input1:is_empty() then
|
||||
results = get_threshing_results(input2:take_item(1))
|
||||
else
|
||||
results = get_threshing_results(input1:take_item(1))
|
||||
end
|
||||
|
||||
for _, result in ipairs(results) do
|
||||
local leftovers = inv:add_item("straw", result)
|
||||
if not leftovers:is_empty() then
|
||||
leftovers = inv:add_item("seeds", result)
|
||||
if not leftovers:is_empty() then
|
||||
minetest.add_item(pos, leftovers)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
inv:set_stack("harvest", 1, input1)
|
||||
inv:set_stack("harvest", 2, input2)
|
||||
|
||||
local particle_pos = vector.subtract(pos, vector.new(0, 0.25, 0))
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.1,
|
||||
collisiondetection = true,
|
||||
texture = cottages.textures.straw,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
minexptime = 0.2,
|
||||
maxexptime = 0.4,
|
||||
minpos = vector.subtract(particle_pos, 0.1),
|
||||
maxpos = vector.add(particle_pos, 0.1),
|
||||
minvel = vector.new(-3, 1, -3),
|
||||
maxvel = vector.new(3, 2, 3),
|
||||
minacc = vector.new(0, -10, 0),
|
||||
maxacc = vector.new(0, -10, 0),
|
||||
})
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.1,
|
||||
collisiondetection = true,
|
||||
texture = cottages.textures.wheat_seed,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
minexptime = 0.2,
|
||||
maxexptime = 0.4,
|
||||
minpos = vector.subtract(particle_pos, 0.1),
|
||||
maxpos = vector.add(particle_pos, 0.1),
|
||||
minvel = vector.new(-3, 0.5, -3),
|
||||
maxvel = vector.new(3, 1, 3),
|
||||
minacc = vector.new(0, -10, 0),
|
||||
maxacc = vector.new(0, -10, 0),
|
||||
})
|
||||
|
||||
minetest.sound_play(
|
||||
{name = cottages.sounds.use_thresher},
|
||||
{pos = particle_pos, gain = 1, pitch = 0.5},
|
||||
true
|
||||
)
|
||||
|
||||
if has_stamina then
|
||||
stamina.exhaust_player(player, stamina_use, "cottages:quern")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
cottages.api.register_machine("cottages:threshing_floor", {
|
||||
description = S("threshing floor\npunch with a stick to operate"),
|
||||
short_description = S("threshing floor"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.50, -0.5, -0.50, 0.50, -0.40, 0.50},
|
||||
|
||||
{-0.50, -0.4, -0.50, -0.45, -0.20, 0.50},
|
||||
{0.45, -0.4, -0.50, 0.50, -0.20, 0.50},
|
||||
|
||||
{-0.45, -0.4, -0.50, 0.45, -0.20, -0.45},
|
||||
{-0.45, -0.4, 0.45, 0.45, -0.20, 0.50},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.50, -0.5, -0.50, 0.50, -0.20, 0.50},
|
||||
}
|
||||
},
|
||||
tiles = {
|
||||
"cottages_junglewood.png^farming_wheat.png",
|
||||
"cottages_junglewood.png",
|
||||
"cottages_junglewood.png^" .. cottages.textures.stick
|
||||
},
|
||||
groups = {cracky = 2, choppy = 2},
|
||||
sounds = cottages.sounds.wood,
|
||||
is_ground_content = false,
|
||||
|
||||
inv_info = {
|
||||
harvest = 2,
|
||||
straw = 4,
|
||||
seeds = 4,
|
||||
},
|
||||
|
||||
update_infotext = straw.update_threshing_infotext,
|
||||
update_formspec = straw.update_threshing_formspec,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "straw" or listname == "seeds" then
|
||||
return 0
|
||||
end
|
||||
|
||||
if not cottages.straw.registered_threshing_crafts[stack:get_name()] then
|
||||
return 0
|
||||
end
|
||||
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
use = straw.use_threshing,
|
||||
get_fs_parts = straw.get_threshing_fs_parts,
|
||||
get_info = straw.get_threshing_info,
|
||||
})
|
Reference in New Issue
Block a user