Added basic planet descriptions

master
Mark 2024-01-17 10:23:42 -08:00
parent df7baa338c
commit 3c5ede28e4
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 34 additions and 0 deletions

View File

@ -15,6 +15,20 @@ object.earth.size = 1000
# TODO: satisfy conditions to land
object.earth.landable = true
object.earth.name = "Earth"
object.earth.desc = """
The ancestral home world of humanity, Earth has a population twice that of any other inhabited planet.
Sprawling cities cover large portions of its surface, many of them overcrowded and dangerous.
Some people work to scrape together enough money to leave, while at the same time others, born
on distant worlds, make a pilgrimage of sorts to see this planet that once cradled the entirety
of the human species.
<br><br>
Earth is also the capital of the Republic. Representative government becomes complicated when
one planet has a greater population than a hundred planets elsewhere. As a result,
settlements of less than a million are grouped together into planetary districts that
elect a single representative between them - a source of much frustration in the frontier worlds.
"""
object.luna.sprite = "planet::luna"
object.luna.position.center = "earth"

View File

@ -29,6 +29,8 @@ pub(crate) mod syntax {
pub radius: Option<f32>,
pub angle: Option<f32>,
pub landable: Option<bool>,
pub name: Option<String>,
pub desc: Option<String>,
}
#[derive(Debug, Deserialize)]
@ -122,6 +124,12 @@ pub struct SystemObject {
/// If true, ships may land on this object
pub landable: bool,
/// The display name of this object
pub name: String,
/// The description of this object
pub desc: String,
}
/// Helper function for resolve_position, never called on its own.
@ -223,6 +231,18 @@ impl crate::Build for System {
body_index: 0,
},
landable: obj.landable.unwrap_or(false),
name: obj
.name
.as_ref()
.map(|x| x.clone())
.unwrap_or("".to_string()),
// TODO: better linebreaks, handle double spaces
desc: obj
.desc
.as_ref()
.map(|x| x.replace("\n", " ").replace("<br>", "\n"))
.unwrap_or("".to_string()),
});
}