From 5c650d7809efd1b4273f5e13d8d9e451471d3477 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 29 Jul 2023 00:49:38 +1000 Subject: [PATCH] Make client-side NPC collisionPoly override opt-in --- source/game/StarNpc.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/game/StarNpc.cpp b/source/game/StarNpc.cpp index 97b0528..cd20993 100644 --- a/source/game/StarNpc.cpp +++ b/source/game/StarNpc.cpp @@ -254,13 +254,15 @@ RectF Npc::collisionArea() const { pair Npc::writeNetState(uint64_t fromVersion) { // client-side npcs error nearby vanilla NPC scripts because callScriptedEntity // for now, scrungle the collision poly to avoid their queries. hacky :( - if (auto mode = entityMode()) { - if (*mode == EntityMode::Master && connectionForEntity(entityId()) != ServerConnectionId) { - PolyF poly = m_movementController->collisionPoly(); - m_movementController->setCollisionPoly({ { 0.0f, -FLT_MAX } }); - auto result = m_netGroup.writeNetState(fromVersion); - m_movementController->setCollisionPoly(poly); - return result; + if (m_npcVariant.overrides.getBool("overrideNetPoly", false)) { + if (auto mode = entityMode()) { + if (*mode == EntityMode::Master && connectionForEntity(entityId()) != ServerConnectionId) { + PolyF poly = m_movementController->collisionPoly(); + m_movementController->setCollisionPoly({ { 0.0f, -FLT_MAX } }); + auto result = m_netGroup.writeNetState(fromVersion); + m_movementController->setCollisionPoly(poly); + return result; + } } }