New building sprites
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 237 KiB After Width: | Height: | Size: 241 KiB |
Before Width: | Height: | Size: 553 KiB After Width: | Height: | Size: 572 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.8 KiB |
|
@ -20,7 +20,7 @@ export class MetaHubBuilding extends MetaBuilding {
|
||||||
return "#eb5555";
|
return "#eb5555";
|
||||||
}
|
}
|
||||||
|
|
||||||
isRotateable() {
|
getIsRotateable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class MetaLeverBuilding extends MetaBuilding {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
isRotateable() {
|
getIsRotateable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,11 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRenderPins() {
|
||||||
|
// We already have it included
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||||
super("trash");
|
super("trash");
|
||||||
}
|
}
|
||||||
|
|
||||||
isRotateable(variant) {
|
getIsRotateable(variant) {
|
||||||
return variant !== defaultBuildingVariant;
|
return variant !== defaultBuildingVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class MetaWireTunnelBuilding extends MetaBuilding {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
isRotateable() {
|
getIsRotateable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ export class MetaBuilding {
|
||||||
* @param {string} variant
|
* @param {string} variant
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isRotateable(variant) {
|
getIsRotateable(variant) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +172,14 @@ export class MetaBuilding {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should return false if the pins are already included in the sprite of the building
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
getRenderPins() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the entity without placing it
|
* Creates the entity without placing it
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
|
@ -225,7 +233,7 @@ export class MetaBuilding {
|
||||||
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
|
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
|
||||||
*/
|
*/
|
||||||
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
|
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
|
||||||
if (!this.isRotateable(variant)) {
|
if (!this.getIsRotateable(variant)) {
|
||||||
return {
|
return {
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
rotationVariant: 0,
|
rotationVariant: 0,
|
||||||
|
|
|
@ -169,26 +169,28 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
||||||
const tile = staticComp.localTileToWorld(slot.pos);
|
const tile = staticComp.localTileToWorld(slot.pos);
|
||||||
|
|
||||||
const worldPos = tile.toWorldSpaceCenterOfTile();
|
const worldPos = tile.toWorldSpaceCenterOfTile();
|
||||||
|
|
||||||
const effectiveRotation = Math.radians(
|
const effectiveRotation = Math.radians(
|
||||||
staticComp.rotation + enumDirectionToAngle[slot.direction]
|
staticComp.rotation + enumDirectionToAngle[slot.direction]
|
||||||
);
|
);
|
||||||
drawRotatedSprite({
|
|
||||||
parameters,
|
if (staticComp.getMetaBuilding().getRenderPins()) {
|
||||||
sprite: this.pinSprites[slot.type],
|
drawRotatedSprite({
|
||||||
x: worldPos.x,
|
parameters,
|
||||||
y: worldPos.y,
|
sprite: this.pinSprites[slot.type],
|
||||||
angle: effectiveRotation,
|
x: worldPos.x,
|
||||||
size: globalConfig.tileSize + 2,
|
y: worldPos.y,
|
||||||
offsetX: 0,
|
angle: effectiveRotation,
|
||||||
offsetY: 0,
|
size: globalConfig.tileSize + 2,
|
||||||
});
|
offsetX: 0,
|
||||||
|
offsetY: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Draw contained item to visualize whats emitted
|
// Draw contained item to visualize whats emitted
|
||||||
const value = slot.value;
|
const value = slot.value;
|
||||||
if (value) {
|
if (value) {
|
||||||
const offset = new Vector(0, -5).rotated(effectiveRotation);
|
const offset = new Vector(0, -9).rotated(effectiveRotation);
|
||||||
value.draw(worldPos.x + offset.x, worldPos.y + offset.y, parameters, 12);
|
value.draw(worldPos.x + offset.x, worldPos.y + offset.y, parameters, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug view
|
// Debug view
|
||||||
|
|