mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Change the history key to uid so that you can record even if there is no contents.
This commit is contained in:
parent
71fbf8cad9
commit
a550adc14a
@ -66,11 +66,10 @@ export class ProductionAnalytics extends BasicSerializableObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} uid
|
* @param {number} uid
|
||||||
* @param {BaseItem} item
|
|
||||||
* @param {number} count
|
* @param {number} count
|
||||||
*/
|
*/
|
||||||
onItemDeliveredToStorage(uid, item, count) {
|
onItemDeliveredToStorage(uid, count) {
|
||||||
const key = uid + "," + item.serialize();
|
const key = uid.toString();
|
||||||
const entry = this.history[enumAnalyticsDataSource.deliveredToStorage];
|
const entry = this.history[enumAnalyticsDataSource.deliveredToStorage];
|
||||||
entry[entry.length - 1][key] = (entry[entry.length - 1][key] || 0) + count;
|
entry[entry.length - 1][key] = (entry[entry.length - 1][key] || 0) + count;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,7 +165,7 @@ export class GameRoot {
|
|||||||
|
|
||||||
shapeDelivered: /** @type {TypedSignal<[ShapeDefinition]>} */ (new Signal()),
|
shapeDelivered: /** @type {TypedSignal<[ShapeDefinition]>} */ (new Signal()),
|
||||||
itemProduced: /** @type {TypedSignal<[BaseItem]>} */ (new Signal()),
|
itemProduced: /** @type {TypedSignal<[BaseItem]>} */ (new Signal()),
|
||||||
itemDeliveredToStorage: /** @type {TypedSignal<[number, BaseItem, number]>} */ (new Signal()),
|
itemDeliveredToStorage: /** @type {TypedSignal<[number, number]>} */ (new Signal()),
|
||||||
|
|
||||||
bulkOperationFinished: /** @type {TypedSignal<[]>} */ (new Signal()),
|
bulkOperationFinished: /** @type {TypedSignal<[]>} */ (new Signal()),
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,7 @@ export class StorageSystem extends GameSystemWithFilter {
|
|||||||
|
|
||||||
// Analytics hook
|
// Analytics hook
|
||||||
if (storageComp.itemsToAnalyze > 0) {
|
if (storageComp.itemsToAnalyze > 0) {
|
||||||
this.root.signals.itemDeliveredToStorage.dispatch(
|
this.root.signals.itemDeliveredToStorage.dispatch(entity.uid, storageComp.itemsToAnalyze);
|
||||||
entity.uid,
|
|
||||||
storageComp.storedItem,
|
|
||||||
storageComp.itemsToAnalyze
|
|
||||||
);
|
|
||||||
storageComp.itemsToAnalyze = 0;
|
storageComp.itemsToAnalyze = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,11 +82,10 @@ export class StorageSystem extends GameSystemWithFilter {
|
|||||||
context.fillStyle = "#64666e";
|
context.fillStyle = "#64666e";
|
||||||
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
||||||
} else if (storageComp.displayType === enumStorageDisplayType.rate) {
|
} else if (storageComp.displayType === enumStorageDisplayType.rate) {
|
||||||
const shapeKey = entity.uid.toString() + "," + storageComp.storedItem.serialize();
|
|
||||||
let rate =
|
let rate =
|
||||||
(this.root.productionAnalytics.getCurrentShapeRate(
|
(this.root.productionAnalytics.getCurrentShapeRate(
|
||||||
enumAnalyticsDataSource.deliveredToStorage,
|
enumAnalyticsDataSource.deliveredToStorage,
|
||||||
shapeKey
|
entity.uid.toString()
|
||||||
) /
|
) /
|
||||||
globalConfig.analyticsSliceDurationSeconds) *
|
globalConfig.analyticsSliceDurationSeconds) *
|
||||||
60;
|
60;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user