mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
add on_player_set entity component event
This commit is contained in:
parent
8d7fab1f2f
commit
e4a11f182e
9 changed files with 29 additions and 15 deletions
|
|
@ -58,16 +58,12 @@ local function process_player_inputs(pid, rot, delta)
|
|||
end
|
||||
end
|
||||
|
||||
local prepared = false
|
||||
body:set_enabled(false)
|
||||
mob.set_flight(true)
|
||||
function on_player_set(pid)
|
||||
mob.set_flight(player.is_flight(pid))
|
||||
body:set_body_type(player.is_noclip(pid) and "kinematic" or "dynamic")
|
||||
end
|
||||
|
||||
function on_physics_update(delta)
|
||||
if not prepared then
|
||||
prepared = true
|
||||
body:set_enabled(true)
|
||||
end
|
||||
|
||||
local pid = entity:get_player()
|
||||
if pid == -1 then
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue