use super::*;
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct Blackboard {
pub(crate) entries: HashMap<String, BtValue>,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub(crate) struct BtNodeState {
pub(crate) running_child: usize,
pub(crate) repeat_count: usize,
pub(crate) cooldown_remaining: f32,
}
#[derive(Clone, Data, Debug, Default)]
pub struct BehaviorTree {
pub(crate) nodes: Vec<BtNodeKind>,
#[get(type(copy))]
pub(crate) root: usize,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) states: Vec<BtNodeState>,
}
#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
pub struct HfsmStateDef {
#[get(type(copy))]
pub(crate) id: u32,
#[get(skip)]
pub(crate) parent: Option<u32>,
#[get(skip)]
pub(crate) initial_child: Option<u32>,
}
#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
pub struct HfsmTransition {
#[get(type(copy))]
pub(crate) from_state: u32,
#[get(type(copy))]
pub(crate) to_state: u32,
#[get(skip)]
pub(crate) event_id: Option<u32>,
#[get(skip)]
pub(crate) guard_id: Option<u32>,
#[get(type(copy))]
pub(crate) priority: i32,
}
#[derive(Clone, Data, Debug, Default)]
pub struct HierarchicalFsm {
pub(crate) states: Vec<HfsmStateDef>,
pub(crate) transitions: Vec<HfsmTransition>,
pub(crate) active_chain: Vec<u32>,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) target_chain_scratch: Vec<u32>,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct UtilityConsideration {
#[get(type(copy))]
pub(crate) input_id: u32,
#[get(type(copy))]
pub(crate) min_input: f32,
#[get(type(copy))]
pub(crate) max_input: f32,
#[get(type(copy))]
pub(crate) curve: UtilityCurveKind,
#[get(type(copy))]
pub(crate) weight: f32,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct UtilityActionDef {
#[get(type(copy))]
pub(crate) action_id: u32,
#[get(type(copy))]
pub(crate) base_weight: f32,
pub(crate) considerations: Vec<UtilityConsideration>,
}
#[derive(Clone, Data, Debug)]
pub struct UtilityAiBrain {
pub(crate) actions: Vec<UtilityActionDef>,
#[get(type(copy))]
pub(crate) inertia_bonus: f32,
#[get(type(copy))]
pub(crate) min_dwell_time: f32,
#[get(type(copy))]
pub(crate) current_action: u32,
#[get(type(copy))]
pub(crate) has_active: bool,
#[get(type(copy))]
pub(crate) dwell_elapsed: f32,
pub(crate) last_scores: Vec<(u32, f32)>,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct BoidsAgent3D {
#[get(type(copy))]
pub(crate) position: Vec3,
#[get(type(copy))]
pub(crate) velocity: Vec3,
#[get(type(copy))]
pub(crate) wander_angle: f32,
#[get(type(copy))]
pub(crate) max_speed: f32,
#[get(type(copy))]
pub(crate) max_force: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct BoidsObstacle3D {
#[get(type(copy))]
pub(crate) center: Vec3,
#[get(type(copy))]
pub(crate) radius: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct BoidsWanderParams {
#[get(type(copy))]
pub(crate) circle_dist: f32,
#[get(type(copy))]
pub(crate) circle_radius: f32,
#[get(type(copy))]
pub(crate) jitter: f32,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct BoidsConfig {
#[get(type(copy))]
pub(crate) perception_radius: f32,
#[get(type(copy))]
pub(crate) separation_radius: f32,
#[get(type(copy))]
pub(crate) separation_weight: f32,
#[get(type(copy))]
pub(crate) alignment_weight: f32,
#[get(type(copy))]
pub(crate) cohesion_weight: f32,
#[get(type(copy))]
pub(crate) obstacle_weight: f32,
#[get(type(copy))]
pub(crate) wander_weight: f32,
#[get(type(copy))]
pub(crate) goal_weight: f32,
}
#[derive(Clone, Debug)]
pub(crate) struct BoidsScratch {
pub(crate) spatial_grid: SpatialHashGrid3D,
pub(crate) neighbor_ids: Vec<u64>,
pub(crate) accelerations: Vec<Vec3>,
pub(crate) next_angles: Vec<f32>,
}
#[derive(Clone, Data, Debug)]
pub struct BoidsFlockSolver {
#[get(type(copy))]
pub(crate) config: BoidsConfig,
pub(crate) agents: Vec<BoidsAgent3D>,
pub(crate) obstacles: Vec<BoidsObstacle3D>,
#[get(type(copy))]
pub(crate) goal_target: Vec3,
#[get(type(copy))]
pub(crate) has_goal: bool,
#[get(type(copy))]
pub(crate) rng: DeterministicRng,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) scratch: BoidsScratch,
}