Skip to content

Instantly share code, notes, and snippets.

@Atlante45
Created February 7, 2019 22:48
Show Gist options
  • Save Atlante45/eebfa9cecc3e47ad53750c1c84e9f75e to your computer and use it in GitHub Desktop.
Save Atlante45/eebfa9cecc3e47ad53750c1c84e9f75e to your computer and use it in GitHub Desktop.
(function() {
var _this = this;
_this.preload = function(entityID) {
_this.entityID = entityID;
_this.interval = Script.setInterval(function(dt) {
var parentsCount = 0;
var props = Entities.getEntityProperties(_this.entityID);
var idToCheck = props.parentID;
while (!Uuid.isNull(idToCheck)) {
parentsCount += 1;
props = Entities.getEntityProperties(idToCheck);
idToCheck = props.parentID;
}
console.log("[TAG] Parents count: " + parentsCount)
}, 2000);
};
_this.unload = function() {
Script.clearInterval(_this.interval);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment