mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-03-22 23:52:22 +00:00
Small changes
This commit is contained in:
parent
4439348160
commit
8e8e5052b5
2 changed files with 11 additions and 5 deletions
3
api.lua
3
api.lua
|
@ -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())
|
local dist = vec_dist(self.object:get_pos(), puncher:get_pos())
|
||||||
dir.y = 0.2
|
dir.y = 0.2
|
||||||
if self.touching_ground then
|
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
|
end
|
||||||
self:hurt(damage)
|
self:hurt(damage)
|
||||||
end
|
end
|
||||||
|
|
|
@ -741,10 +741,15 @@ function mob:activate(staticdata, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Staticdata
|
-- Staticdata
|
||||||
if staticdata then
|
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
|
|
||||||
if data then
|
if data then
|
||||||
|
local tp
|
||||||
for k, v in pairs(data) do
|
for k, v in pairs(data) do
|
||||||
|
tp = type(v)
|
||||||
|
if tp ~= "function"
|
||||||
|
and tp ~= "nil"
|
||||||
|
and tp ~= "userdata" then
|
||||||
self[k] = v
|
self[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue