diff --git a/api.lua b/api.lua index 3bafc3e..e7d0147 100644 --- a/api.lua +++ b/api.lua @@ -9,11 +9,11 @@ creatura.api = {} local floor = math.floor local random = math.random -local function clamp(val, min, max) - if val < min then - val = min - elseif max < val then - val = max +local function clamp(val, min_n, max_n) + if val < min_n then + val = min_n + elseif max_n < val then + val = max_n end return val end diff --git a/mob_meta.lua b/mob_meta.lua index c9c464c..3753f76 100644 --- a/mob_meta.lua +++ b/mob_meta.lua @@ -1167,7 +1167,7 @@ function mob:_vitals() if on_ground then damage = fall_start - pos.y if damage < max_fall then - damage = nil + damage = 0 else local resist = self.fall_resistance or 0 damage = damage - damage * resist