From 12f8d83a6f27c6e4b5436843bad8b2e014c81d55 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Wed, 30 Mar 2016 13:02:46 -0700 Subject: [PATCH] plant stuffs --- .../Home/growingPlant/waterCanEntityScript.js | 27 ++++++++++++------- .../Home/growingPlant/wrapper.js | 12 ++++----- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js b/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js index 21034540cf..a9f7da9bc2 100644 --- a/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js @@ -18,7 +18,7 @@ function WaterSpout() { _this = this; - _this.waterSound = SoundCache.getSound("atp:/sounds/watering_can_pour.L.wav"); + _this.waterSound = SoundCache.getSound("atp:/growingPlant/watering_can_pour.L.wav"); _this.POUR_ANGLE_THRESHOLD = 0; _this.waterPouring = false; _this.WATER_SPOUT_NAME = "hifi-water-spout"; @@ -37,17 +37,21 @@ }, startHold: function() { - if (_this.waterSpout) { - _this.waterSpoutPosition = Entities.getEntityProperties(_this.waterSpout, "position").position; - _this.waterSpoutRotation = Entities.getEntityProperties(_this.waterSpout, "rotation").rotation; - _this.createWaterEffect(); - } else { - print("EBL NO WATER SPOUT FOUND RETURNING"); - return; - } + var entities = Entities.findEntities(_this.position, 2); + print("EBL SEARCHING FOR SPOUT"); + entities.forEach(function(entity) { + var name = Entities.getEntityProperties(entity, "name").name; + if (name === _this.WATER_SPOUT_NAME) { + print("EBL FOUND SPOUT"); + _this.waterSpout = entity; + _this.waterSpoutPosition = Entities.getEntityProperties(_this.waterSpout, "position").position; + _this.waterSpoutRotation = Entities.getEntityProperties(_this.waterSpout, "rotation").rotation; + _this.createWaterEffect(); + } + }); + _this.findGrowableEntities(); }, - releaseEquip: function() { _this.releaseHold(); }, @@ -220,14 +224,17 @@ }, preload: function(entityID) { + print("EBL PRELOADING WATER CAN") _this.entityID = entityID; _this.position = Entities.getEntityProperties(_this.entityID, "position").position; // Wait a a bit for spout to spawn for case where preload is initial spawn, then save it Script.setTimeout(function() { var entities = Entities.findEntities(_this.position, 2); + print("EBL SEARCHING FOR SPOUT"); entities.forEach(function(entity) { var name = Entities.getEntityProperties(entity, "name").name; if (name === _this.WATER_SPOUT_NAME) { + print("EBL FOUND SPOUT"); _this.waterSpout = entity; } }); diff --git a/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js b/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js index 0e2fc2781f..e535b9b839 100644 --- a/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js @@ -9,8 +9,8 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var PLANT_SCRIPT_URL = Script.resolvePath("atp:/scripts/growingPlantEntityScript.js"); -var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/scripts/waterCanEntityScript.js"); +var PLANT_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/growingPlantEntityScript.js"); +var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/waterCanEntityScript.js"); Plant = function(spawnPosition, spawnRotation) { var orientation; if (spawnRotation !== undefined) { @@ -20,7 +20,7 @@ Plant = function(spawnPosition, spawnRotation) { } print("EBL ORIENTATION " + JSON.stringify(orientation)); var bowlPosition = spawnPosition; - var BOWL_MODEL_URL = "atp:/models/Flowers-Bowl.fbx"; + var BOWL_MODEL_URL = "atp:/growingPlant/Flowers-Bowl.fbx"; var bowlDimensions = { x: 0.518, y: 0.1938, @@ -40,7 +40,7 @@ Plant = function(spawnPosition, spawnRotation) { }); - var PLANT_MODEL_URL = "atp:/models/Flowers-Rock.fbx"; + var PLANT_MODEL_URL = "atp:/growingPlant/Flowers-Rock.fbx"; var plantDimensions = { x: 0.52, @@ -68,7 +68,7 @@ Plant = function(spawnPosition, spawnRotation) { }); - var WATER_CAN_MODEL_URL = "atp:/models/waterCan.fbx"; + var WATER_CAN_MODEL_URL = "atp:/growingPlant/waterCan.fbx"; var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation))); var waterCanRotation = orientation; @@ -84,7 +84,7 @@ Plant = function(spawnPosition, spawnRotation) { z: 0.4115 }, position: waterCanPosition, - collisionSoundURL: "atp:/sounds/watering_can_drop.L.wav", + collisionSoundURL: "atp:/growingPlant/watering_can_drop.L.wav", angularDamping: 1, dynamic: true, gravity: {