After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 233 KiB |
After Width: | Height: | Size: 281 KiB |
After Width: | Height: | Size: 287 KiB |
After Width: | Height: | Size: 283 KiB |
After Width: | Height: | Size: 286 KiB |
After Width: | Height: | Size: 260 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 279 KiB |
Before Width: | Height: | Size: 701 KiB After Width: | Height: | Size: 703 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 854 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 649 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 703 B |
Before Width: | Height: | Size: 642 B After Width: | Height: | Size: 647 B |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 513 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 649 B |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 498 B |
After Width: | Height: | Size: 705 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 651 B |
After Width: | Height: | Size: 525 B |
After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 706 B |
After Width: | Height: | Size: 651 B |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 515 B |
@ -0,0 +1,79 @@
|
||||
import { generateMatrixRotations } from "../../core/utils";
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
const overlayMatrix = generateMatrixRotations([1, 1, 0, 1, 1, 1, 0, 1, 0]);
|
||||
|
||||
export class MetaAnalyzerBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("analyzer");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#3a52bc";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getIsUnlocked(root) {
|
||||
// @todo
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @returns {"wires"} **/
|
||||
getLayer() {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getRenderPins() {
|
||||
// We already have it included
|
||||
return false;
|
||||
}
|
||||
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant) {
|
||||
return overlayMatrix[rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.analyzer,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
export class MetaComparatorBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("comparator");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#823cab";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getIsUnlocked(root) {
|
||||
// @todo
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @returns {"wires"} **/
|
||||
getLayer() {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getRenderPins() {
|
||||
// We already have it included
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.compare,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
import { generateMatrixRotations } from "../../core/utils";
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
/** @enum {string} */
|
||||
export const enumTransistorVariants = {
|
||||
mirrored: "mirrored",
|
||||
};
|
||||
|
||||
const overlayMatrices = {
|
||||
[defaultBuildingVariant]: generateMatrixRotations([0, 1, 0, 1, 1, 0, 0, 1, 0]),
|
||||
[enumTransistorVariants.mirrored]: generateMatrixRotations([0, 1, 0, 0, 1, 1, 0, 1, 0]),
|
||||
};
|
||||
|
||||
export class MetaTransistorBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("transistor");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#bc3a61";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getIsUnlocked(root) {
|
||||
// @todo
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @returns {"wires"} **/
|
||||
getLayer() {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [defaultBuildingVariant, enumTransistorVariants.mirrored];
|
||||
}
|
||||
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant) {
|
||||
return overlayMatrices[variant][rotation];
|
||||
}
|
||||
|
||||
getRenderPins() {
|
||||
// We already have it included
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
entity.components.WiredPins.slots[1].direction =
|
||||
variant === enumTransistorVariants.mirrored ? enumDirection.right : enumDirection.left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.transistor,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|