Rename engine to cubi
This commit is contained in:
@@ -35,7 +35,7 @@ interface Player {
|
||||
teleport(x: number, y: number, z: number): void;
|
||||
|
||||
readonly health: number; // out of max_health
|
||||
readonly max_health: number; // 20, or what the bworld:max_health attribute makes it
|
||||
readonly max_health: number; // 20, or what the cubi:max_health attribute makes it
|
||||
readonly food: number; // hunger, out of 20
|
||||
readonly saturation: number; // never above food
|
||||
|
||||
@@ -74,7 +74,7 @@ what a player is looking at, like Minecraft's `getPlayerPOVHitResult`:
|
||||
```ts
|
||||
const eye = player.eye_position;
|
||||
const look = player.look_direction;
|
||||
const reach = player.attribute("bworld:block_interaction_range");
|
||||
const reach = player.attribute("cubi:block_interaction_range");
|
||||
const to = { x: eye.x + look.x * reach, y: eye.y + look.y * reach, z: eye.z + look.z * reach };
|
||||
const hit = ctx.world.raycast(eye, to, { fluids: "source_only" });
|
||||
```
|
||||
@@ -106,17 +106,17 @@ even when their game isn't running, like in a background tab.
|
||||
|
||||
A player's stats are attributes, like Minecraft's: a base value that modifiers change without touching it.
|
||||
|
||||
| Attribute | Base | Meaning |
|
||||
| --------------------------------- | ---- | -------------------------------------------------------------------------- |
|
||||
| `bworld:attack_damage` | 1 | How much their hits do. |
|
||||
| `bworld:attack_speed` | 4 | Full strength attacks a second. Hitting sooner than that does less damage. |
|
||||
| `bworld:block_interaction_range` | 6 | How far from their eyes they break and use blocks, in blocks. |
|
||||
| `bworld:entity_interaction_range` | 3 | How far from their eyes they hit entities, in blocks. |
|
||||
| Attribute | Base | Meaning |
|
||||
| ------------------------------- | ---- | -------------------------------------------------------------------------- |
|
||||
| `cubi:attack_damage` | 1 | How much their hits do. |
|
||||
| `cubi:attack_speed` | 4 | Full strength attacks a second. Hitting sooner than that does less damage. |
|
||||
| `cubi:block_interaction_range` | 6 | How far from their eyes they break and use blocks, in blocks. |
|
||||
| `cubi:entity_interaction_range` | 3 | How far from their eyes they hit entities, in blocks. |
|
||||
|
||||
```ts
|
||||
player.add_modifier("bworld:attack_damage", { id: "my_mod:rage", amount: 2, operation: "add_value" });
|
||||
player.attribute("bworld:attack_damage"); // 3
|
||||
player.remove_modifier("bworld:attack_damage", "my_mod:rage");
|
||||
player.add_modifier("cubi:attack_damage", { id: "my_mod:rage", amount: 2, operation: "add_value" });
|
||||
player.attribute("cubi:attack_damage"); // 3
|
||||
player.remove_modifier("cubi:attack_damage", "my_mod:rage");
|
||||
```
|
||||
|
||||
The value is the base, plus every `add_value`, plus that times the amount of each `add_multiplied_base`, then times 1
|
||||
@@ -136,13 +136,13 @@ reaches further gives a modifier while it's held, like Create's extendo grip:
|
||||
ctx.events.after.tick.subscribe(() => {
|
||||
for (const player of ctx.players.all()) {
|
||||
if (player.held_item?.id === "copper_tools:grabber") {
|
||||
player.add_modifier("bworld:block_interaction_range", {
|
||||
player.add_modifier("cubi:block_interaction_range", {
|
||||
id: "copper_tools:grabber",
|
||||
amount: 3,
|
||||
operation: "add_value",
|
||||
});
|
||||
} else {
|
||||
player.remove_modifier("bworld:block_interaction_range", "copper_tools:grabber");
|
||||
player.remove_modifier("cubi:block_interaction_range", "copper_tools:grabber");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user