1
0
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:
isaisstillalive 2020-07-01 23:28:10 +09:00
parent 71fbf8cad9
commit a550adc14a
3 changed files with 5 additions and 11 deletions

View File

@ -66,11 +66,10 @@ export class ProductionAnalytics extends BasicSerializableObject {
/**
* @param {number} uid
* @param {BaseItem} item
* @param {number} count
*/
onItemDeliveredToStorage(uid, item, count) {
const key = uid + "," + item.serialize();
onItemDeliveredToStorage(uid, count) {
const key = uid.toString();
const entry = this.history[enumAnalyticsDataSource.deliveredToStorage];
entry[entry.length - 1][key] = (entry[entry.length - 1][key] || 0) + count;
}

View File

@ -165,7 +165,7 @@ export class GameRoot {
shapeDelivered: /** @type {TypedSignal<[ShapeDefinition]>} */ (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()),

View File

@ -24,11 +24,7 @@ export class StorageSystem extends GameSystemWithFilter {
// Analytics hook
if (storageComp.itemsToAnalyze > 0) {
this.root.signals.itemDeliveredToStorage.dispatch(
entity.uid,
storageComp.storedItem,
storageComp.itemsToAnalyze
);
this.root.signals.itemDeliveredToStorage.dispatch(entity.uid, storageComp.itemsToAnalyze);
storageComp.itemsToAnalyze = 0;
}
@ -86,11 +82,10 @@ export class StorageSystem extends GameSystemWithFilter {
context.fillStyle = "#64666e";
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
} else if (storageComp.displayType === enumStorageDisplayType.rate) {
const shapeKey = entity.uid.toString() + "," + storageComp.storedItem.serialize();
let rate =
(this.root.productionAnalytics.getCurrentShapeRate(
enumAnalyticsDataSource.deliveredToStorage,
shapeKey
entity.uid.toString()
) /
globalConfig.analyticsSliceDurationSeconds) *
60;