mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 15:02:59 +03:00
Allow modding the experiment, and fix the --dev unlock_all functionality
This commit is contained in:
parent
6642c6e1a9
commit
ab92a387f2
@ -49,7 +49,7 @@ impl Level {
|
||||
time_limit: Duration::seconds(90.0),
|
||||
goal: 25,
|
||||
|
||||
unlock_upzones: 2,
|
||||
unlock_upzones: 1,
|
||||
unlock_vehicles: vec!["cargo bike".to_string()],
|
||||
},
|
||||
// TODO Super dense, starting point isn't even near apartments, run out of gifts after
|
||||
@ -66,7 +66,7 @@ impl Level {
|
||||
time_limit: Duration::seconds(90.0),
|
||||
goal: 25,
|
||||
|
||||
unlock_upzones: 2,
|
||||
unlock_upzones: 1,
|
||||
unlock_vehicles: vec![],
|
||||
},
|
||||
Level {
|
||||
@ -81,7 +81,7 @@ impl Level {
|
||||
time_limit: Duration::minutes(3),
|
||||
goal: 1000,
|
||||
|
||||
unlock_upzones: 2,
|
||||
unlock_upzones: 1,
|
||||
unlock_vehicles: vec![],
|
||||
},
|
||||
Level {
|
||||
@ -96,7 +96,7 @@ impl Level {
|
||||
time_limit: Duration::minutes(5),
|
||||
goal: 1000,
|
||||
|
||||
unlock_upzones: 3,
|
||||
unlock_upzones: 1,
|
||||
unlock_vehicles: vec![],
|
||||
},
|
||||
Level {
|
||||
@ -122,7 +122,7 @@ impl Level {
|
||||
time_limit: Duration::minutes(5),
|
||||
goal: 1000,
|
||||
|
||||
unlock_upzones: 3,
|
||||
unlock_upzones: 5,
|
||||
unlock_vehicles: vec![],
|
||||
},
|
||||
]
|
||||
|
@ -48,13 +48,10 @@ impl Session {
|
||||
abstutil::path_player("santa.json"),
|
||||
&mut Timer::throwaway(),
|
||||
) {
|
||||
// TODO Explicit version number to detect more easily?
|
||||
if session.levels == levels {
|
||||
return session;
|
||||
if session.levels != levels {
|
||||
warn!("Using modified levels from the session data");
|
||||
}
|
||||
// TODO Try to preserve high scores or levels unlocked? It could get complicated,
|
||||
// depending on how levels were changed or reordered.
|
||||
warn!("Loaded session data, but the levels have changed, so discarding!");
|
||||
return session;
|
||||
}
|
||||
|
||||
let mut high_scores = HashMap::new();
|
||||
@ -131,11 +128,13 @@ impl Session {
|
||||
}
|
||||
|
||||
pub fn unlock_all(&mut self) {
|
||||
self.upzones_unlocked = 0;
|
||||
for level in &self.levels {
|
||||
self.vehicles_unlocked.extend(level.unlock_vehicles.clone());
|
||||
self.upzones_unlocked += level.unlock_upzones;
|
||||
}
|
||||
self.levels_unlocked = self.levels.len();
|
||||
self.upzones_explained = true;
|
||||
}
|
||||
|
||||
pub fn update_music(&mut self, ctx: &mut EventCtx) {
|
||||
|
Loading…
Reference in New Issue
Block a user