Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/energy/src/electromagnetism/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ impl MagneticField {

// Biot-Savart law: dB = (μ₀/4π) * (I dl × r̂) / r²
let field_magnitude = MAGNETIC_CONSTANT_DIV_4PI * current / (distance * distance);
let field = Vec2::new(-r_unit.y, r_unit.x) * current_direction.length() * field_magnitude;
let field = Vec2::new(-r_unit.y, r_unit.x)
* (current_direction.x * r_unit.y - current_direction.y * r_unit.x)
* field_magnitude;

Self::new(field, field_position)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/systems/ai/src/core/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::sync::Arc;
/// of the Thinker that spawned it, and the actual Action system executing the
/// Action itself.
#[derive(Debug, Clone, Component, Eq, PartialEq, Reflect)]
#[component(storage = "SparseSet")]
#[component(storage = "Table")]
pub enum ActionState {
/// Initial state. No action should be performed.
Init,
Expand Down
4 changes: 3 additions & 1 deletion crates/systems/ai/src/drives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use bevy::prelude::*;
pub struct DrivesPlugin;

impl Plugin for DrivesPlugin {
fn build(&self, _app: &mut App) {
fn build(&self, app: &mut App) {
app.register_type::<needs::Need>()
.register_type::<needs::NeedType>();
// Simple plugin - just makes drives available
// Systems will be added later when we have proper integration
}
Expand Down
4 changes: 2 additions & 2 deletions crates/systems/ai/src/drives/needs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::prelude::*;
use bevy::prelude::*;

/// Core need types representing basic drives
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Reflect)]
pub enum NeedType {
Hunger, // Need for nourishment
Safety, // Need to avoid danger
Expand All @@ -11,7 +11,7 @@ pub enum NeedType {
}

/// Component representing a single need
#[derive(Component, Debug, Clone)]
#[derive(Component, Debug, Clone, Reflect)]
pub struct Need {
/// Type of need
pub need_type: NeedType,
Expand Down
23 changes: 16 additions & 7 deletions crates/systems/save_system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@ use bevy::prelude::*;
pub mod save_system;
pub mod versioning;

/// Plugin for save/load functionality with versioning support
#[derive(Default)]
pub struct SaveSystemPlugin;

impl Plugin for SaveSystemPlugin {
fn build(&self, _app: &mut App) {
// TODO: Will add save/load systems when needed
// For now, just register the plugin
fn build(&self, app: &mut App) {
app.init_resource::<save_system::GameTracker>()
.register_type::<save_system::Saveable>()
.register_type::<save_system::GameState>()
.register_type::<save_system::GameEvent>()
.register_type::<save_system::SaveMetadata>();
}
}

impl Default for SaveSystemPlugin {
fn default() -> Self {
Self
}
}

/// Prelude for easy importing
pub mod prelude {
pub use super::SaveSystemPlugin;
pub use crate::save_system::{load, save};
pub use crate::save_system::{
get_save_directory, get_save_path, load, load_game_data, save, save_game_data, GameEvent,
GameSaveData, GameSnapshot, GameState, GameTracker, SaveMetadata, Saveable, WorldSaveExt,
};
pub use crate::versioning::{is_save_up_to_date, upgrade_save, SAVE_VERSION};
}
Loading
Loading