mods - toolranks - removed cos it not necesary and overload simplification
* also fixed wrong reference to 3d_armor
This commit is contained in:
parent
875ba2653f
commit
33d68fa60b
@ -49,9 +49,6 @@ To download you can play this game with the following minetest engines:
|
|||||||
* simple_skins as `skins` [mods/skins](mods/skins) from https://codeberg.org/minenux/minetest-mod-simple_skins
|
* simple_skins as `skins` [mods/skins](mods/skins) from https://codeberg.org/minenux/minetest-mod-simple_skins
|
||||||
* regrow as `regrow` [mods/regrow](mods/regrow) from https://codeberg.org/minenux/minetest-mod-regrow
|
* regrow as `regrow` [mods/regrow](mods/regrow) from https://codeberg.org/minenux/minetest-mod-regrow
|
||||||
* ethereal as `ethereal` [mods/ethereal](mods/ethereal) from https://codeberg.org/minenux/minetest-mod-ethereal
|
* ethereal as `ethereal` [mods/ethereal](mods/ethereal) from https://codeberg.org/minenux/minetest-mod-ethereal
|
||||||
* toolranks as `toolranks` [mods/toolranks](mods/toolranks) (reduced) from https://codeberg.org/minenux/minetest-mod-toolranks
|
|
||||||
* armors and stuff mods
|
|
||||||
* 3d_armor and shields [mods/3d_armor](mods/3d_armor) https://codeberg.org/minenux/minetest-mod-3d_armor
|
|
||||||
* player stuffs:
|
* player stuffs:
|
||||||
* minenux bags as `backpacks` [mods/backpacks](mods/backpacks)
|
* minenux bags as `backpacks` [mods/backpacks](mods/backpacks)
|
||||||
* NPXcoot
|
* NPXcoot
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
# Minetest tool ranks mod
|
|
||||||
|
|
||||||
Tool gains levels for digging nodes. Higher level take longer to wear out.
|
|
||||||
|
|
||||||
Information
|
|
||||||
------------
|
|
||||||
|
|
||||||
It adds improved information on the description label of the tools,
|
|
||||||
like how much was used the tool and how much is improved,
|
|
||||||
and also provides improved xperience over the tool as much you use it..
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
# Technical information
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
This mod is named `toolranks` this is same as minienux one but with reduced media.
|
|
||||||
its only used the default songs and defaults textures unless you override.
|
|
||||||
|
|
||||||
This ranktool is the tenplus1's version, featured custom values throught
|
|
||||||
configuration interface for dig speed, mutiplier and durability.
|
|
||||||
|
|
||||||
Shows information about the counts the nodes that spend the tool
|
|
||||||
|
|
||||||
Also provide interface to add toolrank support on other mods.
|
|
||||||
|
|
||||||
#### Dependencies
|
|
||||||
|
|
||||||
* default (now optional)
|
|
||||||
|
|
||||||
#### configuration
|
|
||||||
|
|
||||||
| Config item | type | def | values | Description |
|
|
||||||
| -------------------------- | ----- | ---- | ----------- | ----------------------------- |
|
|
||||||
| toolranks_levels | int | 8 | any int | Level (Number of tool levels) |
|
|
||||||
| toolranks_level_digs | int | 1000 | any int | Number of nodes that need to be dug to reach the next tool level |
|
|
||||||
| toolranks_speed_multiplier | float | 1.1 | 1.0 to 10.0 | Dig speed multiplier (at maximum tool level, 1.0 to disable) |
|
|
||||||
| toolranks_use_multiplier | float | 1.1 | 1.0 to 10.0 | Durability multiplier (at maximum tool level,1.0 to disable) |
|
|
||||||
|
|
||||||
#### mods toolrank support
|
|
||||||
|
|
||||||
The default mod of minetest game has default support in this mod,
|
|
||||||
but not farming hoes, many other mods already integrates toolrank support,
|
|
||||||
by example all the tenplus1's "redo"s mod already has support, others will need
|
|
||||||
extra mods like toolranks_extra due rejection from mod authors.
|
|
||||||
|
|
||||||
#### how to add support in mods
|
|
||||||
|
|
||||||
If so, to support this mod, add this code to your mod, after your tool's code:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
if minetest.get_modpath("toolranks") then
|
|
||||||
toolranks.add_tool("mymod:mytool")
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
Where `mymod` is the technical/namespace name of the mod and `mytool` the item name.
|
|
||||||
|
|
||||||
That function provides all that can be do by custom way also as:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
if minetest.get_modpath("toolranks") then
|
|
||||||
minetest.override_item("mymod:mytool", {
|
|
||||||
original_description = "My Tool",
|
|
||||||
description = toolranks.create_description("My Tool"),
|
|
||||||
after_use = toolranks.new_afteruse
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
## LICENSE
|
|
||||||
|
|
||||||
(c) 2017 lisacvuk
|
|
||||||
(c) 2017 tenplus1
|
|
||||||
(c) 2023 mckaygerhard
|
|
||||||
|
|
||||||
Code is LGPL v2.1
|
|
||||||
media is CC-BY
|
|
||||||
|
|
||||||
check [license.txt](license.txt)
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
default?
|
|
@ -1 +0,0 @@
|
|||||||
TOOL gains levels for digging nodes. Higher level take longer to wear out
|
|
@ -1,211 +0,0 @@
|
|||||||
local S
|
|
||||||
|
|
||||||
if minetest.get_translator ~= nil then
|
|
||||||
S = minetest.get_translator("toolranks") -- 5.x translation function
|
|
||||||
else
|
|
||||||
if minetest.get_modpath("intllib") then
|
|
||||||
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
|
||||||
if intllib.make_gettext_pair then
|
|
||||||
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
|
|
||||||
else
|
|
||||||
gettext = intllib.Getter() -- old text file method
|
|
||||||
end
|
|
||||||
S = gettext
|
|
||||||
else -- boilerplate function
|
|
||||||
S = function(str, ...)
|
|
||||||
local args = {...}
|
|
||||||
return str:gsub("@%d+", function(match)
|
|
||||||
return args[tonumber(match:sub(2))]
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
toolranks = {
|
|
||||||
|
|
||||||
colors = {
|
|
||||||
grey = minetest.get_color_escape_sequence("#9d9d9d"),
|
|
||||||
green = minetest.get_color_escape_sequence("#1eff00"),
|
|
||||||
gold = minetest.get_color_escape_sequence("#ffdf00"),
|
|
||||||
white = minetest.get_color_escape_sequence("#ffffff")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local max_speed = tonumber(minetest.settings:get("toolranks_speed_multiplier")) or 1.1--2.0
|
|
||||||
local max_use = tonumber(minetest.settings:get("toolranks_use_multiplier")) or 1.1
|
|
||||||
local max_level = tonumber(minetest.settings:get("toolranks_levels")) or 8
|
|
||||||
local level_digs = tonumber(minetest.settings:get("toolranks_level_digs")) or 1000
|
|
||||||
local level_multiplier = 1 / max_level
|
|
||||||
|
|
||||||
|
|
||||||
function toolranks.get_level(uses)
|
|
||||||
|
|
||||||
if type(uses) == "number" and uses > 0 then
|
|
||||||
return math.min(max_level, math.floor(uses / level_digs))
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function toolranks.create_description(name, uses)
|
|
||||||
|
|
||||||
local description = name
|
|
||||||
local newdesc = S(
|
|
||||||
"@1@2\n@3Level @4 @5\n@6@Node dug: @7",
|
|
||||||
toolranks.colors.green,
|
|
||||||
description,
|
|
||||||
toolranks.colors.gold,
|
|
||||||
toolranks.get_level(uses),
|
|
||||||
"", -- was tooltype
|
|
||||||
toolranks.colors.grey,
|
|
||||||
(type(uses) == "number" and uses or 0)
|
|
||||||
)
|
|
||||||
|
|
||||||
return newdesc
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function toolranks.new_afteruse(itemstack, user, node, digparams)
|
|
||||||
|
|
||||||
local pname = user:get_player_name()
|
|
||||||
|
|
||||||
if not pname then return itemstack end -- player nil check
|
|
||||||
|
|
||||||
local itemmeta = itemstack:get_meta()
|
|
||||||
local dugnodes = tonumber(itemmeta:get_string("dug")) or 0
|
|
||||||
|
|
||||||
if digparams.wear > 0 then -- Only count nodes that spend the tool
|
|
||||||
|
|
||||||
dugnodes = dugnodes + 1
|
|
||||||
|
|
||||||
itemmeta:set_string("dug", dugnodes)
|
|
||||||
end
|
|
||||||
|
|
||||||
if itemstack:get_wear() > 60135 then
|
|
||||||
|
|
||||||
minetest.chat_send_player(pname,
|
|
||||||
toolranks.colors.gold .. S("Your tool is about to break!"))
|
|
||||||
|
|
||||||
minetest.sound_play("default_dig_metal", {
|
|
||||||
to_player = pname,
|
|
||||||
gain = 2.0,
|
|
||||||
}, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local itemdef = itemstack:get_definition()
|
|
||||||
local itemdesc = itemdef.original_description or ""
|
|
||||||
local lastlevel = tonumber(itemmeta:get_string("lastlevel")) or 0
|
|
||||||
local level = toolranks.get_level(dugnodes)
|
|
||||||
|
|
||||||
if lastlevel < level then
|
|
||||||
|
|
||||||
local levelup_text = S(
|
|
||||||
"Your @1@2@3 just leveled up!",
|
|
||||||
toolranks.colors.green,
|
|
||||||
itemdesc,
|
|
||||||
toolranks.colors.white
|
|
||||||
)
|
|
||||||
|
|
||||||
minetest.chat_send_player(pname, levelup_text .. " "..lastlevel.." -> "..level)
|
|
||||||
|
|
||||||
minetest.sound_play("toolranks_levelup", {
|
|
||||||
to_player = pname,
|
|
||||||
gain = 2.0,
|
|
||||||
}, true)
|
|
||||||
|
|
||||||
-- Make tool better by modifying tool_capabilities (if defined)
|
|
||||||
if itemdef.tool_capabilities then
|
|
||||||
|
|
||||||
local speed_multiplier = 1 + (level * level_multiplier * (max_speed - 1))
|
|
||||||
local use_multiplier = 1 + (level * level_multiplier * (max_use - 1))
|
|
||||||
local caps = table.copy(itemdef.tool_capabilities)
|
|
||||||
|
|
||||||
caps.full_punch_interval = caps.full_punch_interval and
|
|
||||||
(caps.full_punch_interval / speed_multiplier)
|
|
||||||
|
|
||||||
caps.punch_attack_uses = caps.punch_attack_uses and
|
|
||||||
(caps.punch_attack_uses * use_multiplier)
|
|
||||||
|
|
||||||
for _,c in pairs(caps.groupcaps) do
|
|
||||||
|
|
||||||
c.uses = c.uses * use_multiplier
|
|
||||||
|
|
||||||
for i,t in ipairs(c.times) do
|
|
||||||
c.times[i] = t / speed_multiplier
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
itemmeta:set_tool_capabilities(caps)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Old method for compatibility with tools without tool_capabilities defined
|
|
||||||
local wear = digparams.wear
|
|
||||||
|
|
||||||
if level > 0 and not itemdef.tool_capabilities then
|
|
||||||
|
|
||||||
local use_multiplier = 1 + (level * level_multiplier * (max_use - 1))
|
|
||||||
|
|
||||||
wear = wear / use_multiplier
|
|
||||||
end
|
|
||||||
|
|
||||||
itemmeta:set_string("lastlevel", level)
|
|
||||||
itemmeta:set_string("description", toolranks.create_description(itemdesc, dugnodes))
|
|
||||||
itemstack:add_wear(wear)
|
|
||||||
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Helper function
|
|
||||||
function toolranks.add_tool(name)
|
|
||||||
|
|
||||||
local desc = ItemStack(name):get_definition().description
|
|
||||||
|
|
||||||
minetest.override_item(name, {
|
|
||||||
original_description = desc,
|
|
||||||
description = toolranks.create_description(desc),
|
|
||||||
after_use = toolranks.new_afteruse
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local defaultmod = minetest.get_modpath("default")
|
|
||||||
|
|
||||||
if defaultmod then
|
|
||||||
-- Sword
|
|
||||||
toolranks.add_tool("default:sword_wood")
|
|
||||||
toolranks.add_tool("default:sword_stone")
|
|
||||||
toolranks.add_tool("default:sword_steel")
|
|
||||||
toolranks.add_tool("default:sword_bronze")
|
|
||||||
toolranks.add_tool("default:sword_mese")
|
|
||||||
toolranks.add_tool("default:sword_diamond")
|
|
||||||
|
|
||||||
-- Pickaxe
|
|
||||||
toolranks.add_tool("default:pick_wood")
|
|
||||||
toolranks.add_tool("default:pick_stone")
|
|
||||||
toolranks.add_tool("default:pick_steel")
|
|
||||||
toolranks.add_tool("default:pick_bronze")
|
|
||||||
toolranks.add_tool("default:pick_mese")
|
|
||||||
toolranks.add_tool("default:pick_diamond")
|
|
||||||
|
|
||||||
-- Axe
|
|
||||||
toolranks.add_tool("default:axe_wood")
|
|
||||||
toolranks.add_tool("default:axe_stone")
|
|
||||||
toolranks.add_tool("default:axe_steel")
|
|
||||||
toolranks.add_tool("default:axe_bronze")
|
|
||||||
toolranks.add_tool("default:axe_mese")
|
|
||||||
toolranks.add_tool("default:axe_diamond")
|
|
||||||
|
|
||||||
-- Shovel
|
|
||||||
toolranks.add_tool("default:shovel_wood")
|
|
||||||
toolranks.add_tool("default:shovel_stone")
|
|
||||||
toolranks.add_tool("default:shovel_steel")
|
|
||||||
toolranks.add_tool("default:shovel_bronze")
|
|
||||||
toolranks.add_tool("default:shovel_mese")
|
|
||||||
toolranks.add_tool("default:shovel_diamond")
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
print("[MOD] Tool Ranks loaded")
|
|
@ -1,2 +0,0 @@
|
|||||||
Code: LGPLv2.1+
|
|
||||||
Sounds: CC BY 3.0
|
|
@ -1,11 +0,0 @@
|
|||||||
# textdomain: toolranks
|
|
||||||
@1@2@n@3Level @4 @5@n@6Node dug: @7=@1@2@n@3Level @4 @5@n@6Node dug: @7
|
|
||||||
pickaxe=pickaxe
|
|
||||||
axe=axe
|
|
||||||
shovel=shovel
|
|
||||||
hoe=hoe
|
|
||||||
sword=sword
|
|
||||||
tool=tool
|
|
||||||
Most used tool is now a @1@2@3 owned by @4 with @5 uses.=Most used tool is now a @1@2@3 owned by @4 with @5 uses.
|
|
||||||
Your tool is about to break!=Your tool is about to break!
|
|
||||||
Your @1@2@3 just leveled up!=Your @1@2@3 just leveled up!
|
|
@ -1,11 +0,0 @@
|
|||||||
# textdomain: toolranks
|
|
||||||
@1@2@n@3Level @4 @5@n@6Node dug: @7=@1@2@n@3Nivel @4 @5@n@6Nodos picado: @7
|
|
||||||
pickaxe=pickaxe
|
|
||||||
axe=axe
|
|
||||||
shovel=shovel
|
|
||||||
hoe=hoe
|
|
||||||
sword=sword
|
|
||||||
tool=tool
|
|
||||||
Most used tool is now a @1@2@3 owned by @4 with @5 uses.=La herramienta mas usada es @1@2@3 pertenece a @4 con @5 veces.
|
|
||||||
Your tool is about to break!=Tu herramienta esta a punto de romperse!
|
|
||||||
Your @1@2@3 just leveled up!=Tu @1@2@3 acaba de subir nivel!
|
|
@ -1,11 +0,0 @@
|
|||||||
# textdomain: toolranks
|
|
||||||
@1@2@n@3Level @4 @5@n@6Node dug: @7=@1@2@n@3@5 niveau @4@n@6Blocks minés : @7
|
|
||||||
pickaxe=pioche
|
|
||||||
axe=hache
|
|
||||||
shovel=pelle
|
|
||||||
hoe=houe
|
|
||||||
sword=épée
|
|
||||||
tool=outil
|
|
||||||
Most used tool is now a @1@2@3 owned by @4 with @5 uses.=L’outil le plus utilisé est désormais @1@2@3 appartenant à @4 avec @5 utilisations.
|
|
||||||
Your tool is about to break!=Votre outil va se casser !
|
|
||||||
Your @1@2@3 just leveled up!=Votre @1@2@3 a gagné un niveau !
|
|
@ -1,4 +0,0 @@
|
|||||||
name = toolranks
|
|
||||||
depends =
|
|
||||||
optional_depends = default
|
|
||||||
description = TOOL gains levels for digging nodes. Higher level take longer to wear out
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,8 +0,0 @@
|
|||||||
# Number of tool levels
|
|
||||||
toolranks_levels (Levels) int 8
|
|
||||||
# Number of nodes that need to be dug to reach the next tool level
|
|
||||||
toolranks_level_digs (Digs per level) int 1000
|
|
||||||
# Dig speed multiplier at maximum tool level (1.0 to disable)
|
|
||||||
toolranks_speed_multiplier (Dig speed multiplier) float 1.1 1.0 10.0
|
|
||||||
# Durability multiplier at maximum tool level (1.0 to disable)
|
|
||||||
toolranks_use_multiplier (Durability multiplier) float 1.1 1.0 10.0
|
|
Loading…
x
Reference in New Issue
Block a user