Files
bo3-js/js/core/DataModel.js

25 lines
901 B
JavaScript
Raw Normal View History

2025-10-12 18:03:20 +02:00
import {Instance} from "../instances/Instance.js";
export class DataModel extends Instance {
constructor() {
super("DataModel");
this.InstanceId = "DataModelRoot"; // Fixed ID for root
}
GetService(name) {
// Loop through children by class name
return this.Children.find(c => c.ClassName === name) || null;
}
GetDataModel() {return this;} // Override to return self
2025-10-23 20:58:19 +02:00
LuaBridge () {
const obj = super.LuaBridge();
obj.GetService = (name) => {
if (name === "RunService") name = "RenderService"; // Alias
const service = this.GetService(name);
return service ? service.LuaBridge() : null;
}
}
2025-10-12 18:03:20 +02:00
} // Just a container for the whole instance tree
// cuz this is an Entity Component System, we need a root entity
// Assume all children of DataModel are services or top-level game objects