forked from minetest-mods/enchanting
Import changes from xdecor
This commit is contained in:
parent
7413b7228e
commit
f28d013a74
3
LICENSE
3
LICENSE
@ -3,6 +3,9 @@
|
||||
| |
|
||||
| Code: GPL version 3 |
|
||||
| Textures: WTFPL (credits: Gambit) |
|
||||
| Sounds: |
|
||||
| - xdecor_enchanting.ogg - by Timbre - CC BY-SA-NC |
|
||||
| freesound.org/people/Timbre/sounds/221683/ |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
5
init.lua
5
init.lua
@ -58,7 +58,7 @@ function enchanting.on_put(pos, listname, _, stack)
|
||||
end
|
||||
end
|
||||
|
||||
function enchanting.fields(pos, _, fields)
|
||||
function enchanting.fields(pos, _, fields, sender)
|
||||
if fields.quit then return end
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local tool = inv:get_stack("tool", 1)
|
||||
@ -68,6 +68,7 @@ function enchanting.fields(pos, _, fields)
|
||||
local enchanted_tool = (mod or "")..":enchanted_"..(name or "").."_"..next(fields)
|
||||
|
||||
if mese:get_count() >= mese_cost and minetest.registered_tools[enchanted_tool] then
|
||||
minetest.sound_play("xdecor_enchanting", {to_player=sender:get_player_name(), gain=0.8})
|
||||
tool:replace(enchanted_tool)
|
||||
tool:add_wear(orig_wear)
|
||||
mese:take_item(mese_cost)
|
||||
@ -209,7 +210,7 @@ function enchanting:register_tools(mod, def)
|
||||
for material in def.materials:gmatch("[%w_]+") do
|
||||
for enchant in def.tools[tool].enchants:gmatch("[%w_]+") do
|
||||
local original_tool = minetest.registered_tools[mod..":"..tool.."_"..material]
|
||||
if not original_tool then return end
|
||||
if not original_tool then break end
|
||||
|
||||
if original_tool.tool_capabilities then
|
||||
local original_damage_groups = original_tool.tool_capabilities.damage_groups
|
||||
|
BIN
sounds/xdecor_enchanting.ogg
Normal file
BIN
sounds/xdecor_enchanting.ogg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user