Random events: earthquakes, overflowing rivers, new gold veins (free games and versus, can be switched off)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 23:58:28 +01:00
1 parent 5239e4b5a3
commit c6d82027dd
26 files changed
+313 -10

No files matched your search

+5 -2
View File
@@ -8,6 +8,7 @@ mod cloud;
mod commands;
mod demo;
mod editor;
mod events;
mod dwarves;
mod fog;
mod fortress;
@@ -185,6 +186,7 @@ fn new_game(seed: u32, s: &Settings) -> (Game, Cam) {
g.add_surface(seed, 0.5, 2 + (s.map_h / 64) as u32);
g.init_fog();
}
g.set_events(s.events);
let (cx, cy) = g.map.core;
let cam = Cam::new(cx as f32 + 1.5, cy as f32 + 1.5);
(g, cam)
@@ -352,7 +354,7 @@ fn account_action(a: MenuAction, cloud: &mut Cloud, menu: &mut Menu, app: &mut A
}
}
MenuAction::MatchJoin(code) => app.client.join(&code),
MenuAction::MatchCreate => app.client.create_land(&[0, 2, 3, 4], app.settings.map_w, app.settings.map_h, app.settings.difficulty, app.settings.surface),
MenuAction::MatchCreate => app.client.create_land(&[0, 2, 3, 4], app.settings.map_w, app.settings.map_h, app.settings.difficulty, app.settings.surface, app.settings.events),
MenuAction::MatchCoopCreate(mission) => {
let all = campaign::missions();
if let Some(d) = all.get(mission) {
@@ -721,7 +723,7 @@ impl App {
let next = run_seed.is_some();
let seed = run_seed.unwrap_or_else(|| next_seed(self.seed));
let editor = doc.is_some();
let info = StartInfo { seed, map_w, map_h, difficulty: self.settings.difficulty, sides: vec![0, 2], local_side: Some(0), mission: Some(mission), ai: vec![2], doc, editor, teams: Vec::new(), next, carry, surface: false };
let info = StartInfo { seed, map_w, map_h, difficulty: self.settings.difficulty, sides: vec![0, 2], local_side: Some(0), mission: Some(mission), ai: vec![2], doc, editor, teams: Vec::new(), next, carry, surface: false, events: false };
if !self.start_match_game(info) {
return false;
}
@@ -805,6 +807,7 @@ impl App {
// the same land on every client: built from the shared seed
self.game.add_surface(info.seed, 0.5, 2 + (info.map_h / 64) as u32);
}
self.game.set_events(info.events);
self.game.coop = false;
self.game.set_teams(&info.teams);
self.game.ai_difficulty = info.difficulty;