mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add core:player component
This commit is contained in:
parent
854dcf2a50
commit
93e7ae159a
5 changed files with 132 additions and 92 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue