anvils: more expensive, and not movable

This commit is contained in:
flux 2023-05-28 16:04:49 -07:00
parent b050a18a04
commit 41989436b4
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
5 changed files with 26 additions and 4 deletions

View File

@ -82,6 +82,7 @@ function api.register_machine(name, def)
is_ground_content = false,
groups = def.groups,
sounds = def.sounds,
drop = def.drop,
after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos)

View File

@ -4,6 +4,7 @@ local FS = function(...)
return F(S(...))
end
local anvil = cottages.anvil
local ci = cottages.craftitems
local add_entity = minetest.add_entity
local get_node = minetest.get_node
@ -29,6 +30,7 @@ local hud_timeout = cottages.settings.anvil.hud_timeout
local stamina_use = cottages.settings.anvil.stamina
local tool_entity_enabled = cottages.settings.anvil.tool_entity_enabled
local tool_entity_displacement = cottages.settings.anvil.tool_entity_displacement
local destroy_when_dug = cottages.settings.anvil.destroy_when_dug
local hud_info_by_puncher_name = {}
@ -444,6 +446,18 @@ function anvil.preserve_metadata(pos, oldnode, oldmeta, drops)
return drops
end
local drop
if destroy_when_dug then
drop = {
items = {
{
items = { ci.steel .. " 7" },
},
},
}
end
cottages.api.register_machine("cottages:anvil", {
description = S("anvil"),
drawtype = "nodebox",
@ -460,6 +474,7 @@ cottages.api.register_machine("cottages:anvil", {
tiles = { "cottages_stone.png^[colorize:#000:192" },
groups = { cracky = 2 },
sounds = cottages.sounds.metal,
drop = drop,
inv_info = {
input = 1,

View File

@ -1,16 +1,18 @@
local S = cottages.S
local ci = cottages.craftitems
if ci.steel then
if ci.steelblock then
minetest.register_craft({
output = "cottages:anvil",
recipe = {
{ ci.steel, ci.steel, ci.steel },
{ "", ci.steel, "" },
{ ci.steel, ci.steel, ci.steel },
{ ci.steelblock, ci.steelblock, ci.steelblock },
{ "", ci.steelblock, "" },
{ ci.steelblock, ci.steelblock, ci.steelblock },
},
})
end
if ci.steel then
minetest.register_craft({
output = "cottages:hammer",
recipe = {

View File

@ -24,6 +24,7 @@ if has.default then
ci.rail = resolve_item("default:rail")
ci.sand = resolve_item("default:sand")
ci.steel = resolve_item("default:steel_ingot")
ci.steelblock = resolve_item("default:steelblock")
ci.stone = resolve_item("default:stone")
end

View File

@ -28,6 +28,9 @@ cottages.anvil.tool_entity_enabled (tool entity enabled) bool false
# how far above the anvil to put the entity
cottages.anvil.tool_entity_displacement (tool entity displacement) float .125
# if true, the anvil is destroyed when dug, though it does drop some iron.
cottages.anvil.destroy_when_dug (destroy anvil when dug) bool true
###############################################################################
# provides a barrel which can be used to store liquids, and a couple decorative variants.