From aab60567bad71190282fb65f0e31799bc1ae8f5f Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Mon, 23 Oct 2023 12:24:17 -0500 Subject: [PATCH] fix: adding a proximity monitor when one exists already (#1235) --- dGame/Entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index dc4df9c0..0f8e9351 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -827,7 +827,8 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa } void Entity::SetProximityRadius(float proxRadius, std::string name) { - ProximityMonitorComponent* proxMon = AddComponent(); + auto* proxMon = GetComponent(); + if (!proxMon) proxMon = AddComponent(); proxMon->SetProximityRadius(proxRadius, name); }