mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 03:22:27 +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() {
|
||||
var _this;
|
||||
|
||||
var LIFETIME_IF_LEAVE_DOMAIN = 2;
|
||||
var LINE_WIDTH = 0.02;
|
||||
var COLLISION_SOUND_URL = "http://public.highfidelity.io/sounds/Footsteps/FootstepW3Left-12db.wav";
|
||||
var TIP_OFFSET = 0.26;
|
||||
|
@ -46,12 +47,6 @@
|
|||
this.lineID = userData.lineID;
|
||||
this.actionID = userData.actionID;
|
||||
this.maxDistanceBetweenBallAndStick = userData.maxDistanceBetweenBallAndStick;
|
||||
|
||||
// Script.update.connect(this.update);
|
||||
},
|
||||
|
||||
unload: function() {
|
||||
// Script.update.disconnect(this.update);
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
|
@ -63,12 +58,24 @@
|
|||
},
|
||||
|
||||
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.capBallDistance();
|
||||
this.drawLine();
|
||||
},
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue