(function() { var ZERO_UUID = '{00000000-0000-0000-0000-000000000000}'; var _this; function GrabActionEntity() { _this = this; } GrabActionEntity.prototype = { entityID: null, rootEntityID: null, preload: function(entityID) { _this.entityID = entityID; //_this.rootEntityID = _this.rootEntityIDFinder(_this.entityID); //print('found = ' + _this.rootEntityID); }, /*rootEntityIDFinder: function(entityID) { var parentEntityID = Entities.getEntityProperties(entityID, ['parentID']).parentID; var previousEntityID = entityID; while (parentEntityID !== ZERO_UUID) { previousEntityID = parentEntityID; parentEntityID = Entities.getEntityProperties(parentEntityID, ['parentID']).parentID; } return previousEntityID; },*/ sendGrabPosition: function(entityID) { print(entityID); Messages.sendMessage('GrabAction_' + entityID, JSON.stringify({ position: Entities.getEntityProperties(entityID, ['position']).position })); }, continueNearGrab: function(entityID, args) { _this.sendGrabPosition(entityID); }, holdingClickOnEntity: function(entityID, mouseEvent) { _this.sendGrabPosition(entityID); } }; return new GrabActionEntity(); })