@adatechnology/game-vegetation-three 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/index.global.js +1725 -198
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// src/test-area/module.ts
|
|
2
|
+
import { shapeGeometries as shapeGeometries2 } from "@adatechnology/game-shapes-three";
|
|
2
3
|
import * as GameVegetationMain from "@adatechnology/game-vegetation";
|
|
3
4
|
import * as GameVegetationAdapter from "@adatechnology/game-vegetation/three";
|
|
4
5
|
import * as GameVegetationSpeciesMain from "@adatechnology/game-vegetation-species";
|
|
5
6
|
|
|
6
7
|
// src/test-area/nursery.ts
|
|
8
|
+
import { shapeGeometries } from "@adatechnology/game-shapes-three";
|
|
7
9
|
var LOT = { W: 12, D: 20 };
|
|
8
10
|
var HOUSE = { x0: 2.5, x1: 9.5, z0: 6.5, z1: 13 };
|
|
9
11
|
var WAY = [[6, 1.2], [6, 5.4], [10.8, 5.4], [10.8, 14.2], [8, 18.6], [3, 18.6], [1.2, 14.2], [1.2, 5.4], [4, 3.2], [8, 3.2]];
|
|
@@ -78,6 +80,7 @@ function buildScenery(THREE) {
|
|
|
78
80
|
return g;
|
|
79
81
|
}
|
|
80
82
|
function createNursery(sdk, species, THREE, materials, parent, origin) {
|
|
83
|
+
const T = shapeGeometries(THREE);
|
|
81
84
|
const group = new THREE.Group();
|
|
82
85
|
group.name = "nursery";
|
|
83
86
|
group.position.set(origin[0], 0, origin[1]);
|
|
@@ -107,8 +110,8 @@ function createNursery(sdk, species, THREE, materials, parent, origin) {
|
|
|
107
110
|
const ensure = () => {
|
|
108
111
|
if (attached) return;
|
|
109
112
|
attached = true;
|
|
110
|
-
scenery = buildScenery(
|
|
111
|
-
const body =
|
|
113
|
+
scenery = buildScenery(T);
|
|
114
|
+
const body = T.CapsuleGeometry ? new T.CapsuleGeometry(0.28, 1, 4, 10) : new T.CylinderGeometry(0.28, 0.28, 1.56, 10);
|
|
112
115
|
actor = new THREE.Mesh(body, new THREE.MeshStandardMaterial({ color: 14254635, roughness: 0.7 }));
|
|
113
116
|
actor.castShadow = true;
|
|
114
117
|
actor.position.set(walker.x, 0.78, walker.z);
|
|
@@ -165,7 +168,7 @@ function createNursery(sdk, species, THREE, materials, parent, origin) {
|
|
|
165
168
|
});
|
|
166
169
|
dynamic.add(lotObject);
|
|
167
170
|
for (const c of data.colliders) {
|
|
168
|
-
const m = new THREE.Mesh(new
|
|
171
|
+
const m = new THREE.Mesh(new T.CylinderGeometry(c.r, c.r, c.h, 14, 1, true), new THREE.MeshBasicMaterial({ color: c.damage ? 16742938 : 15017245, wireframe: true }));
|
|
169
172
|
m.position.set(c.x, c.h / 2, c.z);
|
|
170
173
|
colliders.add(m);
|
|
171
174
|
}
|
|
@@ -241,6 +244,7 @@ function createNursery(sdk, species, THREE, materials, parent, origin) {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
// src/test-area/plants.ts
|
|
247
|
+
import { markKitOrigin } from "@adatechnology/game-contracts";
|
|
244
248
|
var PLANT_SEED = 3;
|
|
245
249
|
var PLANT_DEFS = [
|
|
246
250
|
{ id: "mango_tree", kind: "tree", sway: true },
|
|
@@ -283,7 +287,7 @@ function createPlants(sdk, species, materials, seed = PLANT_SEED) {
|
|
|
283
287
|
return plant;
|
|
284
288
|
};
|
|
285
289
|
function buildObject(THREE, def) {
|
|
286
|
-
const root = new THREE.Group();
|
|
290
|
+
const root = markKitOrigin(new THREE.Group(), { owner: "game-vegetation-three", kind: "plant", id: def.base ?? def.id });
|
|
287
291
|
root.name = def.id;
|
|
288
292
|
const segments = def.segments ?? 1;
|
|
289
293
|
let spacing = 0;
|
|
@@ -989,7 +993,7 @@ function createVegetationTestModule(options = {}) {
|
|
|
989
993
|
};
|
|
990
994
|
if (host.bench.layer("colliders") && root.userData.collider && root.userData.collider.kind) {
|
|
991
995
|
const c = root.userData.collider;
|
|
992
|
-
const wire = new three.Mesh(new three.CylinderGeometry(c.radius, c.radius, c.height, 14, 1, true), new three.MeshBasicMaterial({ color: root.userData.thorny ? 16742938 : 15017245, wireframe: true }));
|
|
996
|
+
const wire = new three.Mesh(new (shapeGeometries2(three)).CylinderGeometry(c.radius, c.radius, c.height, 14, 1, true), new three.MeshBasicMaterial({ color: root.userData.thorny ? 16742938 : 15017245, wireframe: true }));
|
|
993
997
|
wire.position.set(0, c.height / 2, 0);
|
|
994
998
|
mark(wire);
|
|
995
999
|
}
|
|
@@ -1158,9 +1162,9 @@ function createVegetationTestModule(options = {}) {
|
|
|
1158
1162
|
{ kind: "choice", id: "season", name: text.controls.season, hint: text.hints.season, options: ["spring", "summer", "autumn", "winter"].map((id) => ({ id, name: text.options.season[id] })), default: "spring" },
|
|
1159
1163
|
{ kind: "number", id: "wind", name: text.controls.wind, hint: text.hints.wind, min: 0, max: 1, step: 0.05, default: 0.35 },
|
|
1160
1164
|
{ kind: "number", id: "gust", name: text.controls.gust, hint: text.hints.gust, min: 0, max: 1, step: 0.05, default: 0.15 },
|
|
1161
|
-
{ kind: "action", id: "plant_lot", name: text.actions.plant_lot },
|
|
1165
|
+
{ kind: "action", id: "plant_lot", name: text.actions.plant_lot, slow: true },
|
|
1162
1166
|
{ kind: "action", id: "clear_lot", name: text.actions.clear_lot },
|
|
1163
|
-
{ kind: "action", id: "toggle_walker", name: text.actions.toggle_walker }
|
|
1167
|
+
{ kind: "action", id: "toggle_walker", name: text.actions.toggle_walker, slow: true }
|
|
1164
1168
|
],
|
|
1165
1169
|
layers: () => ["colliders", "piece_boxes", "wood_axes"].map((id) => ({ id, name: text.layers[id], default: false })),
|
|
1166
1170
|
metrics: () => [
|