mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-16 19:51:50 +00:00
Fixed achievements not working after reset (May impact performance on large factories)
This commit is contained in:
parent
667e411011
commit
0c5538d626
@ -90,6 +90,8 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
* @returns {[ShapeDefinition, ShapeDefinition]}
|
* @returns {[ShapeDefinition, ShapeDefinition]}
|
||||||
*/
|
*/
|
||||||
shapeActionCutHalf(definition) {
|
shapeActionCutHalf(definition) {
|
||||||
|
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.cutShape, null);
|
||||||
|
|
||||||
const key = "cut/" + definition.getHash();
|
const key = "cut/" + definition.getHash();
|
||||||
if (this.operationCache[key]) {
|
if (this.operationCache[key]) {
|
||||||
return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key]);
|
return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key]);
|
||||||
@ -97,8 +99,6 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
const rightSide = definition.cloneFilteredByQuadrants([2, 3]);
|
const rightSide = definition.cloneFilteredByQuadrants([2, 3]);
|
||||||
const leftSide = definition.cloneFilteredByQuadrants([0, 1]);
|
const leftSide = definition.cloneFilteredByQuadrants([0, 1]);
|
||||||
|
|
||||||
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.cutShape, null);
|
|
||||||
|
|
||||||
return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key] = [
|
return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key] = [
|
||||||
this.registerOrReturnHandle(rightSide),
|
this.registerOrReturnHandle(rightSide),
|
||||||
this.registerOrReturnHandle(leftSide),
|
this.registerOrReturnHandle(leftSide),
|
||||||
@ -133,6 +133,8 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
* @returns {ShapeDefinition}
|
* @returns {ShapeDefinition}
|
||||||
*/
|
*/
|
||||||
shapeActionRotateCW(definition) {
|
shapeActionRotateCW(definition) {
|
||||||
|
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.rotateShape, null);
|
||||||
|
|
||||||
const key = "rotate-cw/" + definition.getHash();
|
const key = "rotate-cw/" + definition.getHash();
|
||||||
if (this.operationCache[key]) {
|
if (this.operationCache[key]) {
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
||||||
@ -140,8 +142,6 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
|
|
||||||
const rotated = definition.cloneRotateCW();
|
const rotated = definition.cloneRotateCW();
|
||||||
|
|
||||||
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.rotateShape, null);
|
|
||||||
|
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
||||||
rotated
|
rotated
|
||||||
));
|
));
|
||||||
@ -190,13 +190,13 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
* @returns {ShapeDefinition}
|
* @returns {ShapeDefinition}
|
||||||
*/
|
*/
|
||||||
shapeActionStack(lowerDefinition, upperDefinition) {
|
shapeActionStack(lowerDefinition, upperDefinition) {
|
||||||
|
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.stackShape, null);
|
||||||
|
|
||||||
const key = "stack/" + lowerDefinition.getHash() + "/" + upperDefinition.getHash();
|
const key = "stack/" + lowerDefinition.getHash() + "/" + upperDefinition.getHash();
|
||||||
if (this.operationCache[key]) {
|
if (this.operationCache[key]) {
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.stackShape, null);
|
|
||||||
|
|
||||||
const stacked = lowerDefinition.cloneAndStackWith(upperDefinition);
|
const stacked = lowerDefinition.cloneAndStackWith(upperDefinition);
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
||||||
stacked
|
stacked
|
||||||
@ -210,13 +210,13 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
* @returns {ShapeDefinition}
|
* @returns {ShapeDefinition}
|
||||||
*/
|
*/
|
||||||
shapeActionPaintWith(definition, color) {
|
shapeActionPaintWith(definition, color) {
|
||||||
|
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.paintShape, null);
|
||||||
|
|
||||||
const key = "paint/" + definition.getHash() + "/" + color;
|
const key = "paint/" + definition.getHash() + "/" + color;
|
||||||
if (this.operationCache[key]) {
|
if (this.operationCache[key]) {
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.paintShape, null);
|
|
||||||
|
|
||||||
const colorized = definition.cloneAndPaintWith(color);
|
const colorized = definition.cloneAndPaintWith(color);
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
||||||
colorized
|
colorized
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user