mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 13:56:24 +02:00
plant stuffs
This commit is contained in:
parent
b15e182e80
commit
12f8d83a6f
2 changed files with 23 additions and 16 deletions
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue