Organized outfits & added descriptions

master
Mark 2024-02-16 13:24:52 -08:00
parent f53e191de3
commit 855eb0680b
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
4 changed files with 84 additions and 20 deletions

View File

@ -2,6 +2,14 @@
name = "Plasma Engines" name = "Plasma Engines"
thumbnail = "icon::engine" thumbnail = "icon::engine"
desc = """
This is the smallest of the plasma propulsion systems produced by
Delta V Corporation, suitable for very light fighters and interceptors.
Plasma engines are a bit more powerful than ion engines of the same size,
but they are less energy efficient and produce more heat.
"""
space.engine = 20 space.engine = 20
engine.thrust = 100 engine.thrust = 100
engine.flare.sprite = "flare::ion" engine.flare.sprite = "flare::ion"
@ -14,6 +22,15 @@ steering.power = 20
thumbnail = "icon::shield" thumbnail = "icon::shield"
name = "Shield Generator" name = "Shield Generator"
desc = """
This is the standard shield generator for fighters and interceptors,
as well as for many non-combat starships. Although it is possible for
a ship to have no shield generator at all, recharging its shield matrix
only when landed in a hospitable spaceport, life in deep space is
unpredictable enough that most pilots find shield generators to be
well worth the space they take up.
"""
space.outfit = 5 space.outfit = 5
shield.generation = 10 shield.generation = 10
shield.strength = 500 shield.strength = 500
@ -24,6 +41,13 @@ shield.delay = 2.0
thumbnail = "icon::blaster" thumbnail = "icon::blaster"
name = "Blaster" name = "Blaster"
desc = """
Although not the most accurate or damaging of weapons, the Energy Blaster is popular because it
is small enough to be installed on even the tiniest of ships. One blaster is not enough to do
appreciable damage to anything larger than a fighter, but a ship equipped with several of them
becomes a force to be reckoned with.
"""
space.weapon = 10 space.weapon = 10
# Average delay between shots # Average delay between shots

View File

@ -12,7 +12,7 @@ pub(crate) mod system;
pub use config::Config; pub use config::Config;
pub use effect::*; pub use effect::*;
pub use faction::{Faction, Relationship}; pub use faction::{Faction, Relationship};
pub use outfit::{Gun, Outfit, Projectile, ProjectileCollider}; pub use outfit::*;
pub use outfitspace::OutfitSpace; pub use outfitspace::OutfitSpace;
pub use ship::{ pub use ship::{
CollapseEffectSpawner, CollapseEvent, EffectCollapseEvent, EnginePoint, GunPoint, Ship, CollapseEffectSpawner, CollapseEvent, EffectCollapseEvent, EnginePoint, GunPoint, Ship,

View File

@ -23,6 +23,7 @@ pub(crate) mod syntax {
pub struct Outfit { pub struct Outfit {
pub thumbnail: ContentIndex, pub thumbnail: ContentIndex,
pub name: String, pub name: String,
pub desc: String,
pub engine: Option<Engine>, pub engine: Option<Engine>,
pub steering: Option<Steering>, pub steering: Option<Steering>,
pub space: outfitspace::syntax::OutfitSpace, pub space: outfitspace::syntax::OutfitSpace,
@ -145,15 +146,12 @@ pub struct Outfit {
/// The name of this outfit /// The name of this outfit
pub display_name: String, pub display_name: String,
/// The description of this outfit
pub desc: String,
/// Thie outfit's index /// Thie outfit's index
pub index: ContentIndex, pub index: ContentIndex,
/// How much engine thrust this outfit produces
pub engine_thrust: f32,
/// How much steering power this outfit provids
pub steer_power: f32,
/// The engine flare sprite this outfit creates. /// The engine flare sprite this outfit creates.
/// Its location and size is determined by a ship's /// Its location and size is determined by a ship's
/// engine points. /// engine points.
@ -165,6 +163,23 @@ pub struct Outfit {
/// Jump to this edge when engines turn off /// Jump to this edge when engines turn off
pub engine_flare_on_stop: Option<SectionEdge>, pub engine_flare_on_stop: Option<SectionEdge>,
/// This outfit's gun stats.
/// If this is some, this outfit requires a gun point.
pub gun: Option<Gun>,
/// The stats this outfit provides
pub stats: OutfitStats,
}
/// Outfit statistics
#[derive(Debug, Clone)]
pub struct OutfitStats {
/// How much engine thrust this outfit produces
pub engine_thrust: f32,
/// How much steering power this outfit provids
pub steer_power: f32,
/// Shield hit points /// Shield hit points
pub shield_strength: f32, pub shield_strength: f32,
@ -173,10 +188,37 @@ pub struct Outfit {
/// Wait this many seconds after taking damage before regenerating shields /// Wait this many seconds after taking damage before regenerating shields
pub shield_delay: f32, pub shield_delay: f32,
}
/// This outfit's gun stats. impl OutfitStats {
/// If this is some, this outfit requires a gun point. /// Create a new `OutfitStats`, with all values set to zero.
pub gun: Option<Gun>, pub fn zero() -> Self {
Self {
engine_thrust: 0.0,
steer_power: 0.0,
shield_strength: 0.0,
shield_generation: 0.0,
shield_delay: 0.0,
}
}
/// Add all the stats in `other` to the stats in `self`.
/// Sheld delay is not affected.
pub fn add(&mut self, other: &Self) {
self.engine_thrust += other.engine_thrust;
self.steer_power += other.steer_power;
self.shield_strength += other.shield_strength;
self.shield_generation += other.shield_generation;
}
/// Subtract all the stats in `other` from the stats in `self`.
/// Sheld delay is not affected.
pub fn subtract(&mut self, other: &Self) {
self.engine_thrust -= other.engine_thrust;
self.steer_power -= other.steer_power;
self.shield_strength -= other.shield_strength;
self.shield_generation -= other.shield_generation;
}
} }
/// Defines a projectile's collider /// Defines a projectile's collider
@ -284,15 +326,12 @@ impl crate::Build for Outfit {
display_name: outfit.name, display_name: outfit.name,
thumbnail, thumbnail,
gun, gun,
engine_thrust: 0.0, desc: outfit.desc,
steer_power: 0.0,
engine_flare_sprite: None, engine_flare_sprite: None,
engine_flare_on_start: None, engine_flare_on_start: None,
engine_flare_on_stop: None, engine_flare_on_stop: None,
space: OutfitSpace::from(outfit.space), space: OutfitSpace::from(outfit.space),
shield_delay: 0.0, stats: OutfitStats::zero(),
shield_generation: 0.0,
shield_strength: 0.0,
}; };
// Engine stats // Engine stats
@ -307,7 +346,7 @@ impl crate::Build for Outfit {
} }
Some(t) => t.clone(), Some(t) => t.clone(),
}; };
o.engine_thrust = engine.thrust; o.stats.engine_thrust = engine.thrust;
o.engine_flare_sprite = Some(sprite.clone()); o.engine_flare_sprite = Some(sprite.clone());
// Flare animation will traverse this edge when the player presses the thrust key // Flare animation will traverse this edge when the player presses the thrust key
@ -381,14 +420,14 @@ impl crate::Build for Outfit {
// Steering stats // Steering stats
if let Some(steer) = outfit.steering { if let Some(steer) = outfit.steering {
o.steer_power = steer.power; o.stats.steer_power = steer.power;
} }
// Shield stats // Shield stats
if let Some(shield) = outfit.shield { if let Some(shield) = outfit.shield {
o.shield_delay = shield.delay.unwrap_or(0.0); o.stats.shield_delay = shield.delay.unwrap_or(0.0);
o.shield_generation = shield.generation.unwrap_or(0.0); o.stats.shield_generation = shield.generation.unwrap_or(0.0);
o.shield_strength = shield.strength.unwrap_or(0.0); o.stats.shield_strength = shield.strength.unwrap_or(0.0);
} }
content.outfits.insert(o.index.clone(), Arc::new(o)); content.outfits.insert(o.index.clone(), Arc::new(o));

View File

@ -145,6 +145,7 @@ pub struct LandableSystemObject {
pub image: Arc<Sprite>, pub image: Arc<Sprite>,
/// The outfits we can buy here /// The outfits we can buy here
/// If this is empty, this landable has no outfitter.
pub outfitter: Vec<Arc<Outfit>>, pub outfitter: Vec<Arc<Outfit>>,
} }