Add new analytics schema and fix tslint issues

pull/33/head
tobspr 4 years ago
parent de597b66e8
commit 9806b1df6c

@ -107,8 +107,6 @@ declare interface Window {
assert(condition: boolean, failureMessage: string);
coreThreadLoadedCb();
gameanalytics: typeof import("./game_analytics");
}
declare interface Navigator {

@ -137,7 +137,8 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
ingameTime: root.time.now(),
category,
value,
gameDump: this.generateGameDump(root),
version: G_BUILD_VERSION,
gameDump: this.generateGameDump(root, category === "sync"),
});
}
@ -152,14 +153,15 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
/**
* Generates a game dump
* @param {GameRoot} root
* @param {boolean=} metaOnly
*/
generateGameDump(root) {
generateGameDump(root, metaOnly = false) {
let staticEntities = [];
const entities = root.entityMgr.getAllWithComponent(StaticMapEntityComponent);
// Limit the entities
if (entities.length < 5000) {
if (!metaOnly && entities.length < 500) {
for (let i = 0; i < entities.length; ++i) {
const entity = entities[i];
const staticComp = entity.components.StaticMapEntity;

@ -34,10 +34,12 @@ export class StorageImplBrowserIndexedDB extends StorageInterface {
reject("Indexed DB access error");
};
// @ts-ignore
request.onsuccess = event => resolve(event.target.result);
request.onupgradeneeded = /** @type {IDBVersionChangeEvent} */ event => {
/** @type {IDBDatabase} */
// @ts-ignore
const database = event.target.result;
const objectStore = database.createObjectStore("files", {

@ -122,6 +122,7 @@ export class MainMenuState extends GameState {
const closeLoader = this.dialogs.showLoadingDialog();
const reader = new FileReader();
reader.addEventListener("load", event => {
// @ts-ignore
const contents = event.target.result;
let realContent;

Loading…
Cancel
Save