mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 18:34:54 +02:00
tetherball stick and ball remove themselves after 2 seconds if user who has them equipped leaves the domain
This commit is contained in:
parent
2257af42be
commit
a0c8c4df52
1 changed files with 13 additions and 6 deletions
|
@ -17,6 +17,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
|
var LIFETIME_IF_LEAVE_DOMAIN = 2;
|
||||||
var LINE_WIDTH = 0.02;
|
var LINE_WIDTH = 0.02;
|
||||||
var COLLISION_SOUND_URL = "http://public.highfidelity.io/sounds/Footsteps/FootstepW3Left-12db.wav";
|
var COLLISION_SOUND_URL = "http://public.highfidelity.io/sounds/Footsteps/FootstepW3Left-12db.wav";
|
||||||
var TIP_OFFSET = 0.26;
|
var TIP_OFFSET = 0.26;
|
||||||
|
@ -46,12 +47,6 @@
|
||||||
this.lineID = userData.lineID;
|
this.lineID = userData.lineID;
|
||||||
this.actionID = userData.actionID;
|
this.actionID = userData.actionID;
|
||||||
this.maxDistanceBetweenBallAndStick = userData.maxDistanceBetweenBallAndStick;
|
this.maxDistanceBetweenBallAndStick = userData.maxDistanceBetweenBallAndStick;
|
||||||
|
|
||||||
// Script.update.connect(this.update);
|
|
||||||
},
|
|
||||||
|
|
||||||
unload: function() {
|
|
||||||
// Script.update.disconnect(this.update);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(dt) {
|
update: function(dt) {
|
||||||
|
@ -63,12 +58,24 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
continueEquip: function(id, params) {
|
continueEquip: function(id, params) {
|
||||||
|
var stickProps = Entities.getEntityProperties(this.entityID);
|
||||||
|
[this.entityID, this.ballID, this.lineID].forEach(function(id) {
|
||||||
|
Entities.editEntity(id, {
|
||||||
|
lifetime: stickProps.age + LIFETIME_IF_LEAVE_DOMAIN
|
||||||
|
});
|
||||||
|
});
|
||||||
this.updateOffsetAction();
|
this.updateOffsetAction();
|
||||||
this.capBallDistance();
|
this.capBallDistance();
|
||||||
this.drawLine();
|
this.drawLine();
|
||||||
},
|
},
|
||||||
|
|
||||||
releaseEquip: function() {
|
releaseEquip: function() {
|
||||||
|
var userData = this.getUserData();
|
||||||
|
[this.entityID, this.ballID, this.lineID].forEach(function(id) {
|
||||||
|
Entities.editEntity(id, {
|
||||||
|
lifetime: userData.lifetime
|
||||||
|
});
|
||||||
|
});
|
||||||
Script.update.connect(this.update);
|
Script.update.connect(this.update);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue