@adatechnology/game-characters 0.1.4 → 0.1.6
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.d.ts +2 -0
- package/dist/index.global.js +7 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,8 @@ type CorpseLedger<TData> = {
|
|
|
320
320
|
add(data: TData): TData | undefined;
|
|
321
321
|
/** Ages every corpse by `dt` seconds and removes the ones past their life (swap with the last, like the game). Returns the removed data. */
|
|
322
322
|
update(dt: number): TData[];
|
|
323
|
+
/** Takes one corpse away (eaten, searched and dragged off): the last one moves into its place, like the game's `CP`. Returns its data. */
|
|
324
|
+
remove(index: number): TData | undefined;
|
|
323
325
|
clear(): void;
|
|
324
326
|
};
|
|
325
327
|
/** The bodies left on the ground: capped (400) and gone after a lifetime (900 s); generic over what each one carries. */
|
package/dist/index.global.js
CHANGED
|
@@ -294,6 +294,13 @@ var GameCharacters = (() => {
|
|
|
294
294
|
}
|
|
295
295
|
return removed;
|
|
296
296
|
},
|
|
297
|
+
remove(index) {
|
|
298
|
+
const entry = entries[index];
|
|
299
|
+
if (!entry) return void 0;
|
|
300
|
+
entries[index] = entries[entries.length - 1];
|
|
301
|
+
entries.pop();
|
|
302
|
+
return entry.data;
|
|
303
|
+
},
|
|
297
304
|
clear() {
|
|
298
305
|
entries.length = 0;
|
|
299
306
|
}
|