Its almost generation time
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
import type { ClientContext } from "cubi/client";
|
import type { ClientContext, Color } from "cubi/client";
|
||||||
import type { ServerContext } from "cubi/server";
|
import type { Position, ServerContext } from "cubi/server";
|
||||||
import { DOOR, FACILITY_DOOR } from "./shared.ts";
|
import { DOOR, FACILITY_DOOR } from "./shared.ts";
|
||||||
|
import { Alea } from "@paulaboks/rng";
|
||||||
|
|
||||||
export { shared } from "./shared.ts";
|
export { shared } from "./shared.ts";
|
||||||
|
|
||||||
@@ -13,7 +14,23 @@ export function server(ctx: ServerContext) {
|
|||||||
register_commands(ctx);
|
register_commands(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function client(_ctx: ClientContext) {
|
export function client(ctx: ClientContext) {
|
||||||
|
register_hud(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// a small 5x5 ring in the middle of the screen to aim with, its corners and middle left empty, in gui pixels
|
||||||
|
function register_hud(ctx: ClientContext) {
|
||||||
|
const color: Color = [1, 1, 1, 1];
|
||||||
|
ctx.hud.register("dangerous_business:crosshair", {
|
||||||
|
on_render(g) {
|
||||||
|
const x = Math.floor(g.width / 2) - 2;
|
||||||
|
const y = Math.floor(g.height / 2) - 2;
|
||||||
|
g.rect(x + 1, y, 3, 1, color);
|
||||||
|
g.rect(x + 1, y + 4, 3, 1, color);
|
||||||
|
g.rect(x, y + 1, 1, 3, color);
|
||||||
|
g.rect(x + 4, y + 1, 1, 3, color);
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// doors are two blocks, a lower and an upper half, see register_door in shared.ts. one is only placed with air above
|
// doors are two blocks, a lower and an upper half, see register_door in shared.ts. one is only placed with air above
|
||||||
@@ -126,7 +143,13 @@ function register_commands(ctx: ServerContext) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const interior_tiles = [];
|
interface Tile {
|
||||||
|
tile: string;
|
||||||
|
position: Position;
|
||||||
|
rotation: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
let interior_tiles: Tile[] = [];
|
||||||
|
|
||||||
function clear_map(ctx: ServerContext) {
|
function clear_map(ctx: ServerContext) {
|
||||||
// theres no need to clear the surface but we do need to clear each tile
|
// theres no need to clear the surface but we do need to clear each tile
|
||||||
@@ -139,5 +162,17 @@ function place_surface(ctx: ServerContext) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_interior(ctx: ServerContext) {
|
interface InteriorGenerationConfig {
|
||||||
|
size_multipler: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plan_interior(rng: Alea, config: InteriorGenerationConfig): Tile[] {
|
||||||
|
const tiles: Tile[] = [];
|
||||||
|
return tiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate_interior(ctx: ServerContext, config: InteriorGenerationConfig) {
|
||||||
|
interior_tiles = plan_interior(new Alea(), config);
|
||||||
|
// generate main
|
||||||
|
// generate other rooms
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user