alert players if their tool is near breaking

master
flux 2019-12-08 22:36:02 +00:00
parent 039fc66aa2
commit a54459a6e7
4 changed files with 36 additions and 1 deletions

22
dungeon_loot.lua Normal file
View File

@ -0,0 +1,22 @@
if not minetest.get_modpath("dungeon_loot") then return end
--[[
name = "item:name",
chance = 0.5,
-- ^ chance value from 0.0 to 1.0 that the item will appear in the chest when chosen
-- Due to an extra step in the selection process, 0.5 does not(!) mean that
-- on average every second chest will have this item
count = {1, 4},
-- ^ table with minimum and maximum amounts of this item
-- optional, defaults to always single item
y = {-32768, -512},
-- ^ table with minimum and maximum heights this item can be found at
-- optional, defaults to no height restrictions
types = {"desert"},
-- ^ table with types of dungeons this item can be found in
-- supported types: "normal" (the cobble/mossycobble one), "sandstone"
-- "desert" and "ice"
-- optional, defaults to no type restrictions
]]--
local rloot = dungeon_loot.register
rloot{name=""}

View File

@ -80,7 +80,7 @@ if minetest.get_modpath("bbq") then
set_eat_or_poison("bbq:lamb_kebab_raw", 2, -1)
set_eat("bbq:lamb_kebab", 8)
set_eat_or_poison("bbq:rack_lamb_raw", 2, -1)
set_eat("bbq:rack_lamb", 12)
set_eat("bbq:rack_lamb", 8)
set_eat_or_poison("bbq:leg_lamb_raw", 2, -1)
set_eat("bbq:leg_lamb", 8)
set_eat_or_poison("bbq:ham_raw", 2, -1)

View File

@ -45,6 +45,7 @@ dofile(bls.modpath .. "/terumet/alloy_smelter.lua")
dofile(bls.modpath .. "/terumet/ore_saw.lua")
dofile(bls.modpath .. "/terumet/reformer.lua")
dofile(bls.modpath .. "/terumet/vulcanizer.lua")
dofile(bls.modpath .. "/tool_damage_alert.lua")
dofile(bls.modpath .. "/update_initial_privs.lua")
--

12
tool_damage_alert.lua Normal file
View File

@ -0,0 +1,12 @@
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
local item = puncher:get_wielded_item()
if item:get_wear() > 60135 then
local puncher_name = puncher:get_player_name()
minetest.chat_send_player(puncher_name, "Your tool is about to break!")
minetest.sound_play("default_tool_breaks", {
to_player = puncher_name,
gain = 2.0,
})
end
end)