Added the Limiter buff for all tool types
parent
cc3404739c
commit
273a81818e
|
@ -1,5 +1,5 @@
|
||||||
-- runes mod for Minetest
|
-- runes mod for Minetest
|
||||||
-- Copyright © 2020 Alex Yst <mailto:copyright@y.st>
|
-- Copyright © 2020-2021 Alex Yst <mailto:copyright@y.st>
|
||||||
|
|
||||||
-- This program is free software; you can redistribute it and/or
|
-- This program is free software; you can redistribute it and/or
|
||||||
-- modify it under the terms of the GNU Lesser General Public
|
-- modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -24,20 +24,20 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
axe = {
|
axe = {
|
||||||
sand = "toter",
|
sand = "soulbound",
|
||||||
coal_lump = "toter",
|
coal_lump = "lumberjack",
|
||||||
iron_lump = "toter",
|
iron_lump = "toter",
|
||||||
sapling = "lumberjack",
|
sapling = "lumberjack",
|
||||||
mese_crystal = "durable",
|
mese_crystal = "durable",
|
||||||
copper_lump = "toter",
|
copper_lump = "rapid",
|
||||||
diamond = "durable",
|
diamond = "durable",
|
||||||
gold_lump = "toter",
|
gold_lump = "limiter",
|
||||||
junglesapling = "lumberjack",
|
junglesapling = "lumberjack",
|
||||||
seed_cotton = "rapid",
|
seed_cotton = "rapid",
|
||||||
seed_wheat = "rapid",
|
seed_wheat = "rapid",
|
||||||
string = "rapid",
|
string = "rapid",
|
||||||
wheat = "rapid",
|
wheat = "limiter",
|
||||||
cotton = "rapid",
|
cotton = "limiter",
|
||||||
pine_sapling = "lumberjack",
|
pine_sapling = "lumberjack",
|
||||||
acacia_sapling = "lumberjack",
|
acacia_sapling = "lumberjack",
|
||||||
mushroom_brown = "toter",
|
mushroom_brown = "toter",
|
||||||
|
@ -46,25 +46,25 @@ return {
|
||||||
mushroom_spores_red = "soulbound",
|
mushroom_spores_red = "soulbound",
|
||||||
aspen_sapling = "lumberjack",
|
aspen_sapling = "lumberjack",
|
||||||
flint = "lumberjack",
|
flint = "lumberjack",
|
||||||
coral_skeleton = "toter",
|
coral_skeleton = "soulbound",
|
||||||
acacia_bush_sapling = "termite",
|
acacia_bush_sapling = "termite",
|
||||||
bush_sapling = "termite",
|
bush_sapling = "termite",
|
||||||
tin_lump = "toter",
|
tin_lump = "rapid",
|
||||||
blueberries = "soulbound",
|
blueberries = "soulbound",
|
||||||
blueberry_bush_sapling = "lumberjack",
|
blueberry_bush_sapling = "lumberjack",
|
||||||
ice = "toter",
|
ice = "limiter",
|
||||||
pine_bush_sapling = "termite",
|
pine_bush_sapling = "termite",
|
||||||
dry_dirt = "toter",
|
dry_dirt = "limiter",
|
||||||
},
|
},
|
||||||
fire_starter = {
|
fire_starter = {
|
||||||
sand = "soulbound",
|
sand = "soulbound",
|
||||||
coal_lump = "soulbound",
|
coal_lump = "limiter",
|
||||||
iron_lump = "soulbound",
|
iron_lump = "limiter",
|
||||||
sapling = "gardener",
|
sapling = "gardener",
|
||||||
mese_crystal = "durable",
|
mese_crystal = "durable",
|
||||||
copper_lump = "soulbound",
|
copper_lump = "limiter",
|
||||||
diamond = "durable",
|
diamond = "durable",
|
||||||
gold_lump = "soulbound",
|
gold_lump = "limiter",
|
||||||
junglesapling = "gardener",
|
junglesapling = "gardener",
|
||||||
seed_cotton = "gardener",
|
seed_cotton = "gardener",
|
||||||
seed_wheat = "gardener",
|
seed_wheat = "gardener",
|
||||||
|
@ -73,29 +73,29 @@ return {
|
||||||
cotton = "soulbound",
|
cotton = "soulbound",
|
||||||
pine_sapling = "gardener",
|
pine_sapling = "gardener",
|
||||||
acacia_sapling = "gardener",
|
acacia_sapling = "gardener",
|
||||||
mushroom_brown = "soulbound",
|
mushroom_brown = "limiter",
|
||||||
mushroom_red = "soulbound",
|
mushroom_red = "limiter",
|
||||||
mushroom_spores_brown = "gardener",
|
mushroom_spores_brown = "limiter",
|
||||||
mushroom_spores_red = "gardener",
|
mushroom_spores_red = "limiter",
|
||||||
aspen_sapling = "gardener",
|
aspen_sapling = "gardener",
|
||||||
flint = "soulbound",
|
flint = "limiter",
|
||||||
coral_skeleton = "soulbound",
|
coral_skeleton = "soulbound",
|
||||||
acacia_bush_sapling = "gardener",
|
acacia_bush_sapling = "gardener",
|
||||||
bush_sapling = "gardener",
|
bush_sapling = "gardener",
|
||||||
tin_lump = "soulbound",
|
tin_lump = "limiter",
|
||||||
blueberries = "soulbound",
|
blueberries = "soulbound",
|
||||||
blueberry_bush_sapling = "gardener",
|
blueberry_bush_sapling = "gardener",
|
||||||
ice = "soulbound",
|
ice = "soulbound",
|
||||||
pine_bush_sapling = "gardener",
|
pine_bush_sapling = "gardener",
|
||||||
dry_dirt = "soulbound",
|
dry_dirt = "gardener",
|
||||||
},
|
},
|
||||||
pick = {
|
pick = {
|
||||||
sand = "rapid",
|
sand = "soulbound",
|
||||||
coal_lump = "rapid",
|
coal_lump = "rapid",
|
||||||
iron_lump = "rapid",
|
iron_lump = "cobbleeater",
|
||||||
sapling = "rapid",
|
sapling = "rapid",
|
||||||
mese_crystal = "durable",
|
mese_crystal = "durable",
|
||||||
copper_lump = "rapid",
|
copper_lump = "cobbleeater",
|
||||||
diamond = "durable",
|
diamond = "durable",
|
||||||
gold_lump = "rapid",
|
gold_lump = "rapid",
|
||||||
junglesapling = "rapid",
|
junglesapling = "rapid",
|
||||||
|
@ -111,26 +111,26 @@ return {
|
||||||
mushroom_spores_brown = "soulbound",
|
mushroom_spores_brown = "soulbound",
|
||||||
mushroom_spores_red = "soulbound",
|
mushroom_spores_red = "soulbound",
|
||||||
aspen_sapling = "rapid",
|
aspen_sapling = "rapid",
|
||||||
flint = "rapid",
|
flint = "limiter",
|
||||||
coral_skeleton = "rapid",
|
coral_skeleton = "limiter",
|
||||||
acacia_bush_sapling = "rapid",
|
acacia_bush_sapling = "limiter",
|
||||||
bush_sapling = "rapid",
|
bush_sapling = "limiter",
|
||||||
tin_lump = "rapid",
|
tin_lump = "cobbleeater",
|
||||||
blueberries = "soulbound",
|
blueberries = "limiter",
|
||||||
blueberry_bush_sapling = "rapid",
|
blueberry_bush_sapling = "limiter",
|
||||||
ice = "rapid",
|
ice = "limiter",
|
||||||
pine_bush_sapling = "rapid",
|
pine_bush_sapling = "limiter",
|
||||||
dry_dirt = "rapid",
|
dry_dirt = "rapid",
|
||||||
},
|
},
|
||||||
hoe = {
|
hoe = {
|
||||||
sand = "soulbound",
|
sand = "soulbound",
|
||||||
coal_lump = "soulbound",
|
coal_lump = "spreader",
|
||||||
iron_lump = "soulbound",
|
iron_lump = "breaker",
|
||||||
sapling = "breaker",
|
sapling = "breaker",
|
||||||
mese_crystal = "durable",
|
mese_crystal = "durable",
|
||||||
copper_lump = "soulbound",
|
copper_lump = "breaker",
|
||||||
diamond = "durable",
|
diamond = "durable",
|
||||||
gold_lump = "soulbound",
|
gold_lump = "breaker",
|
||||||
junglesapling = "breaker",
|
junglesapling = "breaker",
|
||||||
seed_cotton = "soulbound",
|
seed_cotton = "soulbound",
|
||||||
seed_wheat = "soulbound",
|
seed_wheat = "soulbound",
|
||||||
|
@ -148,22 +148,22 @@ return {
|
||||||
coral_skeleton = "soulbound",
|
coral_skeleton = "soulbound",
|
||||||
acacia_bush_sapling = "mosser",
|
acacia_bush_sapling = "mosser",
|
||||||
bush_sapling = "mosser",
|
bush_sapling = "mosser",
|
||||||
tin_lump = "soulbound",
|
tin_lump = "breaker",
|
||||||
blueberries = "soulbound",
|
blueberries = "limiter",
|
||||||
blueberry_bush_sapling = "soulbound",
|
blueberry_bush_sapling = "limiter",
|
||||||
ice = "soulbound",
|
ice = "breaker",
|
||||||
pine_bush_sapling = "mosser",
|
pine_bush_sapling = "mosser",
|
||||||
dry_dirt = "soulbound",
|
dry_dirt = "spreader",
|
||||||
},
|
},
|
||||||
screwdriver = {
|
screwdriver = {
|
||||||
sand = "adjuster",
|
sand = "adjuster",
|
||||||
coal_lump = "soulbound",
|
coal_lump = "limiter",
|
||||||
iron_lump = "soulbound",
|
iron_lump = "limiter",
|
||||||
sapling = "adjuster",
|
sapling = "adjuster",
|
||||||
mese_crystal = "durable",
|
mese_crystal = "durable",
|
||||||
copper_lump = "soulbound",
|
copper_lump = "limiter",
|
||||||
diamond = "durable",
|
diamond = "durable",
|
||||||
gold_lump = "soulbound",
|
gold_lump = "limiter",
|
||||||
junglesapling = "adjuster",
|
junglesapling = "adjuster",
|
||||||
seed_cotton = "soulbound",
|
seed_cotton = "soulbound",
|
||||||
seed_wheat = "soulbound",
|
seed_wheat = "soulbound",
|
||||||
|
@ -172,16 +172,16 @@ return {
|
||||||
cotton = "soulbound",
|
cotton = "soulbound",
|
||||||
pine_sapling = "adjuster",
|
pine_sapling = "adjuster",
|
||||||
acacia_sapling = "adjuster",
|
acacia_sapling = "adjuster",
|
||||||
mushroom_brown = "soulbound",
|
mushroom_brown = "limiter",
|
||||||
mushroom_red = "soulbound",
|
mushroom_red = "limiter",
|
||||||
mushroom_spores_brown = "soulbound",
|
mushroom_spores_brown = "limiter",
|
||||||
mushroom_spores_red = "soulbound",
|
mushroom_spores_red = "limiter",
|
||||||
aspen_sapling = "adjuster",
|
aspen_sapling = "adjuster",
|
||||||
flint = "soulbound",
|
flint = "soulbound",
|
||||||
coral_skeleton = "soulbound",
|
coral_skeleton = "soulbound",
|
||||||
acacia_bush_sapling = "adjuster",
|
acacia_bush_sapling = "adjuster",
|
||||||
bush_sapling = "adjuster",
|
bush_sapling = "adjuster",
|
||||||
tin_lump = "soulbound",
|
tin_lump = "limiter",
|
||||||
blueberries = "soulbound",
|
blueberries = "soulbound",
|
||||||
blueberry_bush_sapling = "adjuster",
|
blueberry_bush_sapling = "adjuster",
|
||||||
ice = "soulbound",
|
ice = "soulbound",
|
||||||
|
@ -189,7 +189,7 @@ return {
|
||||||
dry_dirt = "soulbound",
|
dry_dirt = "soulbound",
|
||||||
},
|
},
|
||||||
shovel = {
|
shovel = {
|
||||||
sand = "rapid",
|
sand = "soulbound",
|
||||||
coal_lump = "rapid",
|
coal_lump = "rapid",
|
||||||
iron_lump = "rapid",
|
iron_lump = "rapid",
|
||||||
sapling = "thirst",
|
sapling = "thirst",
|
||||||
|
@ -205,24 +205,24 @@ return {
|
||||||
cotton = "rapid",
|
cotton = "rapid",
|
||||||
pine_sapling = "thirst",
|
pine_sapling = "thirst",
|
||||||
acacia_sapling = "thirst",
|
acacia_sapling = "thirst",
|
||||||
mushroom_brown = "soulbound",
|
mushroom_brown = "limiter",
|
||||||
mushroom_red = "soulbound",
|
mushroom_red = "soulbound",
|
||||||
mushroom_spores_brown = "soulbound",
|
mushroom_spores_brown = "limiter",
|
||||||
mushroom_spores_red = "soulbound",
|
mushroom_spores_red = "soulbound",
|
||||||
aspen_sapling = "thirst",
|
aspen_sapling = "thirst",
|
||||||
flint = "thirst",
|
flint = "thirst",
|
||||||
coral_skeleton = "rapid",
|
coral_skeleton = "limiter",
|
||||||
acacia_bush_sapling = "thirst",
|
acacia_bush_sapling = "thirst",
|
||||||
bush_sapling = "thirst",
|
bush_sapling = "thirst",
|
||||||
tin_lump = "rapid",
|
tin_lump = "rapid",
|
||||||
blueberries = "transplanter",
|
blueberries = "transplanter",
|
||||||
blueberry_bush_sapling = "thirst",
|
blueberry_bush_sapling = "thirst",
|
||||||
ice = "rapid",
|
ice = "limiter",
|
||||||
pine_bush_sapling = "thirst",
|
pine_bush_sapling = "thirst",
|
||||||
dry_dirt = "rapid",
|
dry_dirt = "transplanter",
|
||||||
},
|
},
|
||||||
sword = {
|
sword = {
|
||||||
sand = "rapid",
|
sand = "soulbound",
|
||||||
coal_lump = "rapid",
|
coal_lump = "rapid",
|
||||||
iron_lump = "rapid",
|
iron_lump = "rapid",
|
||||||
sapling = "thirst",
|
sapling = "thirst",
|
||||||
|
@ -238,20 +238,20 @@ return {
|
||||||
cotton = "rapid",
|
cotton = "rapid",
|
||||||
pine_sapling = "thirst",
|
pine_sapling = "thirst",
|
||||||
acacia_sapling = "thirst",
|
acacia_sapling = "thirst",
|
||||||
mushroom_brown = "pruner",
|
mushroom_brown = "limiter",
|
||||||
mushroom_red = "pruner",
|
mushroom_red = "pruner",
|
||||||
mushroom_spores_brown = "pruner",
|
mushroom_spores_brown = "limiter",
|
||||||
mushroom_spores_red = "pruner",
|
mushroom_spores_red = "pruner",
|
||||||
aspen_sapling = "thirst",
|
aspen_sapling = "thirst",
|
||||||
flint = "thirst",
|
flint = "thirst",
|
||||||
coral_skeleton = "rapid",
|
coral_skeleton = "pruner",
|
||||||
acacia_bush_sapling = "thirst",
|
acacia_bush_sapling = "thirst",
|
||||||
bush_sapling = "thirst",
|
bush_sapling = "thirst",
|
||||||
tin_lump = "rapid",
|
tin_lump = "rapid",
|
||||||
blueberries = "soulbound",
|
blueberries = "soulbound",
|
||||||
blueberry_bush_sapling = "thirst",
|
blueberry_bush_sapling = "thirst",
|
||||||
ice = "rapid",
|
ice = "pruner",
|
||||||
pine_bush_sapling = "thirst",
|
pine_bush_sapling = "thirst",
|
||||||
dry_dirt = "rapid",
|
dry_dirt = "pruner",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
-- runes mod for Minetest
|
||||||
|
-- Copyright © 2021 Alex Yst <mailto:copyright@y.st>
|
||||||
|
|
||||||
|
-- This program is free software; you can redistribute it and/or
|
||||||
|
-- modify it under the terms of the GNU Lesser General Public
|
||||||
|
-- License as published by the Free Software Foundation; either
|
||||||
|
-- version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
-- This software is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
-- Lesser General Public License for more details.
|
||||||
|
|
||||||
|
-- You should have received a copy of the GNU Lesser General Public
|
||||||
|
-- License along with this program. If not, see
|
||||||
|
-- <https://www.gnu.org./licenses/>.
|
||||||
|
|
||||||
|
local is_protected = minetest.is_protected
|
||||||
|
|
||||||
|
function minetest.is_protected(pos, name)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
-- minetest.is_protected() can be called with an empty string for a
|
||||||
|
-- player name, and if that happens, I think
|
||||||
|
-- minetest.get_player_by_name() probably wouldn't return a player
|
||||||
|
-- object. Likewise, I think a player object might not be returned if
|
||||||
|
-- the player the protection check is performed on isn't logged in.
|
||||||
|
-- Just to be sure, let's check to see if a player object is even
|
||||||
|
-- returned before trying to call one of its methods.
|
||||||
|
if player then
|
||||||
|
local tool = player:get_wielded_item()
|
||||||
|
if tool:get_wear() > 61440 and tool:get_name():sub(1, 6) == "runes:" then
|
||||||
|
if tool:get_meta():get("limiter") then
|
||||||
|
minetest.chat_send_player(name, "Your tool is too damaged to use without risking breaking it.")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return is_protected(pos, name)
|
||||||
|
end
|
|
@ -1,37 +0,0 @@
|
||||||
minetest.register_chatcommand("updatetool", {
|
|
||||||
description = "Fix a shovel or sword that has the debug buff.",
|
|
||||||
func = function(name, arg)
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local tool = player:get_wielded_item()
|
|
||||||
local tool_type = tool:get_name()
|
|
||||||
local meta = tool:get_meta()
|
|
||||||
-- Currently, a feature in the stable version but not the development
|
|
||||||
-- version of Minetest prevents setting the value to integer zero from
|
|
||||||
-- working correctly, but setting to string zero should work just fine.
|
|
||||||
local debug_level = tonumber(meta:get_string("debug"))
|
|
||||||
if debug_level then
|
|
||||||
if tool_type == "runes:shovel" then
|
|
||||||
meta:set_string("thirst", debug_level)
|
|
||||||
meta:set_string("debug") -- set to nil to remove key/value pair
|
|
||||||
local description = minetest.registered_tools["runes:shovel"].description.."\nRepair count: "..meta:get_int("repair").."\nThirst ("..debug_level..")"
|
|
||||||
meta:set_string("description", description)
|
|
||||||
player:set_wielded_item(tool)
|
|
||||||
elseif tool_type == "runes:sword" then
|
|
||||||
local thirst = math.ceil((debug_level - 1) / 2)
|
|
||||||
local pruner = math.floor((debug_level - 1) / 2)
|
|
||||||
local description = minetest.registered_tools["runes:shovel"].description.."\nRepair count: "..meta:get_int("repair")
|
|
||||||
if thirst > -1 then
|
|
||||||
meta:set_string("thirst", thirst)
|
|
||||||
description = description.."\nThirst ("..thirst..")"
|
|
||||||
end
|
|
||||||
if pruner > -1 then
|
|
||||||
meta:set_string("pruner", pruner)
|
|
||||||
description = description.."\nPruner ("..pruner..")"
|
|
||||||
end
|
|
||||||
meta:set_string("debug") -- set to nil to remove key/value pair
|
|
||||||
meta:set_string("description", description)
|
|
||||||
player:set_wielded_item(tool)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -18,7 +18,7 @@
|
||||||
dofile(minetest.get_modpath("runes").."/runes.lua")
|
dofile(minetest.get_modpath("runes").."/runes.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/tools.lua")
|
dofile(minetest.get_modpath("runes").."/tools.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/tool_crafting.lua")
|
dofile(minetest.get_modpath("runes").."/tool_crafting.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/buffs/toter.lua")
|
dofile(minetest.get_modpath("runes").."/buffs/limiter.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/buffs/lumberjack.lua")
|
dofile(minetest.get_modpath("runes").."/buffs/lumberjack.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/buffs/soulbound.lua")
|
dofile(minetest.get_modpath("runes").."/buffs/soulbound.lua")
|
||||||
dofile(minetest.get_modpath("runes").."/debug.lua")
|
dofile(minetest.get_modpath("runes").."/buffs/toter.lua")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- runes mod for Minetest
|
-- runes mod for Minetest
|
||||||
-- Copyright © 2020 Alex Yst <mailto:copyright@y.st>
|
-- Copyright © 2020-2021 Alex Yst <mailto:copyright@y.st>
|
||||||
|
|
||||||
-- This program is free software; you can redistribute it and/or
|
-- This program is free software; you can redistribute it and/or
|
||||||
-- modify it under the terms of the GNU Lesser General Public
|
-- modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -47,22 +47,23 @@ local S = minetest.get_translator("runes")
|
||||||
local rune_and_tool_to_buff = dofile(minetest.get_modpath("runes").."/buff_table.lua")
|
local rune_and_tool_to_buff = dofile(minetest.get_modpath("runes").."/buff_table.lua")
|
||||||
|
|
||||||
local buff_name = {
|
local buff_name = {
|
||||||
debug = S("Debug Buff"),
|
|
||||||
thirst = S("Level Thirst"),
|
|
||||||
pruner = S("Pruner"),
|
|
||||||
spreader = S("Spreader"),
|
|
||||||
durable = S("Durable"),
|
|
||||||
rapid = S("Rapid Digger"),
|
|
||||||
toter = S("Toter"),
|
|
||||||
transplanter = S("Transplanter"),
|
|
||||||
lumberjack = S("Lumberjack"),
|
|
||||||
termite = S("Termite"),
|
|
||||||
cobbleeater = S("Cobble Eater"),
|
|
||||||
soulbound = S("Soulbound"),
|
|
||||||
adjuster = S("Kelp Adjuster"),
|
adjuster = S("Kelp Adjuster"),
|
||||||
breaker = S("Breaker"),
|
breaker = S("Breaker"),
|
||||||
mosser = S("Mosser"),
|
cobbleeater = S("Cobble Eater"),
|
||||||
|
debug = S("Debug Buff"),
|
||||||
|
durable = S("Durable"),
|
||||||
gardener = S("Gardener"),
|
gardener = S("Gardener"),
|
||||||
|
limiter = S("Limiter"),
|
||||||
|
lumberjack = S("Lumberjack"),
|
||||||
|
mosser = S("Mosser"),
|
||||||
|
pruner = S("Pruner"),
|
||||||
|
rapid = S("Rapid Digger"),
|
||||||
|
soulbound = S("Soulbound"),
|
||||||
|
spreader = S("Spreader"),
|
||||||
|
termite = S("Termite"),
|
||||||
|
thirst = S("Level Thirst"),
|
||||||
|
toter = S("Toter"),
|
||||||
|
transplanter = S("Transplanter"),
|
||||||
}
|
}
|
||||||
|
|
||||||
local rune_element_modname = {
|
local rune_element_modname = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- runes mod for Minetest
|
-- runes mod for Minetest
|
||||||
-- Copyright © 2020 Alex Yst <mailto:copyright@y.st>
|
-- Copyright © 2020-2021 Alex Yst <mailto:copyright@y.st>
|
||||||
|
|
||||||
-- This program is free software; you can redistribute it and/or
|
-- This program is free software; you can redistribute it and/or
|
||||||
-- modify it under the terms of the GNU Lesser General Public
|
-- modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -239,16 +239,19 @@ minetest.register_tool("runes:sword", {
|
||||||
y = pointed_thing.under.y + prunable_trunk[potential_log.name].range,
|
y = pointed_thing.under.y + prunable_trunk[potential_log.name].range,
|
||||||
z = pointed_thing.under.z + prunable_trunk[potential_log.name].range,
|
z = pointed_thing.under.z + prunable_trunk[potential_log.name].range,
|
||||||
}, prunable_trunk[potential_log.name].leaves)
|
}, prunable_trunk[potential_log.name].leaves)
|
||||||
|
local player_name = user:get_player_name()
|
||||||
for _, pos in next, to_prune do
|
for _, pos in next, to_prune do
|
||||||
local node = minetest.get_node(pos)
|
if not minetest.is_protected(pos, player_name) then
|
||||||
minetest.node_dig(pos, node, user)
|
local node = minetest.get_node(pos)
|
||||||
-- Apple marks are dealt with separately because minetest.node_dig()
|
minetest.node_dig(pos, node, user)
|
||||||
-- doesn't work on them. It's probably because players can't normally
|
-- Apple marks are dealt with separately because minetest.node_dig()
|
||||||
-- dig them. We also assume that apples have left behind apple marks
|
-- doesn't work on them. It's probably because players can't normally
|
||||||
-- and remove those as well.
|
-- dig them. We also assume that apples have left behind apple marks
|
||||||
if node.name == "default:apple_mark"
|
-- and remove those as well.
|
||||||
or node.name == "default:apple" then
|
if node.name == "default:apple_mark"
|
||||||
minetest.remove_node(pos)
|
or node.name == "default:apple" then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- This seems a bit unclean, but I'm not sure how else to handle the
|
-- This seems a bit unclean, but I'm not sure how else to handle the
|
||||||
|
@ -341,48 +344,52 @@ minetest.register_tool("runes:screwdriver", {
|
||||||
wield_overlay = "runes.tool_stone_screwdriver.png",
|
wield_overlay = "runes.tool_stone_screwdriver.png",
|
||||||
groups = {tool = 1, disable_repair = 1},
|
groups = {tool = 1, disable_repair = 1},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local uses = 500
|
if not minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||||
local meta = itemstack:get_meta()
|
local uses = 500
|
||||||
if meta:get("durability") then
|
local meta = itemstack:get_meta()
|
||||||
uses = 750
|
if meta:get("durability") then
|
||||||
|
uses = 750
|
||||||
|
end
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if meta:get("adjuster")
|
||||||
|
and minetest.registered_nodes[node.name]
|
||||||
|
and minetest.registered_nodes[node.name].paramtype2 == "leveled"
|
||||||
|
and minetest.registered_nodes[node.name].drawtype == "plantlike_rooted" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {
|
||||||
|
name = node.name,
|
||||||
|
param1 = node.param1,
|
||||||
|
param2 = (node.param2 + 1) % 256,
|
||||||
|
})
|
||||||
|
itemstack:add_wear(math.floor(65536 / uses))
|
||||||
|
else
|
||||||
|
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, uses)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
|
||||||
if meta:get("adjuster")
|
|
||||||
and minetest.registered_nodes[node.name]
|
|
||||||
and minetest.registered_nodes[node.name].paramtype2 == "leveled"
|
|
||||||
and minetest.registered_nodes[node.name].drawtype == "plantlike_rooted" then
|
|
||||||
minetest.swap_node(pointed_thing.under, {
|
|
||||||
name = node.name,
|
|
||||||
param1 = node.param1,
|
|
||||||
param2 = (node.param2 + 1) % 256,
|
|
||||||
})
|
|
||||||
itemstack:add_wear(math.floor(65536 / uses))
|
|
||||||
else
|
|
||||||
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, uses)
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
end,
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
local uses = 500
|
if not minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||||
local meta = itemstack:get_meta()
|
local uses = 500
|
||||||
if itemstack:get_meta():get("durability") then
|
local meta = itemstack:get_meta()
|
||||||
uses = 750
|
if itemstack:get_meta():get("durability") then
|
||||||
|
uses = 750
|
||||||
|
end
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if meta:get("adjuster")
|
||||||
|
and minetest.registered_nodes[node.name]
|
||||||
|
and minetest.registered_nodes[node.name].paramtype2 == "leveled"
|
||||||
|
and minetest.registered_nodes[node.name].drawtype == "plantlike_rooted" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {
|
||||||
|
name = node.name,
|
||||||
|
param1 = node.param1,
|
||||||
|
param2 = (node.param2 - 1) % 256,
|
||||||
|
})
|
||||||
|
itemstack:add_wear(math.floor(65536 / uses))
|
||||||
|
else
|
||||||
|
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, uses)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
|
||||||
if meta:get("adjuster")
|
|
||||||
and minetest.registered_nodes[node.name]
|
|
||||||
and minetest.registered_nodes[node.name].paramtype2 == "leveled"
|
|
||||||
and minetest.registered_nodes[node.name].drawtype == "plantlike_rooted" then
|
|
||||||
minetest.swap_node(pointed_thing.under, {
|
|
||||||
name = node.name,
|
|
||||||
param1 = node.param1,
|
|
||||||
param2 = (node.param2 - 1) % 256,
|
|
||||||
})
|
|
||||||
itemstack:add_wear(math.floor(65536 / uses))
|
|
||||||
else
|
|
||||||
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, uses)
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue