forked from mtcontrib/mobs_redo
Added ToolRanks support when attacking mobs with tools/swords
This commit is contained in:
parent
e145fe098d
commit
40416aa4fd
24
api.lua
24
api.lua
@ -3,7 +3,7 @@
|
||||
|
||||
mobs = {}
|
||||
mobs.mod = "redo"
|
||||
mobs.version = "20180627"
|
||||
mobs.version = "20180701"
|
||||
|
||||
|
||||
-- Intllib
|
||||
@ -2313,6 +2313,9 @@ local falling = function(self, pos)
|
||||
end
|
||||
|
||||
|
||||
-- is Took Ranks mod active?
|
||||
local tr = minetest.get_modpath("toolranks")
|
||||
|
||||
-- deal damage and effects when mob punched
|
||||
local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||
|
||||
@ -2414,7 +2417,24 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||
if weapon:get_definition()
|
||||
and weapon:get_definition().tool_capabilities then
|
||||
|
||||
weapon:add_wear(floor((punch_interval / 75) * 9000))
|
||||
-- toolrank support
|
||||
local wear = floor((punch_interval / 75) * 9000)
|
||||
|
||||
if mobs.is_creative(hitter:get_player_name()) then
|
||||
|
||||
if tr then
|
||||
wear = 1
|
||||
else
|
||||
wear = 0
|
||||
end
|
||||
end
|
||||
|
||||
if tr then
|
||||
weapon:add_wear(toolranks.new_afteruse(weapon, hitter, nil, {wear = wear}))
|
||||
else
|
||||
weapon:add_wear(wear)
|
||||
end
|
||||
|
||||
hitter:set_wielded_item(weapon)
|
||||
end
|
||||
|
||||
|
@ -6,3 +6,4 @@ invisibility?
|
||||
intllib?
|
||||
lucky_block?
|
||||
cmi?
|
||||
toolranks?
|
||||
|
@ -22,6 +22,7 @@ Lucky Blocks: 9
|
||||
|
||||
|
||||
Changelog:
|
||||
- 1.44- Added ToolRanks support for swords when attacking mobs
|
||||
- 1.43- Better 0.4.16 compatibility, added general attack function and settings
|
||||
- 1.42- Added "all" option to immune_to table, tidied floating mobs to be less intensive
|
||||
- 1.41- Mob pathfinding has been updated thanks to Elkien3
|
||||
|
Loading…
Reference in New Issue
Block a user