mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Merge pull request #403 from Danacus/master
Fix preferred variant not getting saved when clicking on the hud
This commit is contained in:
commit
e46dd4e00b
@ -216,7 +216,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
|||||||
consumeEvents: true,
|
consumeEvents: true,
|
||||||
targetOnly: true,
|
targetOnly: true,
|
||||||
});
|
});
|
||||||
detector.click.add(() => this.currentVariant.set(variant));
|
detector.click.add(() => this.setVariant(variant));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,12 +523,20 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
);
|
);
|
||||||
const newIndex = (index + 1) % availableVariants.length;
|
const newIndex = (index + 1) % availableVariants.length;
|
||||||
const newVariant = availableVariants[newIndex];
|
const newVariant = availableVariants[newIndex];
|
||||||
this.currentVariant.set(newVariant);
|
this.setVariant(newVariant);
|
||||||
|
|
||||||
this.preferredVariants[metaBuilding.getId()] = newVariant;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current variant to the given variant
|
||||||
|
*/
|
||||||
|
setVariant(variant) {
|
||||||
|
const metaBuilding = this.currentMetaBuilding.get();
|
||||||
|
this.currentVariant.set(variant);
|
||||||
|
|
||||||
|
this.preferredVariants[metaBuilding.getId()] = variant;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the direction locked placement between two points after
|
* Performs the direction locked placement between two points after
|
||||||
* releasing the mouse
|
* releasing the mouse
|
||||||
|
Loading…
Reference in New Issue
Block a user