update on_physics_update & update standard components
This commit is contained in:
@@ -133,21 +133,17 @@ return {
|
||||
::continue::
|
||||
end
|
||||
end,
|
||||
physics_update = function(tps, parts, part)
|
||||
physics_update = function(delta)
|
||||
for uid, entity in pairs(entities) do
|
||||
if uid % parts ~= part then
|
||||
goto continue
|
||||
end
|
||||
for _, component in pairs(entity.components) do
|
||||
local callback = component.on_physics_update
|
||||
if not component.__disabled and callback then
|
||||
local result, err = pcall(callback, tps)
|
||||
local result, err = pcall(callback, delta)
|
||||
if err then
|
||||
debug.error(err)
|
||||
end
|
||||
end
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
end,
|
||||
render = function(delta)
|
||||
|
||||
@@ -151,9 +151,7 @@ function set_flight(flag) flight = flag end
|
||||
|
||||
local prev_angle = (vec2.angle({dir[3], dir[1]})) % 360
|
||||
|
||||
function on_physics_update(tps)
|
||||
local delta = (1.0 / tps)
|
||||
|
||||
function on_physics_update(delta)
|
||||
local grounded = body:is_grounded()
|
||||
body:set_vdamping(flight)
|
||||
body:set_gravity_scale({0, flight and 0.0 or props.gravity_scale, 0})
|
||||
|
||||
@@ -51,8 +51,7 @@ local function process_player_inputs(pid, delta)
|
||||
end
|
||||
end
|
||||
|
||||
function on_physics_update(tps)
|
||||
local delta = (1.0 / tps)
|
||||
function on_physics_update(delta)
|
||||
local pid = entity:get_player()
|
||||
if pid ~= -1 then
|
||||
local pos = tsf:get_pos()
|
||||
|
||||
Reference in New Issue
Block a user