Add Rapid Dig buff
parent
61cb8cb14d
commit
e66118b08a
Binary file not shown.
After Width: | Height: | Size: 291 KiB |
|
@ -23,36 +23,36 @@
|
|||
-- around and each buff will be granted by several runes.
|
||||
return {
|
||||
sand = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
coal_lump = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
iron_lump = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
|
@ -68,9 +68,9 @@ return {
|
|||
sword = "durability",
|
||||
},
|
||||
copper_lump = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
|
@ -86,216 +86,216 @@ return {
|
|||
sword = "durability",
|
||||
},
|
||||
gold_lump = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
junglesapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
seed_cotton = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
shovel = "rapid",
|
||||
sword = "rapid",
|
||||
},
|
||||
seed_wheat = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
shovel = "rapid",
|
||||
sword = "rapid",
|
||||
},
|
||||
string = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
shovel = "rapid",
|
||||
sword = "rapid",
|
||||
},
|
||||
wheat = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
shovel = "rapid",
|
||||
sword = "rapid",
|
||||
},
|
||||
cotton = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
shovel = "rapid",
|
||||
sword = "rapid",
|
||||
},
|
||||
pine_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
acacia_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
mushroom_brown = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
mushroom_red = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
mushroom_spores_brown = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
mushroom_spores_red = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
aspen_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
flint = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
coral_skeleton = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
acacia_bush_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
bush_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
tin_lump = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
blueberries = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
blueberry_bush_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
ice = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
sword = "pruner",
|
||||
},
|
||||
pine_bush_sapling = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "thirst",
|
||||
sword = "thirst",
|
||||
},
|
||||
dry_dirt = {
|
||||
axe = "debug",
|
||||
axe = "rapid",
|
||||
fire_starter = "debug",
|
||||
pick = "debug",
|
||||
pick = "rapid",
|
||||
hoe = "debug",
|
||||
screwdriver = "debug",
|
||||
shovel = "spreader",
|
||||
|
|
|
@ -52,6 +52,7 @@ local buff_name = {
|
|||
pruner = S("Pruner"),
|
||||
spreader = S("Spreader"),
|
||||
durability = S("Durability"),
|
||||
rapid = S("Rapid Dig"),
|
||||
}
|
||||
|
||||
local rune_element_modname = {
|
||||
|
@ -153,15 +154,24 @@ local function generate_tool(tool_name, player_name, runes)
|
|||
end
|
||||
end
|
||||
meta:set_string("description", description)
|
||||
local overwrite = false
|
||||
if buffs.durability then
|
||||
-- The durability buff and rapid-digging buff need to make changes to
|
||||
-- the tool capabilities.
|
||||
if buffs.durability or buffs.rapid then
|
||||
local overwrite = false
|
||||
local caps = tool:get_tool_capabilities()
|
||||
for _, group in next, caps.groupcaps do
|
||||
group.uses = group.uses * 1.5
|
||||
if buffs.durability then
|
||||
group.uses = group.uses * 1.5
|
||||
end
|
||||
if buffs.rapid then
|
||||
for key, value in next, group.times do
|
||||
group.times[key] = value / 2
|
||||
end
|
||||
end
|
||||
overwrite = true
|
||||
end
|
||||
if overwrite then
|
||||
tool:set_tool_capabilities(caps)
|
||||
meta:set_tool_capabilities(caps)
|
||||
end
|
||||
end
|
||||
return tool
|
||||
|
@ -295,6 +305,8 @@ local function calculate_craft_result(itemstack, player, old_craft_grid, craft_i
|
|||
local repair_count = meta0:get_int("repair") + meta1:get_int("repair") + 1
|
||||
meta:set_int("repair", repair_count)
|
||||
local description = minetest.registered_tools[tool_type].description.."\nRepair count: "..repair_count
|
||||
local buff_durability = false
|
||||
local buff_rapid = false
|
||||
-- Merge the buffs, then wear them by subtracting one from each. If any
|
||||
-- buff drops below zero, remove it. Otherwise, add it to the repaired
|
||||
-- tool.
|
||||
|
@ -314,9 +326,19 @@ local function calculate_craft_result(itemstack, player, old_craft_grid, craft_i
|
|||
local strength = -2
|
||||
if meta0:get(buff) then
|
||||
strength = strength + 1 + meta0:get_int(buff)
|
||||
if buff == "durability" then
|
||||
buf_durability = true
|
||||
elseif buff == "rapid" then
|
||||
buff_rapid = true
|
||||
end
|
||||
end
|
||||
if meta1:get(buff) then
|
||||
strength = strength + 1 + meta1:get_int(buff)
|
||||
if buff == "durability" then
|
||||
buf_durability = true
|
||||
elseif buff == "rapid" then
|
||||
buff_rapid = true
|
||||
end
|
||||
end
|
||||
if strength > -1 then
|
||||
-- Currently, a feature in the stable version but not the development
|
||||
|
@ -328,6 +350,26 @@ local function calculate_craft_result(itemstack, player, old_craft_grid, craft_i
|
|||
end
|
||||
end
|
||||
meta:set_string("description", description)
|
||||
-- The durability buff and rapid-digging buff need to make changes to
|
||||
-- the tool capabilities.
|
||||
if buffs_durability or buffs_rapid then
|
||||
local overwrite = false
|
||||
local caps = tool:get_tool_capabilities()
|
||||
for _, group in next, caps.groupcaps do
|
||||
if buffs_durability then
|
||||
group.uses = group.uses * 1.5
|
||||
end
|
||||
if buffs_rapid then
|
||||
for key, value in next, group.times do
|
||||
group.times[key] = value / 2
|
||||
end
|
||||
end
|
||||
overwrite = true
|
||||
end
|
||||
if overwrite then
|
||||
meta:set_tool_capabilities(caps)
|
||||
end
|
||||
end
|
||||
-- Provide the crafting result.
|
||||
return tool
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue