Skip to content

Commit

Permalink
Artisan Benches modpack: extract anvil. Relates to #1798
Browse files Browse the repository at this point in the history
  • Loading branch information
alek13 committed Dec 4, 2024
1 parent cb4a049 commit b27ed46
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 78 deletions.
4 changes: 3 additions & 1 deletion mods/lord/Blocks/ArtisanBenches/anvil/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@


minetest.mod(function(mod)
--require("anvil").init(mod)
require("anvil").init(mod)

dofile(mod.path .. '/legacy.lua')
end)
8 changes: 8 additions & 0 deletions mods/lord/Blocks/ArtisanBenches/anvil/legacy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

-- @tags: legacy

minetest.register_alias('castle:anvil', 'anvil:anvil')
minetest.register_alias('lord_artisan_benches:anvil', 'anvil:anvil')
-- DEFAULTS (Ghost blocks)
minetest.register_alias('defaults:castle_anvil', 'defaults:anvil_anvil')
minetest.register_alias('defaults:lord_artisan_benches_anvil', 'defaults:anvil_anvil')
2 changes: 2 additions & 0 deletions mods/lord/Blocks/ArtisanBenches/anvil/locale/anvil.en.tr
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# textdomain: anvil

Anvil=Anvil
2 changes: 2 additions & 0 deletions mods/lord/Blocks/ArtisanBenches/anvil/locale/anvil.ru.tr
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# textdomain: anvil

Anvil=Наковальня
74 changes: 74 additions & 0 deletions mods/lord/Blocks/ArtisanBenches/anvil/src/anvil.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
local S = minetest.get_mod_translator()
local Form = require('anvil.Form')


local px = 1/16
local node_box = {
type = 'fixed',
fixed = {
-- Подошва
{ -8*px, -8*px, -8*px, -4*px, -5*px, -4*px }, -- ножки подошвы
{ -8*px, -8*px, 8*px, -4*px, -5*px, 4*px },
{ 8*px, -8*px, 8*px, 4*px, -5*px, 4*px },
{ 8*px, -8*px, -8*px, 4*px, -5*px, -4*px },

{ -7*px, -8*px, -6*px, 7*px, -5*px, 6*px }, -- сердцевины подошвы
{ -5*px, -5*px, -4*px, 5*px, -2*px, 4*px },

-- Ножка / шея
{ -3*px, -2*px, -2*px, 3*px, 3*px, 2*px },
-- Рабочая область (наличник)
{ -5*px, 3*px, -4*px, 5*px, 8*px, 4*px },

-- Рог
{ -5*px, 5*px, -2*px, -8*px, 8*px, 2*px },

-- Обух с отверстием Харди
{ 7*px, 5*px, -4*px, 8*px, 8*px, 4*px },
{ 5*px, 5*px, -2*px, 7*px, 6*px, 2*px },
{ 5*px, 5*px, -4*px, 7*px, 8*px, -2*px },
{ 5*px, 5*px, 2*px, 7*px, 8*px, 4*px },
},
}

local function register_node()
minetest.register_node('anvil:anvil', {
description = S('Anvil'),
drawtype = 'mesh',
mesh = 'anvil.obj',
tiles = { 'benches_anvil.png' },
groups = { cracky = 1, falling_node = 1 },
selection_box = node_box,
collision_box = node_box,
paramtype = 'light',
paramtype2 = 'facedir',
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
Form:new(clicker, pos):open()
end
})
end

local function register_craft()
minetest.register_craft({
output = 'anvil:anvil',
recipe = {
{ 'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot' },
{ '', 'default:steel_ingot', '' },
{ 'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot' },
}
})
end


return {
--- @param mod minetest.Mod
init = function(mod)
minetest.CraftMethod.ANVIL = 'anvil'
minetest.register_craft_method(minetest.CraftMethod.ANVIL)

Form:register()

register_node()
register_craft()
end,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Inventory = require("artisan_benches.anvil.Form.Inventory")
local Inventory = require('anvil.Form.Inventory')


--- @class artisan_benches.anvil.Form: base_classes.Form.Base
Expand All @@ -7,7 +7,7 @@ local Inventory = require("artisan_benches.anvil.Form.Inventory")
local Form = base_classes.Form:personal():for_node():with_detached(Inventory):extended({
--- @const
--- @type string
NAME = "lord_artisan_benches:anvil",
NAME = 'anvil:anvil',
})

--- @private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local InventoryCallbacks = require("artisan_benches.anvil.Form.InventoryCallbacks")
local InventoryCallbacks = require('anvil.Form.InventoryCallbacks')


--- @class anvil.Form.Inventory: base_classes.DetachedInventory
Expand Down
4 changes: 0 additions & 4 deletions mods/lord/Blocks/lord_artisan_benches/legacy.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@

-- @tags: legacy

minetest.register_alias('castle:anvil', 'lord_artisan_benches:anvil')

minetest.register_alias('lottpotion:cauldron_full', 'lord_artisan_benches:cauldron_3_3')
minetest.register_alias('lottpotion:cauldron_two_third_full', 'lord_artisan_benches:cauldron_2_3')
minetest.register_alias('lottpotion:cauldron_one_third_full', 'lord_artisan_benches:cauldron_1_3')
minetest.register_alias('lottpotion:cauldron_empty', 'lord_artisan_benches:cauldron_0_3')

-- DEFAULTS (Ghost blocks)
minetest.register_alias('defaults:castle_anvil', 'defaults:lord_artisan_benches_anvil')

minetest.register_alias('defaults:lottpotion_cauldron_full', 'defaults:lord_artisan_benches_cauldron_3_3')
minetest.register_alias('defaults:lottpotion_cauldron_two_third_full', 'defaults:lord_artisan_benches_cauldron_2_3')
minetest.register_alias('defaults:lottpotion_cauldron_one_third_full', 'defaults:lord_artisan_benches_cauldron_1_3')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ Ingredients:=Ingredients:
Result:=Result:


### Anvil: ###
Anvil=Anvil

### Cauldron ###
Filled Cauldron=Filled Cauldron
Two Third Filled Cauldron=Two Third Filled Cauldron
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ Ingredients:=Ингредиенты:
Result:=Результат:


### Anvil: ###
Anvil=Наковальня

### Cauldron ###
Filled Cauldron=Полный котёл
Two Third Filled Cauldron=Котёл, заполненный на 2/3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
return {
--- @param mod minetest.Mod
init = function(mod)
require('artisan_benches.anvil')
require('artisan_benches.barrel')
require('artisan_benches.cauldron')
require('artisan_benches.laboratory')
Expand Down

This file was deleted.

0 comments on commit b27ed46

Please sign in to comment.