Further fixes to the belt placement

pull/33/head
Tobias Springer 4 years ago
parent 5a61d1813a
commit 5f3ffd42fd

@ -142,6 +142,8 @@ export class GameCore {
root: this.root, root: this.root,
origin: new Vector(-2, -2), origin: new Vector(-2, -2),
rotation: 0, rotation: 0,
originalRotation: 0,
rotationVariant: 0,
}); });
} }

@ -270,6 +270,7 @@ export class HUDBuildingPlacer extends BaseHUDPart {
origin: tile, origin: tile,
rotation, rotation,
rotationVariant, rotationVariant,
originalRotation: this.currentBaseRotation,
building: this.currentMetaBuilding.get(), building: this.currentMetaBuilding.get(),
}) })
) { ) {

@ -141,10 +141,11 @@ export class GameLogic {
* @param {object} param0 * @param {object} param0
* @param {Vector} param0.origin * @param {Vector} param0.origin
* @param {number} param0.rotation * @param {number} param0.rotation
* @param {number} param0.originalRotation
* @param {number} param0.rotationVariant * @param {number} param0.rotationVariant
* @param {MetaBuilding} param0.building * @param {MetaBuilding} param0.building
*/ */
tryPlaceBuilding({ origin, rotation, rotationVariant, building }) { tryPlaceBuilding({ origin, rotation, rotationVariant, originalRotation, building }) {
if (this.checkCanPlaceBuilding({ origin, rotation, rotationVariant, building })) { if (this.checkCanPlaceBuilding({ origin, rotation, rotationVariant, building })) {
// Remove any removeable entities below // Remove any removeable entities below
const checker = new StaticMapEntityComponent({ const checker = new StaticMapEntityComponent({
@ -172,6 +173,7 @@ export class GameLogic {
origin, origin,
rotation, rotation,
rotationVariant, rotationVariant,
originalRotation,
}); });
return true; return true;
} }

@ -102,16 +102,17 @@ export class MetaBuilding {
* @param {GameRoot} param0.root * @param {GameRoot} param0.root
* @param {Vector} param0.origin Origin tile * @param {Vector} param0.origin Origin tile
* @param {number=} param0.rotation Rotation * @param {number=} param0.rotation Rotation
* @param {number=} param0.originalRotation Original Rotation
* @param {number=} param0.rotationVariant Rotation variant * @param {number=} param0.rotationVariant Rotation variant
*/ */
createAndPlaceEntity({ root, origin, rotation = 0, rotationVariant = 0 }) { createAndPlaceEntity({ root, origin, rotation = 0, originalRotation = 0, rotationVariant = 0 }) {
const entity = new Entity(root); const entity = new Entity(root);
entity.addComponent( entity.addComponent(
new StaticMapEntityComponent({ new StaticMapEntityComponent({
spriteKey: "sprites/buildings/" + this.id + ".png", spriteKey: "sprites/buildings/" + this.id + ".png",
origin: new Vector(origin.x, origin.y), origin: new Vector(origin.x, origin.y),
rotation, rotation,
originalRotation: rotation, originalRotation,
tileSize: this.getDimensions().copy(), tileSize: this.getDimensions().copy(),
silhouetteColor: this.getSilhouetteColor(), silhouetteColor: this.getSilhouetteColor(),
}) })

Loading…
Cancel
Save