Minor rename
parent
57f2b97f40
commit
fa719d46b9
|
@ -3,9 +3,9 @@
|
||||||
//! This subcrate is responsible for loading, parsing, validating game content,
|
//! This subcrate is responsible for loading, parsing, validating game content,
|
||||||
//! which is usually stored in `./content`.
|
//! which is usually stored in `./content`.
|
||||||
|
|
||||||
mod animautomaton;
|
|
||||||
mod handle;
|
mod handle;
|
||||||
mod part;
|
mod part;
|
||||||
|
mod spriteautomaton;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
|
@ -20,9 +20,9 @@ use std::{
|
||||||
use toml;
|
use toml;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
pub use animautomaton::*;
|
|
||||||
pub use handle::*;
|
pub use handle::*;
|
||||||
pub use part::*;
|
pub use part::*;
|
||||||
|
pub use spriteautomaton::*;
|
||||||
|
|
||||||
mod syntax {
|
mod syntax {
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
|
|
|
@ -41,7 +41,7 @@ enum AnimDirection {
|
||||||
|
|
||||||
/// Manages a single sprite's animation state.
|
/// Manages a single sprite's animation state.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AnimAutomaton {
|
pub struct SpriteAutomaton {
|
||||||
/// The sprite we're animating
|
/// The sprite we're animating
|
||||||
sprite: SpriteHandle,
|
sprite: SpriteHandle,
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ pub struct AnimAutomaton {
|
||||||
next_edge_override: Option<SectionEdge>,
|
next_edge_override: Option<SectionEdge>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnimAutomaton {
|
impl SpriteAutomaton {
|
||||||
/// Create a new AnimAutomaton
|
/// Create a new AnimAutomaton
|
||||||
pub fn new(ct: &Content, sprite_handle: SpriteHandle) -> Self {
|
pub fn new(ct: &Content, sprite_handle: SpriteHandle) -> Self {
|
||||||
let sprite = ct.get_sprite(sprite_handle);
|
let sprite = ct.get_sprite(sprite_handle);
|
|
@ -1,4 +1,4 @@
|
||||||
use galactica_content::{AnimAutomaton, AnimationState, Content, FactionHandle, Projectile};
|
use galactica_content::{AnimationState, Content, FactionHandle, Projectile, SpriteAutomaton};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use rapier2d::{dynamics::RigidBodyHandle, geometry::ColliderHandle};
|
use rapier2d::{dynamics::RigidBodyHandle, geometry::ColliderHandle};
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ pub struct PhysProjectile {
|
||||||
pub content: Projectile,
|
pub content: Projectile,
|
||||||
|
|
||||||
/// This projectile's sprite animation state
|
/// This projectile's sprite animation state
|
||||||
anim: AnimAutomaton,
|
anim: SpriteAutomaton,
|
||||||
|
|
||||||
/// The remaining lifetime of this projectile, in seconds
|
/// The remaining lifetime of this projectile, in seconds
|
||||||
pub lifetime: f32,
|
pub lifetime: f32,
|
||||||
|
@ -40,7 +40,7 @@ impl PhysProjectile {
|
||||||
let size_rng = content.size_rng;
|
let size_rng = content.size_rng;
|
||||||
let lifetime = content.lifetime;
|
let lifetime = content.lifetime;
|
||||||
PhysProjectile {
|
PhysProjectile {
|
||||||
anim: AnimAutomaton::new(ct, content.sprite),
|
anim: SpriteAutomaton::new(ct, content.sprite),
|
||||||
rigid_body,
|
rigid_body,
|
||||||
collider,
|
collider,
|
||||||
content,
|
content,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use galactica_content::{
|
use galactica_content::{
|
||||||
AnimAutomaton, AnimationState, Content, EnginePoint, FactionHandle, OutfitHandle, ShipHandle,
|
AnimationState, Content, EnginePoint, FactionHandle, OutfitHandle, ShipHandle, SpriteAutomaton,
|
||||||
};
|
};
|
||||||
use nalgebra::{point, vector, Rotation2, Vector2};
|
use nalgebra::{point, vector, Rotation2, Vector2};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
@ -56,10 +56,10 @@ pub struct PhysSimShip {
|
||||||
pub(crate) data: ShipData,
|
pub(crate) data: ShipData,
|
||||||
|
|
||||||
/// This ship's sprite animation state
|
/// This ship's sprite animation state
|
||||||
anim: AnimAutomaton,
|
anim: SpriteAutomaton,
|
||||||
|
|
||||||
/// Animation state for each of this ship's engines
|
/// Animation state for each of this ship's engines
|
||||||
engine_anim: Vec<(EnginePoint, AnimAutomaton)>,
|
engine_anim: Vec<(EnginePoint, SpriteAutomaton)>,
|
||||||
|
|
||||||
/// This ship's controls
|
/// This ship's controls
|
||||||
pub(crate) controls: ShipControls,
|
pub(crate) controls: ShipControls,
|
||||||
|
@ -83,7 +83,7 @@ impl PhysSimShip {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let ship_ct = ct.get_ship(handle);
|
let ship_ct = ct.get_ship(handle);
|
||||||
PhysSimShip {
|
PhysSimShip {
|
||||||
anim: AnimAutomaton::new(ct, ship_ct.sprite),
|
anim: SpriteAutomaton::new(ct, ship_ct.sprite),
|
||||||
rigid_body,
|
rigid_body,
|
||||||
collider,
|
collider,
|
||||||
data: ShipData::new(ct, handle, faction, personality),
|
data: ShipData::new(ct, handle, faction, personality),
|
||||||
|
@ -273,7 +273,7 @@ impl PhysSimShip {
|
||||||
.get_ship(self.data.get_content())
|
.get_ship(self.data.get_content())
|
||||||
.engines
|
.engines
|
||||||
.iter()
|
.iter()
|
||||||
.map(|e| (e.clone(), AnimAutomaton::new(ct, flare)))
|
.map(|e| (e.clone(), SpriteAutomaton::new(ct, flare)))
|
||||||
.collect();
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ impl PhysSimShip {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get this ship's engine animations
|
/// Get this ship's engine animations
|
||||||
pub fn iter_engine_anim(&self) -> impl Iterator<Item = &(EnginePoint, AnimAutomaton)> {
|
pub fn iter_engine_anim(&self) -> impl Iterator<Item = &(EnginePoint, SpriteAutomaton)> {
|
||||||
self.engine_anim.iter()
|
self.engine_anim.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue