From 4dd2cf9cf547167dc517b8598bd7085c2145bbde Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 2 Oct 2015 11:09:43 -0700 Subject: [PATCH 1/2] Moved master reset script into new directory called unpublished scripts and changed relative pathing --- .../masterReset.js | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) rename {examples/toys => unpublishedScripts}/masterReset.js (95%) diff --git a/examples/toys/masterReset.js b/unpublishedScripts/masterReset.js similarity index 95% rename from examples/toys/masterReset.js rename to unpublishedScripts/masterReset.js index 72e2d73729..94eddd74be 100644 --- a/examples/toys/masterReset.js +++ b/unpublishedScripts/masterReset.js @@ -6,10 +6,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ +/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ //per script /*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketballHoop, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLightSwitches */ -var utilitiesScript = Script.resolvePath("../libraries/utils.js"); +var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js"); Script.include(utilitiesScript); var resetKey = "resetMe"; @@ -185,7 +185,7 @@ function createFire() { function createCat(position) { - var scriptURL = Script.resolvePath("cat.js?v1"); + var scriptURL = Script.resolvePath("../examples/toys/cat.js"); var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx"; var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx"; var animationSettings = JSON.stringify({ @@ -218,7 +218,7 @@ function createCat(position) { } function createFlashlight(position) { - var scriptURL = Script.resolvePath('flashlight/flashlight.js'); + var scriptURL = Script.resolvePath('../examples/toys/flashlight/flashlight.js'); var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx"; var flashlight = Entities.addEntity({ @@ -254,7 +254,7 @@ function createFlashlight(position) { function createLightSwitches() { var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx?v1"; - var scriptURL = Script.resolvePath("lightSwitchHall.js?v1"); + var scriptURL = Script.resolvePath("../examples/toys/lightSwitchHall.js"); var lightSwitchHall = Entities.addEntity({ type: "Model", @@ -283,7 +283,7 @@ function createLightSwitches() { resetMe: true }); - scriptURL = Script.resolvePath("lightSwitchGarage.js?v1"); + scriptURL = Script.resolvePath("../examples/toys/lightSwitchGarage.js"); var lightSwitchGarage = Entities.addEntity({ type: "Model", @@ -444,7 +444,7 @@ function createGates() { function createPingPongBallGun() { var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun.fbx'; var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun_collision_hull.obj'; - var scriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); + var scriptURL = Script.resolvePath('../examples/toys/ping_pong_gun/pingPongGun.js'); var position = { x: 548.6, @@ -524,7 +524,7 @@ function createBasketballHoop() { function createWand(position) { var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx'; var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/actual_no_top_collision_hull.obj'; - var scriptURL = Script.resolvePath("bubblewand/wand.js"); + var scriptURL = Script.resolvePath("../examples/toys/bubblewand/wand.js"); var entity = Entities.addEntity({ name: 'Bubble Wand', @@ -594,7 +594,7 @@ function createBasketBall(position) { function createDoll(position) { var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx"; - var scriptURL = Script.resolvePath("doll/doll.js?v2"); + var scriptURL = Script.resolvePath("../examples/toys/doll/doll.js"); var naturalDimensions = { x: 1.63, @@ -629,7 +629,7 @@ function createDoll(position) { } function createSprayCan(position) { - var scriptURL = Script.resolvePath("sprayPaintCan.js?v1" + Math.random()); + var scriptURL = Script.resolvePath("../examples/toys/sprayPaintCan.js"); var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx"; var entity = Entities.addEntity({ @@ -832,11 +832,3 @@ if (shouldDeleteOnEndScript) { Script.scriptEnding.connect(cleanup); } - -function randFloat(low, high) { - return low + Math.random() * (high - low); -} - -function randInt(low, high) { - return Math.floor(randFloat(low, high)); -} \ No newline at end of file From b595d916b67459774a6788ca8d5baf0554958245 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 2 Oct 2015 11:10:08 -0700 Subject: [PATCH 2/2] fixed spacing issue --- unpublishedScripts/masterReset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unpublishedScripts/masterReset.js b/unpublishedScripts/masterReset.js index 94eddd74be..d6759e2b48 100644 --- a/unpublishedScripts/masterReset.js +++ b/unpublishedScripts/masterReset.js @@ -98,7 +98,7 @@ function createAllToys() { function deleteAllToys() { var entities = Entities.findEntities(MyAvatar.position, 100); - entities.forEach(function(entity) { + entities.forEach(function (entity) { //params: customKey, id, defaultValue var shouldReset = getEntityCustomData(resetKey, entity, {}).resetMe; if (shouldReset === true) {