add core:player component

This commit is contained in:
MihailRis
2025-09-06 22:30:01 +03:00
parent 854dcf2a50
commit 93e7ae159a
5 changed files with 132 additions and 92 deletions
+7 -2
View File
@@ -41,13 +41,18 @@ function next_waypoint()
return route[#route]
end
local frameid = 0
local refresh_internal = 100
local frameid = math.random(0, refresh_internal)
function set_refresh_interval(interval)
refresh_internal = interval
end
function on_update()
if not started then
if body:is_grounded() then
frameid = frameid + 1
if target and frameid % 100 == 1 then
if target and (frameid % refresh_internal == 1 or not route) then
pathfinding.make_route_async(agent, tsf:get_pos(), target)
started = true
end