Organized outfits & added descriptions
parent
f53e191de3
commit
855eb0680b
|
@ -2,6 +2,14 @@
|
|||
name = "Plasma Engines"
|
||||
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
|
||||
engine.thrust = 100
|
||||
engine.flare.sprite = "flare::ion"
|
||||
|
@ -14,6 +22,15 @@ steering.power = 20
|
|||
thumbnail = "icon::shield"
|
||||
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
|
||||
shield.generation = 10
|
||||
shield.strength = 500
|
||||
|
@ -24,6 +41,13 @@ shield.delay = 2.0
|
|||
thumbnail = "icon::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
|
||||
|
||||
# Average delay between shots
|
||||
|
|
|
@ -12,7 +12,7 @@ pub(crate) mod system;
|
|||
pub use config::Config;
|
||||
pub use effect::*;
|
||||
pub use faction::{Faction, Relationship};
|
||||
pub use outfit::{Gun, Outfit, Projectile, ProjectileCollider};
|
||||
pub use outfit::*;
|
||||
pub use outfitspace::OutfitSpace;
|
||||
pub use ship::{
|
||||
CollapseEffectSpawner, CollapseEvent, EffectCollapseEvent, EnginePoint, GunPoint, Ship,
|
||||
|
|
|
@ -23,6 +23,7 @@ pub(crate) mod syntax {
|
|||
pub struct Outfit {
|
||||
pub thumbnail: ContentIndex,
|
||||
pub name: String,
|
||||
pub desc: String,
|
||||
pub engine: Option<Engine>,
|
||||
pub steering: Option<Steering>,
|
||||
pub space: outfitspace::syntax::OutfitSpace,
|
||||
|
@ -145,15 +146,12 @@ pub struct Outfit {
|
|||
/// The name of this outfit
|
||||
pub display_name: String,
|
||||
|
||||
/// The description of this outfit
|
||||
pub desc: String,
|
||||
|
||||
/// Thie outfit's index
|
||||
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.
|
||||
/// Its location and size is determined by a ship's
|
||||
/// engine points.
|
||||
|
@ -165,6 +163,23 @@ pub struct Outfit {
|
|||
/// Jump to this edge when engines turn off
|
||||
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
|
||||
pub shield_strength: f32,
|
||||
|
||||
|
@ -173,10 +188,37 @@ pub struct Outfit {
|
|||
|
||||
/// Wait this many seconds after taking damage before regenerating shields
|
||||
pub shield_delay: f32,
|
||||
}
|
||||
|
||||
/// This outfit's gun stats.
|
||||
/// If this is some, this outfit requires a gun point.
|
||||
pub gun: Option<Gun>,
|
||||
impl OutfitStats {
|
||||
/// Create a new `OutfitStats`, with all values set to zero.
|
||||
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
|
||||
|
@ -284,15 +326,12 @@ impl crate::Build for Outfit {
|
|||
display_name: outfit.name,
|
||||
thumbnail,
|
||||
gun,
|
||||
engine_thrust: 0.0,
|
||||
steer_power: 0.0,
|
||||
desc: outfit.desc,
|
||||
engine_flare_sprite: None,
|
||||
engine_flare_on_start: None,
|
||||
engine_flare_on_stop: None,
|
||||
space: OutfitSpace::from(outfit.space),
|
||||
shield_delay: 0.0,
|
||||
shield_generation: 0.0,
|
||||
shield_strength: 0.0,
|
||||
stats: OutfitStats::zero(),
|
||||
};
|
||||
|
||||
// Engine stats
|
||||
|
@ -307,7 +346,7 @@ impl crate::Build for Outfit {
|
|||
}
|
||||
Some(t) => t.clone(),
|
||||
};
|
||||
o.engine_thrust = engine.thrust;
|
||||
o.stats.engine_thrust = engine.thrust;
|
||||
o.engine_flare_sprite = Some(sprite.clone());
|
||||
|
||||
// Flare animation will traverse this edge when the player presses the thrust key
|
||||
|
@ -381,14 +420,14 @@ impl crate::Build for Outfit {
|
|||
|
||||
// Steering stats
|
||||
if let Some(steer) = outfit.steering {
|
||||
o.steer_power = steer.power;
|
||||
o.stats.steer_power = steer.power;
|
||||
}
|
||||
|
||||
// Shield stats
|
||||
if let Some(shield) = outfit.shield {
|
||||
o.shield_delay = shield.delay.unwrap_or(0.0);
|
||||
o.shield_generation = shield.generation.unwrap_or(0.0);
|
||||
o.shield_strength = shield.strength.unwrap_or(0.0);
|
||||
o.stats.shield_delay = shield.delay.unwrap_or(0.0);
|
||||
o.stats.shield_generation = shield.generation.unwrap_or(0.0);
|
||||
o.stats.shield_strength = shield.strength.unwrap_or(0.0);
|
||||
}
|
||||
|
||||
content.outfits.insert(o.index.clone(), Arc::new(o));
|
||||
|
|
|
@ -145,6 +145,7 @@ pub struct LandableSystemObject {
|
|||
pub image: Arc<Sprite>,
|
||||
|
||||
/// The outfits we can buy here
|
||||
/// If this is empty, this landable has no outfitter.
|
||||
pub outfitter: Vec<Arc<Outfit>>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue