Effect icons and tooltip !
This commit is contained in:
@@ -241,6 +241,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
if ((effect_owners.get(json.id)?.length ?? 0) > 1) {
|
||||
errors.push(`${file}: effect ${json.id} is also defined by ${effect_owners.get(json.id)!.join(", ")}`);
|
||||
}
|
||||
if (json.icon !== undefined) uses(file, json.icon, "texture");
|
||||
}
|
||||
for (const { file, json } of mod.spawns) {
|
||||
check_namespace(file, json.entity);
|
||||
|
||||
@@ -140,6 +140,8 @@ export interface EffectJson {
|
||||
category?: EffectCategory;
|
||||
// happens once when added instead of lasting, like instant health. its components' on_tick runs once
|
||||
instant?: boolean;
|
||||
// a texture, shown at the top of the inventory screen while the player has it
|
||||
icon?: string;
|
||||
// attribute modifiers while it's on, for level 1. each level adds that much again, like minecraft's speed
|
||||
modifiers?: { attribute: string; amount: number; operation: EffectModifierOperation }[];
|
||||
components?: Record<string, unknown>;
|
||||
@@ -809,6 +811,7 @@ export function validate_effect(json: unknown): Problems {
|
||||
problems.push('category must be "beneficial", "harmful" or "neutral"');
|
||||
}
|
||||
if (json.instant !== undefined && typeof json.instant !== "boolean") problems.push("instant must be true or false");
|
||||
if (json.icon !== undefined) problems.push(...validate_id(json.icon, "icon"));
|
||||
if (json.modifiers !== undefined) {
|
||||
if (!Array.isArray(json.modifiers)) {
|
||||
problems.push("modifiers must be a list");
|
||||
|
||||
@@ -241,6 +241,9 @@ export type ServerMessage =
|
||||
| { type: "vitals"; health: number; max_health: number; food: number; saturation: number; air: number }
|
||||
// the player's own attack speed attribute, when it changes, for the attack indicator under the crosshair
|
||||
| { type: "attack_speed"; value: number }
|
||||
// the player's own effects that show an icon, when they change. duration is in ticks, -1 for forever, and the
|
||||
// client counts it down itself, so it isn't sent every tick
|
||||
| { type: "effects"; effects: { id: string; amplifier: number; duration: number }[] }
|
||||
// a mod's server script talking to its client script, see ctx.net
|
||||
| { type: "mod"; channel: string; data: unknown };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user