Compare commits

..

No commits in common. "250dc402a480504ac26bc5872efff816e9ab1c10" and "cbcb060c66980ff38d91d280f4a3999040da4f14" have entirely different histories.

6 changed files with 9 additions and 28 deletions

View File

@ -1,8 +1,6 @@
# Specific projects # Specific projects
## Now: ## Now:
- Replace handles with Arcs in content
- clean up content
- Clean up state api - Clean up state api
- Persistent variables - Persistent variables
- Better planet icons - Better planet icons

View File

@ -1,7 +1,7 @@
[outfit."plasma engines"] [outfit."plasma engines"]
thumbnail = "icon::engine"
space.engine = 20 space.engine = 20
engine.thrust = 100 engine.thrust = 100
engine.flare.sprite = "flare::ion" engine.flare.sprite = "flare::ion"
engine.flare.on_start = "rise:top" engine.flare.on_start = "rise:top"
@ -10,16 +10,15 @@ steering.power = 20
[outfit."shield generator"] [outfit."shield generator"]
thumbnail = "icon::shield"
space.outfit = 5 space.outfit = 5
shield.generation = 10 shield.generation = 10
shield.strength = 500 shield.strength = 500
shield.delay = 2.0 shield.delay = 2.0
[outfit."blaster"] [outfit."blaster"]
thumbnail = "icon::shield"
space.weapon = 10 space.weapon = 10

View File

@ -1,6 +1,6 @@
[ship."Gypsum"] [ship."Gypsum"]
sprite = "ship::gypsum" sprite = "ship::gypsum"
thumbnail = "icon::gypsum" thumb = "icon::gypsum"
size = 100 size = 100
mass = 1 mass = 1
hull = 200 hull = 200

View File

@ -17,7 +17,6 @@ pub(crate) mod syntax {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Outfit { pub struct Outfit {
pub thumbnail: 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,
@ -128,9 +127,6 @@ pub(crate) mod syntax {
/// Represents an outfit that may be attached to a ship. /// Represents an outfit that may be attached to a ship.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Outfit { pub struct Outfit {
/// This outfit's thumbnail
pub thumbnail: SpriteHandle,
/// How much space this outfit requires /// How much space this outfit requires
pub space: OutfitSpace, pub space: OutfitSpace,
@ -264,19 +260,7 @@ impl crate::Build for Outfit {
), ),
}; };
let thumb_handle = match content.sprite_index.get(&outfit.thumbnail) {
None => {
return Err(anyhow!(
"thumbnail sprite `{}` doesn't exist",
outfit.thumbnail
))
.with_context(|| format!("in outfit `{}`", outfit_name));
}
Some(t) => *t,
};
let mut o = Self { let mut o = Self {
thumbnail: thumb_handle,
gun, gun,
handle, handle,
name: outfit_name.clone(), name: outfit_name.clone(),

View File

@ -16,7 +16,7 @@ pub(crate) mod syntax {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Ship { pub struct Ship {
pub sprite: String, pub sprite: String,
pub thumbnail: String, pub thumb: String,
pub size: f32, pub size: f32,
pub engines: Vec<Engine>, pub engines: Vec<Engine>,
pub guns: Vec<Gun>, pub guns: Vec<Gun>,
@ -98,7 +98,7 @@ pub struct Ship {
pub sprite: SpriteHandle, pub sprite: SpriteHandle,
/// This ship's thumbnail /// This ship's thumbnail
pub thumbnail: SpriteHandle, pub thumb: SpriteHandle,
/// The size of this ship. /// The size of this ship.
/// Measured as unrotated height, /// Measured as unrotated height,
@ -276,11 +276,11 @@ impl crate::Build for Ship {
Some(t) => *t, Some(t) => *t,
}; };
let thumbnail = match ct.sprite_index.get(&ship.thumbnail) { let thumb = match ct.sprite_index.get(&ship.thumb) {
None => bail!( None => bail!(
"In ship `{}`: thumbnail sprite `{}` doesn't exist", "In ship `{}`: thumbnail sprite `{}` doesn't exist",
ship_name, ship_name,
ship.thumbnail ship.thumb
), ),
Some(t) => *t, Some(t) => *t,
}; };
@ -429,7 +429,7 @@ impl crate::Build for Ship {
ct.ships.push(Self { ct.ships.push(Self {
sprite, sprite,
thumbnail, thumb,
aspect, aspect,
collapse, collapse,
damage, damage,

View File

@ -90,7 +90,7 @@ impl CustomType for ShipState {
s.get_ship().get_data().get_state().is_collapsing() s.get_ship().get_data().get_state().is_collapsing()
}) })
.with_fn("name", |s: &mut Self| s.get_content().name.clone()) .with_fn("name", |s: &mut Self| s.get_content().name.clone())
.with_fn("thumbnail", |s: &mut Self| s.get_content().thumbnail) .with_fn("thumbnail", |s: &mut Self| s.get_content().thumb)
.with_fn("landed_on", |s: &mut Self| s.landed_on()) .with_fn("landed_on", |s: &mut Self| s.landed_on())
.with_fn("get_shields", |s: &mut Self| { .with_fn("get_shields", |s: &mut Self| {
s.get_ship().get_data().get_shields() s.get_ship().get_data().get_shields()