@adatechnology/game-items 0.2.0 → 0.2.2
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/dist/index.global.js +73 -1
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -61,12 +61,45 @@ var GameItems = (() => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// ../game-contracts/dist/index.js
|
|
64
|
+
var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
|
|
64
65
|
var sealBlock = (seal, state) => {
|
|
65
66
|
if (seal.spoilsWhenBreached && state.breached) return "breached";
|
|
66
67
|
if (seal.spoilsWhenBreached && state.leaked) return "leaked";
|
|
67
68
|
if (!state.opened) return "sealed";
|
|
68
69
|
return void 0;
|
|
69
70
|
};
|
|
71
|
+
var DEFERRED_QUEUE_ID = {
|
|
72
|
+
DESTRUCTION_EVENTS: "destruction.events",
|
|
73
|
+
BREACH_PAINT: "floorplan.breach-paint",
|
|
74
|
+
AUDIO_VOICES: "audio.voices",
|
|
75
|
+
VEHICLE_CREASE: "vehicles.crease"
|
|
76
|
+
};
|
|
77
|
+
var DEFERRED_PRIORITY = {
|
|
78
|
+
[DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS]: { priority: 300, phase: "present" },
|
|
79
|
+
[DEFERRED_QUEUE_ID.BREACH_PAINT]: { priority: 250, phase: "present" },
|
|
80
|
+
[DEFERRED_QUEUE_ID.AUDIO_VOICES]: { priority: 200, phase: "idle", reserveMs: 1 },
|
|
81
|
+
[DEFERRED_QUEUE_ID.VEHICLE_CREASE]: { priority: 100, phase: "idle" }
|
|
82
|
+
};
|
|
83
|
+
var WARNED_KEY = /* @__PURE__ */ Symbol.for("@adatechnology/game-contracts.warned");
|
|
84
|
+
var warnedKeys = () => {
|
|
85
|
+
const holder = globalThis;
|
|
86
|
+
return holder[WARNED_KEY] ?? (holder[WARNED_KEY] = /* @__PURE__ */ new Set());
|
|
87
|
+
};
|
|
88
|
+
var isProduction = () => {
|
|
89
|
+
try {
|
|
90
|
+
return process.env.NODE_ENV === "production";
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var isQuiet = () => globalThis.__GAME_KIT_QUIET__ === true;
|
|
96
|
+
var warnOnce = (key, message) => {
|
|
97
|
+
if (isQuiet() || isProduction()) return;
|
|
98
|
+
const seen = warnedKeys();
|
|
99
|
+
if (seen.has(key)) return;
|
|
100
|
+
seen.add(key);
|
|
101
|
+
console.warn(`[game-kit] ${message}`);
|
|
102
|
+
};
|
|
70
103
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
71
104
|
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
72
105
|
var deepMerge = (base, patch) => {
|
|
@@ -88,11 +121,50 @@ var GameItems = (() => {
|
|
|
88
121
|
for (const [id, patch] of Object.entries(patches ?? {})) {
|
|
89
122
|
const entry = entries.get(id);
|
|
90
123
|
if (entry) entries.set(id, deepMerge(entry, patch));
|
|
124
|
+
else warnOnce(`registry.patch.${id}`, `patch for "${id}" ignored: no entry has that id`);
|
|
91
125
|
}
|
|
92
126
|
};
|
|
93
127
|
var removeIds = (entries, ids) => {
|
|
94
|
-
for (const id of ids ?? [])
|
|
128
|
+
for (const id of ids ?? []) {
|
|
129
|
+
if (!entries.delete(id)) warnOnce(`registry.remove.${id}`, `remove of "${id}" ignored: no entry has that id`);
|
|
130
|
+
}
|
|
95
131
|
};
|
|
132
|
+
var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
|
|
133
|
+
var GAIT_IDS = ["walk", "run"];
|
|
134
|
+
var LANDING_IDS = ["light", "heavy"];
|
|
135
|
+
var BODY_SOUND_IDS = [
|
|
136
|
+
"jump",
|
|
137
|
+
"cloth_rustle",
|
|
138
|
+
"body_fall",
|
|
139
|
+
"fall_damage",
|
|
140
|
+
"player_hurt",
|
|
141
|
+
"player_breath_run",
|
|
142
|
+
"player_death",
|
|
143
|
+
"bite",
|
|
144
|
+
"grab",
|
|
145
|
+
"punch_swing",
|
|
146
|
+
"punch_hit_body",
|
|
147
|
+
"punch_hit_face",
|
|
148
|
+
"punch_hit_object",
|
|
149
|
+
"kick_swing",
|
|
150
|
+
"kick_hit",
|
|
151
|
+
"kick_hit_object",
|
|
152
|
+
"shove_two_hands",
|
|
153
|
+
"knife_swing",
|
|
154
|
+
"knife_stab",
|
|
155
|
+
"knife_slash",
|
|
156
|
+
"knife_hit_object",
|
|
157
|
+
"blunt_swing",
|
|
158
|
+
"blunt_hit",
|
|
159
|
+
"blunt_hit_object",
|
|
160
|
+
"axe_swing",
|
|
161
|
+
"axe_chop",
|
|
162
|
+
"axe_hit_object"
|
|
163
|
+
];
|
|
164
|
+
var footstepSoundId = (surface, gait) => `footstep_${surface}_${gait}`;
|
|
165
|
+
var FOOTSTEP_SOUND_IDS = SURFACE_IDS.flatMap((surface) => GAIT_IDS.map((gait) => footstepSoundId(surface, gait)));
|
|
166
|
+
var LAND_SOUND_IDS = SURFACE_IDS.flatMap((surface) => LANDING_IDS.map((landing) => `land_${surface}_${landing}`));
|
|
167
|
+
var BODY_FOLEY_IDS = [...FOOTSTEP_SOUND_IDS, ...LAND_SOUND_IDS, ...BODY_SOUND_IDS];
|
|
96
168
|
|
|
97
169
|
// src/categories.ts
|
|
98
170
|
var ITEM_CATEGORIES = [
|