mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-24 17:31:54 +00:00
remove useless code
This commit is contained in:
parent
6f3f1f1985
commit
fcb2f58986
1 changed files with 2 additions and 40 deletions
|
@ -1,16 +1,14 @@
|
||||||
import { Application } from "@pixi/app";
|
import { Application } from "@pixi/app";
|
||||||
import { Assets } from "@pixi/assets";
|
import { Assets } from "@pixi/assets";
|
||||||
import { Resource, Texture } from "@pixi/core";
|
|
||||||
import { Container } from "@pixi/display";
|
import { Container } from "@pixi/display";
|
||||||
import { Graphics } from "@pixi/graphics";
|
import { Graphics } from "@pixi/graphics";
|
||||||
import { Matrix } from "@pixi/math";
|
|
||||||
import { Sprite } from "@pixi/sprite";
|
import { Sprite } from "@pixi/sprite";
|
||||||
import { jsx } from "features/feature";
|
import { jsx } from "features/feature";
|
||||||
import { globalBus } from "game/events";
|
import { globalBus } from "game/events";
|
||||||
import { createLayer } from "game/layers";
|
import { createLayer } from "game/layers";
|
||||||
import { Persistent, persistent, State } from "game/persistence";
|
import { Persistent, persistent, State } from "game/persistence";
|
||||||
import player from "game/player";
|
import player from "game/player";
|
||||||
import { format, formatWhole } from "util/bignum";
|
import { formatWhole } from "util/bignum";
|
||||||
import { Direction } from "util/common";
|
import { Direction } from "util/common";
|
||||||
import { computed, ComputedRef, reactive, ref, watchEffect } from "vue";
|
import { computed, ComputedRef, reactive, ref, watchEffect } from "vue";
|
||||||
import conveyor from "./factory-components/conveyor.png";
|
import conveyor from "./factory-components/conveyor.png";
|
||||||
|
@ -28,12 +26,6 @@ const day = 20;
|
||||||
// 20x20 block size
|
// 20x20 block size
|
||||||
// TODO: unhardcode stuff
|
// TODO: unhardcode stuff
|
||||||
|
|
||||||
enum FactoryDirections {
|
|
||||||
Any = "ANY",
|
|
||||||
None = "NONE"
|
|
||||||
}
|
|
||||||
type FactoryDirection = FactoryDirections | Direction;
|
|
||||||
|
|
||||||
function roundDownTo(num: number, multiple: number) {
|
function roundDownTo(num: number, multiple: number) {
|
||||||
return Math.floor((num + multiple / 2) / multiple) * multiple;
|
return Math.floor((num + multiple / 2) / multiple) * multiple;
|
||||||
}
|
}
|
||||||
|
@ -44,20 +36,6 @@ function getRelativeCoords(e: MouseEvent) {
|
||||||
y: e.clientY - rect.top
|
y: e.clientY - rect.top
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function iterateDirection(dir: FactoryDirection, func: (dir: FactoryDirection) => void) {
|
|
||||||
switch (dir) {
|
|
||||||
case FactoryDirections.None:
|
|
||||||
return;
|
|
||||||
case FactoryDirections.Any:
|
|
||||||
func(Direction.Up);
|
|
||||||
func(Direction.Right);
|
|
||||||
func(Direction.Down);
|
|
||||||
func(Direction.Left);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
func(dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function rotateDir(dir: Direction, relative = Direction.Right) {
|
function rotateDir(dir: Direction, relative = Direction.Right) {
|
||||||
const directions = [Direction.Up, Direction.Right, Direction.Down, Direction.Left];
|
const directions = [Direction.Up, Direction.Right, Direction.Down, Direction.Left];
|
||||||
let index = directions.indexOf(dir);
|
let index = directions.indexOf(dir);
|
||||||
|
@ -284,20 +262,6 @@ const factory = createLayer(id, () => {
|
||||||
app.stage.sortableChildren = true;
|
app.stage.sortableChildren = true;
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
|
||||||
function resetContainers() {
|
|
||||||
spriteContainer.destroy({ children: true });
|
|
||||||
movingBlocks.destroy({ children: true });
|
|
||||||
spriteContainer = new Container();
|
|
||||||
movingBlocks = new Container();
|
|
||||||
graphicContainer.zIndex = 1;
|
|
||||||
/*graphicContainer.position.x = 0.5
|
|
||||||
graphicContainer.position.y = 0.5
|
|
||||||
movingBlocks.position.x = 0.5
|
|
||||||
movingBlocks.position.y = 0.5*/
|
|
||||||
movingBlocks.zIndex = 2;
|
|
||||||
app.stage.addChild(spriteContainer, movingBlocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
globalBus.on("onLoad", async () => {
|
globalBus.on("onLoad", async () => {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
|
||||||
|
@ -340,10 +304,9 @@ const factory = createLayer(id, () => {
|
||||||
(window as any).internal = compInternalData;
|
(window as any).internal = compInternalData;
|
||||||
(window as any).comp = components;
|
(window as any).comp = components;
|
||||||
(window as any).blocks = movingBlocks;
|
(window as any).blocks = movingBlocks;
|
||||||
let taskIsRunning = false;
|
|
||||||
|
|
||||||
globalBus.on("update", diff => {
|
globalBus.on("update", diff => {
|
||||||
if (taskIsRunning || !loaded) return;
|
if (!loaded) return;
|
||||||
//debugger
|
//debugger
|
||||||
// make them produce
|
// make them produce
|
||||||
for (const id in components.value) {
|
for (const id in components.value) {
|
||||||
|
@ -544,7 +507,6 @@ const factory = createLayer(id, () => {
|
||||||
movingBlocks.addChild(sprite);
|
movingBlocks.addChild(sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskIsRunning = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function addFactoryComp(
|
function addFactoryComp(
|
||||||
|
|
Loading…
Reference in a new issue