Small changes

This commit is contained in:
ElCeejo 2022-09-30 15:21:41 -07:00
parent 4439348160
commit 8e8e5052b5
2 changed files with 11 additions and 5 deletions

View file

@ -461,7 +461,8 @@ function creatura.basic_punch_func(self, puncher, tflp, tool_caps, dir)
local dist = vec_dist(self.object:get_pos(), puncher:get_pos())
dir.y = 0.2
if self.touching_ground then
self:apply_knockback(dir, (damage / dist) * 8)
local power = clamp((damage / dist) * 8, 0, 8)
self:apply_knockback(dir, power)
end
self:hurt(damage)
end

View file

@ -741,10 +741,15 @@ function mob:activate(staticdata, dtime)
end
-- Staticdata
if staticdata then
local data = minetest.deserialize(staticdata)
if data then
for k, v in pairs(data) do
local data = minetest.deserialize(staticdata)
if data then
local tp
for k, v in pairs(data) do
tp = type(v)
if tp ~= "function"
and tp ~= "nil"
and tp ~= "userdata" then
self[k] = v
end
end