mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-04-30 13:51:41 -04:00
Bug fixes
This commit is contained in:
parent
fc6a203da2
commit
72f55abc2d
3 changed files with 3 additions and 4 deletions
3
api.lua
3
api.lua
|
@ -19,7 +19,6 @@ local function clamp(val, min, max)
|
||||||
end
|
end
|
||||||
|
|
||||||
local vec_dist = vector.distance
|
local vec_dist = vector.distance
|
||||||
local vec_multi = vector.multiply
|
|
||||||
local vec_equals = vector.equals
|
local vec_equals = vector.equals
|
||||||
local vec_add = vector.add
|
local vec_add = vector.add
|
||||||
|
|
||||||
|
@ -437,7 +436,7 @@ function creatura.drop_items(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
|
function creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
||||||
if not puncher then return end
|
if not puncher then return end
|
||||||
local tool = ""
|
local tool = ""
|
||||||
if puncher:is_player() then
|
if puncher:is_player() then
|
||||||
|
|
|
@ -305,7 +305,7 @@ creatura.register_movement_method("creatura:obstacle_avoidance", function(self)
|
||||||
_self:halt()
|
_self:halt()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
--local steer_to = get_avoidance_dir(_self, goal)
|
local steer_to = get_avoidance_dir(_self, goal)
|
||||||
-- Get movement direction
|
-- Get movement direction
|
||||||
local goal_dir = vec_dir(pos, goal)
|
local goal_dir = vec_dir(pos, goal)
|
||||||
if steer_to then
|
if steer_to then
|
||||||
|
|
|
@ -166,12 +166,12 @@ local function lerp_rad(a, b, w)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob:turn_to(tyaw, rate)
|
function mob:turn_to(tyaw, rate)
|
||||||
|
self.last_yaw = self.object:get_yaw()
|
||||||
self._tyaw = tyaw
|
self._tyaw = tyaw
|
||||||
rate = rate or 5
|
rate = rate or 5
|
||||||
local yaw = self.object:get_yaw()
|
local yaw = self.object:get_yaw()
|
||||||
local step = math.min(self.dtime * rate, abs(diff(yaw, tyaw)) % (pi2))
|
local step = math.min(self.dtime * rate, abs(diff(yaw, tyaw)) % (pi2))
|
||||||
self.object:set_yaw(lerp_rad(yaw, tyaw, step))
|
self.object:set_yaw(lerp_rad(yaw, tyaw, step))
|
||||||
self.last_yaw = self.object:get_yaw()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set Gravity (default of -9.8)
|
-- Set Gravity (default of -9.8)
|
||||||
|
|
Loading…
Add table
Reference in a new issue