I like this approach better
This commit is contained in:
parent
01ad419b55
commit
3851b26290
12
minetest-api.d.ts
vendored
12
minetest-api.d.ts
vendored
@ -557,15 +557,15 @@ declare global {
|
||||
}
|
||||
|
||||
export interface ItemDropSpec {
|
||||
tools: string[]
|
||||
rarity: number
|
||||
items: string[]
|
||||
inherit_color: boolean
|
||||
tool_groups: string | string[]
|
||||
tools?: string[]
|
||||
rarity?: number
|
||||
items?: string[]
|
||||
inherit_color?: boolean
|
||||
tool_groups?: string[] | string[][]
|
||||
}
|
||||
|
||||
export interface NodeDropSpec {
|
||||
max_items: number
|
||||
max_items?: number
|
||||
items: ItemDropSpec[]
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
Blocks = Blocks or ({})
|
||||
do
|
||||
local sounds = Sounds
|
||||
local pickaxe = Tools.Pickaxe
|
||||
minetest.register_node(
|
||||
":stone",
|
||||
{
|
||||
@ -8,7 +9,13 @@ do
|
||||
tiles = {"default_stone.png"},
|
||||
sounds = sounds.stone(),
|
||||
groups = {stone = 1},
|
||||
drop = "cobblestone"
|
||||
drop = {items = {{tool_groups = {
|
||||
pickaxe.A,
|
||||
pickaxe.B,
|
||||
pickaxe.C,
|
||||
pickaxe.D,
|
||||
pickaxe.E
|
||||
}, items = {"stone"}}}}
|
||||
}
|
||||
)
|
||||
minetest.register_node(
|
||||
|
@ -1,5 +1,6 @@
|
||||
namespace Blocks {
|
||||
const sounds = Sounds;
|
||||
const pickaxe = Tools.Pickaxe;
|
||||
|
||||
minetest.register_node(":stone", {
|
||||
drawtype: Drawtype.normal,
|
||||
@ -8,7 +9,21 @@ namespace Blocks {
|
||||
groups: {
|
||||
stone: 1
|
||||
},
|
||||
drop: "cobblestone"
|
||||
|
||||
drop: {
|
||||
items: [
|
||||
{
|
||||
tool_groups: [
|
||||
pickaxe.A,
|
||||
pickaxe.B,
|
||||
pickaxe.C,
|
||||
pickaxe.D,
|
||||
pickaxe.E
|
||||
],
|
||||
items: ["stone"]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":cobblestone", {
|
||||
|
@ -1,4 +1 @@
|
||||
Testing = Testing or ({})
|
||||
do
|
||||
minetest.register_tool(":pickaxe", {inventory_image = "default_tool_stonepick.png", tool_capabilities = {full_punch_interval = 0.5, max_drop_level = 1, groupcaps = {stone = {times = {[1] = 1}, maxlevel = 1, maxdrop = 0}}}})
|
||||
end
|
||||
|
@ -2,20 +2,4 @@ namespace Testing {
|
||||
// minetest.register_globalstep((delta: number) => {
|
||||
// print(`globalstep is: ${delta}`)
|
||||
// })
|
||||
minetest.register_tool(":pickaxe", {
|
||||
inventory_image: "default_tool_stonepick.png",
|
||||
tool_capabilities: {
|
||||
full_punch_interval: 0.5,
|
||||
max_drop_level: 1,
|
||||
groupcaps: {
|
||||
stone: {
|
||||
times: {
|
||||
1: 1.0
|
||||
},
|
||||
maxlevel: 1,
|
||||
maxdrop: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
10
mods/tools/init.lua
Normal file
10
mods/tools/init.lua
Normal file
@ -0,0 +1,10 @@
|
||||
Tools = Tools or ({})
|
||||
do
|
||||
Tools.Pickaxe = Pickaxe or ({})
|
||||
Tools.Pickaxe.A = "pickaxe_1"
|
||||
Tools.Pickaxe.B = "pickaxe_2"
|
||||
Tools.Pickaxe.C = "pickaxe_3"
|
||||
Tools.Pickaxe.D = "pickaxe_4"
|
||||
Tools.Pickaxe.E = "pickaxe_5"
|
||||
minetest.register_tool(":pickaxe", {inventory_image = "default_tool_stonepick.png", tool_capabilities = {full_punch_interval = 0.5, max_drop_level = 1, groupcaps = {stone = {times = {[1] = 1}, maxlevel = 1, maxdrop = 0}}}, groups = {[Tools.Pickaxe.A] = 1}})
|
||||
end
|
30
mods/tools/init.ts
Normal file
30
mods/tools/init.ts
Normal file
@ -0,0 +1,30 @@
|
||||
namespace Tools {
|
||||
// Alphabetical ordering, A = 1, B = 2, etc
|
||||
export enum Pickaxe {
|
||||
A = "pickaxe_1",
|
||||
B = "pickaxe_2",
|
||||
C = "pickaxe_3",
|
||||
D = "pickaxe_4",
|
||||
E = "pickaxe_5"
|
||||
}
|
||||
|
||||
minetest.register_tool(":pickaxe", {
|
||||
inventory_image: "default_tool_stonepick.png",
|
||||
tool_capabilities: {
|
||||
full_punch_interval: 0.5,
|
||||
max_drop_level: 1,
|
||||
groupcaps: {
|
||||
stone: {
|
||||
times: {
|
||||
1: 1.0
|
||||
},
|
||||
maxlevel: 1,
|
||||
maxdrop: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
groups: {
|
||||
[Pickaxe.A]: 1
|
||||
}
|
||||
})
|
||||
}
|
4
mods/tools/mod.conf
Normal file
4
mods/tools/mod.conf
Normal file
@ -0,0 +1,4 @@
|
||||
name = tools
|
||||
description = Forgotten Lands tools library.
|
||||
depends = sounds, utility
|
||||
optional_depends =
|
Loading…
x
Reference in New Issue
Block a user