V7PGPHZNTW5HIJQBIM3W57YPS4LYID54XHZZXPFM6BRHLC3Z2B6QC pointNodeTexture: new Lazy(() => generatePointNodeTexture(props.args.renderer))
pointNodeTexture: new Lazy(() => generatePointNodeTexture(props.args.renderer)),tick: 0,playerIntents: {decreaseZLevel: {justDown: false,justUp: false,down: false},increaseZLevel: {justDown: false,justUp: false,down: false},}
didUpdate() {
didUpdate(prevProps: Props, props: Props) {const { updaters } = this.staleProps;// if we find ourselves a little idle, start pregenerating other layersif (this.state.tick > 60) {updaters.worldGen.zLevels.update((prev, prevGameState) => {if (!prev[-1]) {prev[-1] = new ZLevelGenFactory({}).create({ seed: prevGameState.worldGen.seed, z: 0 });return {...prev};} else {return prev;}})}if (this.state.tick > 120) {updaters.worldGen.zLevels.update((prev, prevGameState) => {if (!prev[1]) {prev[1] = new ZLevelGenFactory({}).create({ seed: prevGameState.worldGen.seed, z: 1 });return {...prev};} else {return prev;}})}
import * as Pixi from "pixi.js";import { PixiPointFrom } from "../../lib/pixi/pixify";import { Vector2 } from "../../lib/util/geometry/vector2";type Props = {appSize: Vector2}type State = {position: Vector2;}export class ReticleComponent{public container: Pixi.Graphics;staleProps: Propsstate: State;constructor(props: Props) {this.container = new Pixi.Graphics();this.staleProps = props;this.state = {position: props.appSize.multiply(0.5)};this.container.lineStyle(2, 0x999999);this.container.drawCircle(0, 0, 6);this.container.interactive = true;this.container.buttonMode = true;this.renderSelf(props);}public update(props: Props) {this.updateSelf(props);this.renderSelf(props);this.staleProps = props;}updateSelf(props: Props) {this.state.position = props.appSize.multiply(0.5);}renderSelf(props: Props) {this.container.position = PixiPointFrom(this.state.position);}}