@adatechnology/game-vehicles-fleet 0.0.0-stage → 2.0.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 CHANGED
@@ -1,3 +1,128 @@
1
- # Temporary Holding Version
1
+ # @adatechnology/game-vehicles-fleet
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The fleet for [`@adatechnology/game-vehicles`](../game-vehicles): 69 procedural vehicles in ten groups, the fuels, the group names, the generic crash texts and
4
+ five ready-made damage scenarios. It is a content pack: install it into a kit and every vehicle is available to `kit.build(id, state)`.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ pnpm add @adatechnology/game-vehicles @adatechnology/game-vehicles-fleet three
10
+ ```
11
+
12
+ Browser without a bundler (the global is `GameVehiclesFleet`):
13
+
14
+ ```html
15
+ <script src="https://unpkg.com/three@0.160.0/build/three.min.js"></script>
16
+ <script src="https://unpkg.com/@adatechnology/game-vehicles/dist/index.global.js"></script>
17
+ <script src="https://unpkg.com/@adatechnology/game-vehicles-fleet/dist/index.global.js"></script>
18
+ <script>
19
+ const kit = GameVehicles.createVehicleKit({ THREE, locale: 'en' })
20
+ GameVehiclesFleet.installFleet(kit)
21
+ scene.add(kit.build('compact_hatch', 'damaged').group)
22
+ </script>
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```ts
28
+ import * as THREE from 'three'
29
+ import { createVehicleKit } from '@adatechnology/game-vehicles'
30
+ import { fleetPack, installFleet } from '@adatechnology/game-vehicles-fleet'
31
+
32
+ const kit = createVehicleKit({ THREE, locale: 'pt-BR' })
33
+ installFleet(kit) // everything
34
+ // or: kit.plugin(fleetPack) // the same, as a plugin
35
+ // or: installFleet(kit, { groups: ['cars', 'air'], exclude: ['battle_tank'], scenarios: false })
36
+
37
+ const car = kit.build('compact_hatch', 'intact') // states: 'intact' | 'damaged' | 'modified'
38
+ ```
39
+
40
+ ## Options
41
+
42
+ | Option | Default | Meaning |
43
+ |---|---|---|
44
+ | `groups` | all ten | groups to install |
45
+ | `vehicles` | every vehicle of the groups | only these ids |
46
+ | `exclude` | none | ids to leave out |
47
+ | `scenarios` | `true` | register the five damage scenarios and make `front_crash` the default damage |
48
+
49
+ `createFleetPack(options)` returns a plugin with the options applied; `fleetPack` is the one with the defaults.
50
+
51
+ ## Exports
52
+
53
+ - `fleetPack`, `createFleetPack`, `installFleet`, `version`
54
+ - per group: `motorcycles`, `cars`, `suvs`, `pickups`, `vans`, `heavy`, `agricultural`, `military`, `water`, `air` (arrays of vehicle ids), `fleetGroups`, `fleetGroupIds`, `fleetVehicleIds`
55
+ - `createScenarios`, `scenarioIds`
56
+ - `enLocale`, `ptBrLocale`
57
+ - `legacyVehicleSeeds`, `legacyZoneIds`, `legacyGlassLabels`, `legacyScenarioSeeds` (the original Portuguese ids; see below)
58
+
59
+ ## Groups
60
+
61
+ | Group | Vehicles |
62
+ |---|---|
63
+ | `motorcycles` | 12 |
64
+ | `cars` | 15 |
65
+ | `suvs` | 4 |
66
+ | `pickups` | 4 |
67
+ | `vans` | 2 |
68
+ | `heavy` | 5 |
69
+ | `agricultural` | 1 |
70
+ | `military` | 8 |
71
+ | `water` | 7 (the group is marked as water in the kit) |
72
+ | `air` | 11 |
73
+
74
+ The ids of all 69 are in [MIGRATION.md](MIGRATION.md#vehicles) with their old keys and names.
75
+
76
+ ## Scenarios
77
+
78
+ `front_crash`, `left_side_crash`, `rollover`, `abandoned` and `burnt`. They are generic: the damage depends only on the vehicle. The scenario of the original game
79
+ with the horde is not here.
80
+
81
+ ## Locales
82
+
83
+ `src/locales/en.json` and `pt-BR.json` hold every text: group, fuel, scenario, vehicle (name, inspiration, description, seats, capacity, range...),
84
+ part, zone and pane labels, and the crash texts. The code has English ids only. `locale: 'pt-BR'` gives back the exact strings of the original
85
+ (the tests compare all of them).
86
+
87
+ ## Faithful to the original
88
+
89
+ The original ids (and glass labels) seed the random streams of looks and damage, so the pack keeps them in `src/legacy-seeds.ts` and passes them to the kit
90
+ (`seedKey`, `seedId`, `registerLegacySeeds`). Because of that, the same vehicle in the same state is the same scene as before. The tests hold a digest
91
+ (hash of the scene graph lines) produced by the original code for each of the 69 vehicles intact, damaged and modified, the zone ids and pt-BR labels, and the
92
+ result of each scenario. All 69 match. Do not rename the values in `legacy-seeds.ts`.
93
+
94
+ ## Left for the game adapter
95
+
96
+ The pack is generic, so these parts of the original plugin and vehicles stayed out. The game adds them with `kit.configure` and its own hooks:
97
+
98
+ - The texts of 14 zone effect keys: `panel`, `door`, `fender`, `side_panel`, `roof`, `lid`, `bumper`, `glass`, `windshield`, `underbody`, `deck`, `aircraft_cabin`,
99
+ `exhaust` and `cab` (`zoneEffects`), and the part effect text `glass` (`partEffects`). They tie the damage to the story of the game. Until it sets them the
100
+ kit falls back to the generic `panel` text.
101
+ - The story sentences of the descriptions of 16 vehicles: `electric_hatch`, `police_sedan`, `highway_police_sedan`, `commuter_motorcycle`, `trail_bike`,
102
+ `monster_truck`, `ambulance`, `box_truck`, `armored_truck`, `battle_tank`, `single_engine_plane`, `step_through_scooter`, `cruiser`, `v8_coupe`,
103
+ `light_attack_turboprop` and `attack_helicopter`. The pack keeps the part about the vehicle; the pt-BR strings are the original minus those sentences.
104
+ - The `fx` arrays of the game effects that were attached to zones.
105
+ - The horde: its scenario, the `horde` flag (torn mirrors, bite marks) and the `frontBlood` flag with the windshield splat after a crash.
106
+ - Blood: the blood fluid, the impact stain (`impactStain`, `defaultSplat`) and the default-damage hook that adds it.
107
+ - The plate text `ZMB4D23` and the `who` text of the game.
108
+ - The other game-level texts of the original `plugin.js`.
109
+
110
+ ## Português
111
+
112
+ Pacote de conteúdo com a frota do jogo: 69 veículos procedurais em dez grupos (motos, carros, SUVs, picapes, vans, caminhões e ônibus, agrícola, militares,
113
+ aquáticos e aéreos), os combustíveis, os nomes dos grupos, os textos genéricos de dano e cinco cenários de dano prontos. Ele usa o
114
+ `@adatechnology/game-vehicles`.
115
+
116
+ ```js
117
+ const kit = GameVehicles.createVehicleKit({ THREE, locale: 'pt-BR' })
118
+ GameVehiclesFleet.installFleet(kit) // ou installFleet(kit, { groups: ["cars"] })
119
+ const carro = kit.build('compact_hatch', 'damaged')
120
+ ```
121
+
122
+ Todo o texto em português fica em `src/locales/pt-BR.json`, exatamente como no original. Os ids antigos continuam semeando o visual e o dano, então cada
123
+ veículo sai idêntico ao original (os testes comparam hashes gerados pelo código original). O que é do jogo (zumbis, horda, sangue, placa ZMB) ficou de fora;
124
+ veja "Left for the game adapter". A tabela completa de nomes antigos e novos está em [MIGRATION.md](MIGRATION.md).
125
+
126
+ ## Measurements, paint and design cards
127
+
128
+ `fleetDims(id)` (length, width, height in metres as the team measured them), `paintPalettes` and `paletteOf(group)` (13 civil colours and 5 military), `colorFromSeed(seed, palette)` (the same seed gives the same colour; number or text), `fleetStats(id)` (six 0-10 ratings, noise radius, top speed) and `fleetCard(id)` (the design card texts, Brazilian Portuguese). The data are JSON files in `src/data/` written by `tools/vehicles-catalog` from the team's Frota Leve and Frota pages.