mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-11 18:30:21 +01:00
added punch_capabilities error check
This commit is contained in:
parent
3e05bc7ec0
commit
a80b8dc3b0
8
api.lua
8
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (15th April 2016)
|
-- Mobs Api (16th April 2016)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -416,7 +416,7 @@ do_env_damage = function(self)
|
|||||||
check_for_death(self)
|
check_for_death(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- jump if facing a solid node (not fences)
|
-- jump if facing a solid node (not fences or gates)
|
||||||
do_jump = function(self)
|
do_jump = function(self)
|
||||||
|
|
||||||
if self.fly
|
if self.fly
|
||||||
@ -549,6 +549,7 @@ function follow_holding(self, clicker)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- find two animals of same type and breed if nearby and horny
|
||||||
local function breed(self)
|
local function breed(self)
|
||||||
|
|
||||||
-- child take 240 seconds before growing into adult
|
-- child take 240 seconds before growing into adult
|
||||||
@ -682,6 +683,7 @@ local function breed(self)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- find and replace what mob is looking for (grass, wheat etc.)
|
||||||
function replace(self, pos)
|
function replace(self, pos)
|
||||||
|
|
||||||
if self.replace_rate
|
if self.replace_rate
|
||||||
@ -1702,7 +1704,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
tflp = 0.2
|
tflp = 0.2
|
||||||
end
|
end
|
||||||
|
|
||||||
for group,_ in pairs(tool_capabilities.damage_groups) do
|
for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do
|
||||||
|
|
||||||
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
|
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user