@adatechnology/game-vehicles 0.2.0 → 0.3.0
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 +14 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.global.js +1723 -135
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ pnpm add @adatechnology/game-vehicles three
|
|
|
18
18
|
Browser without a bundler (the global is `GameVehicles`):
|
|
19
19
|
|
|
20
20
|
```html
|
|
21
|
-
<script src="https://unpkg.com/three@0.
|
|
21
|
+
<script src="https://unpkg.com/three@0.160.1/build/three.min.js"></script>
|
|
22
22
|
<script src="https://unpkg.com/@adatechnology/game-vehicles/dist/index.global.js"></script>
|
|
23
23
|
<script>
|
|
24
24
|
const kit = GameVehicles.createVehicleKit({ THREE })
|
|
@@ -201,6 +201,13 @@ Plain DOM and SVG, no framework: `ui.damageMap(host, c, { selected, onSelect })`
|
|
|
201
201
|
ones in a strip below); `ui.bandButtons`, `ui.legend`, `ui.healthBar({ text, bar }, c)`, `ui.scenarioButtons`. `ui.injectStyles()` adds minimal CSS
|
|
202
202
|
(`--panel-2`, `--line` and `--muted` customise it).
|
|
203
203
|
|
|
204
|
+
## Geometry
|
|
205
|
+
|
|
206
|
+
The kit's three is `shapeGeometries(THREE)` of `@adatechnology/game-shapes-three`, thinned by the light mode: boxes, cylinders, cones, spheres,
|
|
207
|
+
planes, circles, rings, tori, the tyre lathes and the straight-edged extrusions are made by game-shapes, bit-identical to three's
|
|
208
|
+
(`tests/exact-golden.test.ts`, and the fleet's and `game-vehicles-three`'s) and cached by parameters across vehicles. Tubes, curved
|
|
209
|
+
extrusions, the lofted bodies and the warps stay three's own or the kit's custom buffers. The IIFE build bundles game-shapes.
|
|
210
|
+
|
|
204
211
|
## Determinism and old seeds
|
|
205
212
|
|
|
206
213
|
The random stream of a zone is seeded from the vehicle key, the zone id and the band. The first version of this engine used Portuguese ids, so ids
|
|
@@ -241,6 +248,12 @@ car.animations() // open/close clips for the doors, hood and trunk
|
|
|
241
248
|
|
|
242
249
|
Fluids: the tank, the oil pan and the radiator hold fuel, oil and coolant; a hole below the level makes a `leak` event, a puddle and a falling level.
|
|
243
250
|
|
|
251
|
+
Fuel tank: a bullet that goes through it **leaks and does not set it alight by itself**. The leak lights (event `ignite`, then the usual fire and, for a petrol tank, the explosion) with
|
|
252
|
+
a spark of a hard round on the steel wall, an incendiary or tracer round, a burning part or burning fuel stain within `ignition.fireNear.radius`, or a blast. The chances of the round
|
|
253
|
+
come in `Hit.ignition` (the weapons build them from the core and jacket of the ammunition) and are weighed by how full the tank is (`fuel`, 0 to 1, the starting level; a nearly empty tank lights
|
|
254
|
+
easiest, a full one mostly leaks); diesel takes a spark far worse than petrol. `createVehicleDestructible(kit, vehicle, { fuel: 0.1, ignition: { fillCurve, fireNear, sparkTarget } })`;
|
|
255
|
+
the defaults and every number are `IgnitionRules` of `@adatechnology/game-contracts`.
|
|
256
|
+
|
|
244
257
|
## Português
|
|
245
258
|
|
|
246
259
|
Motor genérico de veículos procedurais para three.js: carrocerias, vidros, faróis, rodas, interiores, capô e compartimento do motor, **zonas de dano
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolKind, JointKind, Vec3, MaterialId, DestructibleImpl, AnimationClipSpec } from '@adatechnology/game-contracts';
|
|
1
|
+
import { ToolKind, JointKind, Vec3, MaterialId, DestructibleImpl, AnimationClipSpec, IgnitionRules } from '@adatechnology/game-contracts';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Light mode ("lite"): the same vehicles with fewer triangles, for a whole street of them. Port of the `[LOD]` hooks of the team's Frota Leve
|
|
@@ -844,6 +844,15 @@ interface VehicleDestructibleOptions {
|
|
|
844
844
|
headless?: boolean;
|
|
845
845
|
/** Extra seed for the choices that are random in the real world (which way a broken steering pulls). */
|
|
846
846
|
seed?: number;
|
|
847
|
+
/** How full the fuel tank starts, 0 to 1 (default 1). A nearly empty tank leaks little and lights easily (see `ignition`). */
|
|
848
|
+
fuel?: number;
|
|
849
|
+
/**
|
|
850
|
+
* What lights the fuel that leaks from a pierced tank: a plain bullet only leaks; a spark of a hard round on steel, an incendiary or tracer
|
|
851
|
+
* round, a fire within `fireNear.radius` (a burning part or a burning fuel stain) or a blast lights it, and then the usual fire and explosion
|
|
852
|
+
* follow. The chance of the round is in `Hit.ignition`; this is the target side (how full the tank is, what the wall is, the fire near).
|
|
853
|
+
* Defaults and meaning of every number: `IgnitionRules` of `@adatechnology/game-contracts`.
|
|
854
|
+
*/
|
|
855
|
+
ignition?: Partial<IgnitionRules>;
|
|
847
856
|
}
|
|
848
857
|
/** What the vehicle can do now, from the state of its hidden mechanics. */
|
|
849
858
|
interface VehicleStatus {
|