Rename engine to cubi
This commit is contained in:
@@ -22,7 +22,7 @@ export interface AttributeType {
|
||||
}
|
||||
|
||||
function attribute(id: string, value: number, min: number, max: number): AttributeType {
|
||||
return { id: `bworld:${id}`, default: value, min, max };
|
||||
return { id: `cubi:${id}`, default: value, min, max };
|
||||
}
|
||||
|
||||
export const ATTRIBUTES = {
|
||||
|
||||
@@ -130,7 +130,7 @@ export interface SavedEntity {
|
||||
}
|
||||
|
||||
export abstract class Entity {
|
||||
// the entity type, like "bworld:item". see entity_types.ts
|
||||
// the entity type, like "cubi:item". see entity_types.ts
|
||||
abstract readonly type: string;
|
||||
readonly level: EntityLevel;
|
||||
// a UUID, which clients know it by too
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TICK_DELTA } from "$/common/constants.ts";
|
||||
import { physics } from "$/common/physics.ts";
|
||||
import { type Attacker, type DamageSource, Entity, finite, type SavedEntity } from "./entity.ts";
|
||||
|
||||
export const ITEM_ENTITY_TYPE = "bworld:item";
|
||||
export const ITEM_ENTITY_TYPE = "cubi:item";
|
||||
|
||||
// minecraft's item physics, its per tick numbers turned into per second ones where they're speeds
|
||||
export const ITEM_SIZE = 0.25;
|
||||
@@ -61,7 +61,7 @@ export class ItemEntity extends Entity {
|
||||
|
||||
constructor(
|
||||
level: Entity["level"],
|
||||
item = new ItemStack("bworld:air", 0),
|
||||
item = new ItemStack("cubi:air", 0),
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = 0,
|
||||
|
||||
@@ -1623,7 +1623,7 @@ export class GameServer {
|
||||
|
||||
// the engine's own commands, registered like mods' so they're in /help and suggested the same way
|
||||
#register_commands() {
|
||||
const register = (node: CommandNode<ServerCommandSource>) => this.mods.register_command("engine", node);
|
||||
const register = (node: CommandNode<ServerCommandSource>) => this.mods.register_command("cubi", node);
|
||||
|
||||
// TODO: only let operators do this
|
||||
// with data, any json, like { "damage": 10 } on a tool, or a fluid container full of a fluid with its data
|
||||
@@ -2563,7 +2563,7 @@ function death_message(name: string, source: DamageSource) {
|
||||
|
||||
// the states a block is placed with: its defaults, and a "facing" state turned towards whoever placed it, like
|
||||
// minecraft's getStateForPlacement with getHorizontalDirection().getOpposite(). facing is 0 north, 1 east, 2 south,
|
||||
// 3 west, and variants turn the model with it (its north side is the front, like engine:cube's). they look along
|
||||
// 3 west, and variants turn the model with it (its north side is the front, like cubi:cube's). they look along
|
||||
// (-sin yaw, -cos yaw), so the way back to them is (sin yaw, cos yaw)
|
||||
// where a player is now, for everyone else
|
||||
function player_move(player: ServerPlayer): ServerMessage {
|
||||
|
||||
@@ -176,7 +176,7 @@ export class ModRuntime {
|
||||
effect_components = new Map<string, { mod: string; component: EffectComponent }>();
|
||||
// every command, the engine's and mods', see common/commands.ts
|
||||
commands = new CommandDispatcher<ServerCommandSource>();
|
||||
// who registered each command name: "engine" or a mod's id
|
||||
// who registered each command name: "cubi" or a mod's id
|
||||
command_owners = new Map<string, string>();
|
||||
|
||||
before: Before = {
|
||||
@@ -478,14 +478,14 @@ export class ModRuntime {
|
||||
const existing = this.command_owners.get(node.name);
|
||||
if (existing) {
|
||||
throw new Error(
|
||||
existing === "engine"
|
||||
existing === "cubi"
|
||||
? `/${node.name} belongs to the engine`
|
||||
: `/${node.name} is also registered by ${existing}`,
|
||||
);
|
||||
}
|
||||
this.commands.register(node);
|
||||
this.command_owners.set(node.name, owner);
|
||||
if (owner !== "engine") {
|
||||
if (owner !== "cubi") {
|
||||
const alias = new CommandNode<ServerCommandSource>(`${owner}:${node.name}`);
|
||||
alias.children.push(...node.children);
|
||||
alias.command = node.command;
|
||||
|
||||
@@ -51,7 +51,7 @@ const MAX_KNOCKBACK_TICKS = 20;
|
||||
// until they land, so it works even when their client isn't running, like in a background tab. they're kept apart
|
||||
// from the entity manager's entities, clients hear about players through their own messages
|
||||
export class ServerPlayer extends LivingEntity {
|
||||
readonly type = "bworld:player";
|
||||
readonly type = "cubi:player";
|
||||
readonly conn: number;
|
||||
readonly name: string;
|
||||
|
||||
|
||||
+2
-2
@@ -333,10 +333,10 @@ async function write_world(dir: string, save: { level: string; chunks: SavedChun
|
||||
Deno.renameSync(`${level}.tmp`, level);
|
||||
}
|
||||
|
||||
// the engine's textures, listed by the build next to the client's assets. engine:missing is drawn by code
|
||||
// the engine's textures, listed by the build next to the client's assets. cubi:missing is drawn by code
|
||||
export function engine_texture_ids(build_dir: string): string[] {
|
||||
const names: string[] = JSON.parse(Deno.readTextFileSync(join(build_dir, ENGINE_TEXTURES_INDEX)));
|
||||
return ["engine:missing", ...names.map((name) => `engine:${name}`)];
|
||||
return ["cubi:missing", ...names.map((name) => `cubi:${name}`)];
|
||||
}
|
||||
|
||||
// the client and the engine's assets. pages on other origins load the engine's textures from here too
|
||||
|
||||
@@ -25,7 +25,7 @@ export class ModsError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
// engine_textures are the engine: texture ids, for checking the textures mods use. config_dir has the server's
|
||||
// engine_textures are the cubi: texture ids, for checking the textures mods use. config_dir has the server's
|
||||
// <mod id>.json files that change mods' config. a mod with problems stops the whole server from starting, the game
|
||||
// never runs with some mods missing
|
||||
export async function load_bmods(
|
||||
|
||||
Reference in New Issue
Block a user