fix: adding a proximity monitor when one exists already (#1235)

This commit is contained in:
Aaron Kimbrell 2023-10-23 12:24:17 -05:00 committed by GitHub
parent 9aa81f95cc
commit aab60567ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -827,7 +827,8 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa
}
void Entity::SetProximityRadius(float proxRadius, std::string name) {
ProximityMonitorComponent* proxMon = AddComponent<ProximityMonitorComponent>();
auto* proxMon = GetComponent<ProximityMonitorComponent>();
if (!proxMon) proxMon = AddComponent<ProximityMonitorComponent>();
proxMon->SetProximityRadius(proxRadius, name);
}