add 'on_physics_update' entity event

This commit is contained in:
MihailRis 2025-08-13 21:29:20 +03:00
parent b60f0f0ea2
commit 6d3dac9106
6 changed files with 42 additions and 3 deletions

View file

@ -25,7 +25,10 @@
static debug::Logger logger("entities");
Entities::Entities(Level& level)
: level(level), sensorsTickClock(20, 3), updateTickClock(20, 3) {
: level(level),
sensorsTickClock(20, 3),
updateTickClock(20, 3),
physicsTickClock(60, 1) {
}
std::optional<Entity> Entities::get(entityid_t id) {
@ -320,6 +323,13 @@ void Entities::update(float delta) {
updateTickClock.getPart()
);
}
if (physicsTickClock.update(delta)) {
scripting::on_entities_physics_update(
physicsTickClock.getTickRate(),
physicsTickClock.getParts(),
physicsTickClock.getPart()
);
}
}
static void debug_render_skeleton(