Skip to content

Commit

Permalink
Fixed "undefined" ZoneEntityController name
Browse files Browse the repository at this point in the history
ZoneEntityController will now get it's suffix and ID from it's parent Zone
  • Loading branch information
Aitolda committed Oct 10, 2024
1 parent 04a35fa commit f280850
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ export class ZoneEntityController extends EntityController {
private _zoneMesh: Mesh | null = null;

constructor(entity: IZoneEntity) {
// Extract the numeric part from the zone's ID
const zoneNumber = entity.id.split('_')[1];
// Extract a unique identifier from the zone's ID
let uniqueId = "unknown";
if (entity.id) {
const parts = entity.id.split('_');
uniqueId = parts.length > 1 ? parts[1] : entity.id;
}

// Create a unique ID for this controller
const controllerId = `ZoneEntityController_${zoneNumber}`;
const controllerId = `ZoneEntityController_${uniqueId}`;

super(entity, controllerId);
this._zoneEntity = entity;
Expand Down

0 comments on commit f280850

Please sign in to comment.