Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bevy-genre-stealth

БесплатноБез исполняемых скриптовНе проверен

Thin Bevy genre router for Stealth. Keywords: Bevy, Stealth, genre, ECS, router.

thedivergentaiот thedivergentai★ 1 019 звёзд на GitHub

Об этом скилле

Bevy Stealth (thin router)

Genre router. Domain work lives in the Bevy skills below.

When to use

Load this for vision cones you author and alert states.

ECS shape

  • Components hold the genre's per-entity flags as plain data. This file does not name new engine types.
  • Resources hold run-wide counters (score, wave index, seed) via bevy-data-resources.
  • Systems read those components on Update or the fixed timestep from bevy-master. Order them with .chain() when a later system must see the result.
  • Schedule: gameplay mode changes go through bevy-state-machines. Do not invent a genre plugin.

Coming from Godot

Godot idea Bevy idiom
Genre scene tree Entities plus the domain skills linked below
Autoload director A resource, not a singleton node
Signal bus for the loop bevy-events-messaging

Routing

Scope

Vision cones, exposure, and alert meters are components you own. A ray that must stop on solid geometry belongs on bevy-spatial-queries. Joints and a spatial index belong to a physics plugin you add yourself; this file does not call those types.

Examples

[dependencies]
bevy = "0.20"

A guard samples the player's head, torso, and feet. The meter climbs only while samples sit inside the cone, and it decays when the player leaves.

#[derive(Component)]
struct Player;

#[derive(Component)]
struct Vision {
    range: f32,
    half_angle_cos: f32,
    eye_offset: Vec3,
}

#[derive(Clone, Copy, PartialEq, Eq)]
enum AlertState {
    Idle,
    Suspicious,
    Alerted,
}

#[derive(Component)]
struct Alert {
    meter: f32,
    state: AlertState,
}

fn in_cone(eye: Vec3, forward: Vec3, target: Vec3, vision: &Vision) -> bool {
    let to = target - eye;
    let dist = to.length();
    if dist > vision.range || dist < 0.001 {
        return false;
    }
    (to / dist).dot(forward) >= vision.half_angle_cos
}

fn raise_alert(
    time: Res<Time>,
    players: Query<&Transform, With<Player>>,
    mut guards: Query<(&Transform, &Vision, &mut Alert)>,
) {
    let Some(player_tf) = players.iter().next() else {
        return;
    };
    let dt = time.delta_secs();
    let samples = [
        player_tf.translation + Vec3::Y * 1.6,
        player_tf.translation + Vec3::Y * 0.9,
        player_tf.translation + Vec3::Y * 0.2,
    ];
    for (tf, vision, mut alert) in &mut guards {
        let eye = tf.translation + vision.eye_offset;
        let forward = tf.forward().as_vec3();
        let hits = samples
            .iter()
            .filter(|point| in_cone(eye, forward, **point, vision))
            .count();
        let rate = hits as f32 / samples.len() as f32;
        if rate > 0.0 {
            alert.meter = (alert.meter + rate * 40.0 * dt).min(100.0);
        } else {
            alert.meter = (alert.meter - 15.0 * dt).max(0.0);
        }
        alert.state = if alert.meter >= 100.0 {
            AlertState::Alerted
        } else if alert.meter >= 25.0 {
            AlertState::Suspicious
        } else {
            AlertState::Idle
        };
    }
}

Hearing uses travel distance, not a raw radius. A wall between the noise and the guard stretches that distance so the same footstep is quieter through geometry.

#[derive(Component)]
struct Hearing {
    range: f32,
}

#[derive(Component)]
struct Noise {
    loudness: f32,
}

#[derive(Component)]
struct Alert {
    meter: f32,
}

fn hear(
    time: Res<Time>,
    noises: Query<(&Transform, &Noise)>,
    mut guards: Query<(&Transform, &Hearing, &mut Alert)>,
) {
    let dt = time.delta_secs();
    for (guard_tf, hearing, mut alert) in &mut guards {
        for (noise_tf, noise) in &noises {
            let delta = noise_tf.translation - guard_tf.translation;
            let straight = delta.length();
            let blocked = delta.x.abs() > 2.0 && delta.z.abs() > 2.0;
            let travel = if blocked { straight * 2.5 } else { straight };
            if travel < hearing.range {
                let gain = noise.loudness * (1.0 - travel / hearing.range);
                alert.meter = (alert.meter + gain * dt).min(100.0);
            }
        }
    }
}

pub struct HearingPlugin;

impl Plugin for HearingPlugin {
    fn build(&self, app: &mut App) {
        app.add_systems(Update, hear);
    }
}

Light scales how fast the meter fills. A crouched player with low exposure fi

Полный SKILL.md на GitHub

Установить bevy-genre-stealth в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/ecs-ownership.md

FAQ

Что делает скилл bevy-genre-stealth?

Thin Bevy genre router for Stealth. Keywords: Bevy, Stealth, genre, ECS, router.

Как установить скилл bevy-genre-stealth?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bevy-genre-stealth запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bevy-genre-stealth с