1
0
Fork 0

Make display public

This commit is contained in:
Pabloader 2026-05-03 11:04:43 +00:00
parent 90bac08e0b
commit 32927d5623
3 changed files with 24 additions and 1 deletions

View File

@ -6,6 +6,25 @@ export class Position extends Component<{ x: number, y: number, z: number }> {
constructor(x = 0, y = 0, z = 0) { constructor(x = 0, y = 0, z = 0) {
super({ x, y, z }); super({ x, y, z });
} }
get x() {
return this.state.x;
}
get y() {
return this.state.y;
}
get z() {
return this.state.z;
}
set x(x: number) {
this.state.x = x;
}
set y(y: number) {
this.state.y = y;
}
set z(z: number) {
this.state.z = z;
}
} }
export const getPosition = (entity?: Entity, key?: string) => entity?.get(Position, key)?.state; export const getPosition = (entity?: Entity, key?: string) => entity?.get(Position, key)?.state;

View File

@ -5,7 +5,7 @@ import { System, World } from "@common/rpg/core/world";
import { Resources } from "@common/rpg/utils/resources"; import { Resources } from "@common/rpg/utils/resources";
export class TextDisplaySystem extends System { export class TextDisplaySystem extends System {
private readonly display: TextDisplay; public readonly display: TextDisplay;
constructor(display?: TextDisplay) { constructor(display?: TextDisplay) {
super(); super();

View File

@ -10,6 +10,8 @@ import './assets/style.css';
import { Direction, getOppositeDirection, MAP_HEIGHT, MAP_WIDTH, MAP_X, MAP_Y, ROOM_AREA_HEIGHT, ROOM_AREA_WIDTH, ROOM_AREA_X, ROOM_AREA_Y } from './const'; import { Direction, getOppositeDirection, MAP_HEIGHT, MAP_WIDTH, MAP_X, MAP_Y, ROOM_AREA_HEIGHT, ROOM_AREA_WIDTH, ROOM_AREA_X, ROOM_AREA_Y } from './const';
import { getPossibleRoomsCount, getRoom, getRoomsCount, getRoomsForLayer, getMapRoomChar, Room, Door } from './room'; import { getPossibleRoomsCount, getRoom, getRoomsCount, getRoomsForLayer, getMapRoomChar, Room, Door } from './room';
import { createPlayer, Player } from './player'; import { createPlayer, Player } from './player';
import { resolveActions, resolveVariables } from '@common/rpg/utils/variables';
import { createItems } from './item';
export default async function main() { export default async function main() {
@ -168,6 +170,8 @@ export default async function main() {
} }
} }
createItems(world);
while (true) { while (true) {
const dt = await nextFrame(); const dt = await nextFrame();