Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them has been replaced with a symlink. Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still be present.
48 lines
No EOL
1.3 KiB
JavaScript
48 lines
No EOL
1.3 KiB
JavaScript
//
|
|
// Carrot Server.js
|
|
//
|
|
// Team 8 Hifi Hackathon 2018
|
|
// Chang Kayla Sam Lab
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
/* globals Entities */
|
|
(function() {
|
|
var _entityID;
|
|
var triggered = false;
|
|
|
|
var Carrot = function() {
|
|
};
|
|
|
|
Carrot.prototype = {
|
|
remotelyCallable: ['triggerCarrot'],
|
|
|
|
preload: function(entityID) {
|
|
_entityID = entityID;
|
|
},
|
|
|
|
triggerCarrot: function(senderID, params) {
|
|
var playerUUID = params[0];
|
|
print("received a triggerCarrot!!! from " + playerUUID)
|
|
|
|
/*
|
|
Can t guarantee that we don;t have a cheater ....
|
|
var position = Entities.getEntityProperties(_entityID, 'position').position;
|
|
var avatarsInRange = AvatarList.getAvatarsInRange(position, 1.0);
|
|
print("Avatars in range are: " + JSON.stringify(avatarsInRange))
|
|
*/
|
|
|
|
if (triggered === false) {
|
|
triggered = true;
|
|
Entities.callEntityClientMethod(playerUUID, _entityID, 'triggerWin');
|
|
} else {
|
|
Entities.callEntityClientMethod(playerUUID, _entityID, 'triggerMiss');
|
|
}
|
|
}
|
|
};
|
|
|
|
return new Carrot();
|
|
|
|
}); |