Final missions above ground (M30, co-op M20), surface option for versus matches, docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ae41228ab
commit
f27dbea2f1
28 files changed
+111
-49
No files matched your search
@@ -6,7 +6,8 @@
|
||||
//
|
||||
// Lobby messages (JSON, one object per WebSocket frame):
|
||||
// {"t":"rooms"} -> list of open matches
|
||||
// {"t":"create","sides":[0,2,3,4]?,"map_w":96?,"map_h":128?,"difficulty":1?,"mission":12?,"doc":{..}?}
|
||||
// {"t":"create","sides":[0,2,3,4]?,"map_w":96?,"map_h":128?,"difficulty":1?,"mission":12?,"doc":{..}?,"surface":true?}
|
||||
// -> "surface": a free match whose eastern half lies above ground
|
||||
// -> "doc": an editor campaign (CampaignDoc JSON) for a co-op
|
||||
// match of its mission "mission"; it goes along with "start"
|
||||
// "seed":77?,"carry":[..]? with a doc: an interrupted run goes
|
||||
@@ -88,6 +89,7 @@ struct Room {
|
||||
mission: Option<usize>,
|
||||
doc: Option<Value>, // editor campaign of a co-op match (sent to every client at the start)
|
||||
resume: Option<(u32, Value)>, // a resumed editor campaign run: its seed and what the masters carry
|
||||
surface: bool, // a free match half above ground
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -382,7 +384,7 @@ impl Netplay {
|
||||
}
|
||||
let name = self.clients.get(&conn).map(|c| c.name.clone()).unwrap_or_else(|| "Guest".into());
|
||||
let seats = sides.iter().map(|s| (*s, new_seat(*s, false))).collect::<HashMap<_, _>>();
|
||||
let room = Room { code: code.clone(), sides, seats, pending: HashMap::new(), turn: 0, started: false, paused: false, missing: false, seed: None, map_w, map_h, difficulty, mission, doc, resume };
|
||||
let room = Room { code: code.clone(), sides, seats, pending: HashMap::new(), turn: 0, started: false, paused: false, missing: false, seed: None, map_w, map_h, difficulty, mission, doc, resume, surface: msg.get("surface").and_then(|v| v.as_bool()).unwrap_or(false) };
|
||||
self.rooms.insert(code.clone(), room);
|
||||
if let Some(c) = self.clients.get_mut(&conn) {
|
||||
c.room = Some(code.clone());
|
||||
@@ -647,6 +649,9 @@ impl Netplay {
|
||||
if let Some(doc) = &r.doc {
|
||||
m["doc"] = doc.clone();
|
||||
}
|
||||
if r.surface {
|
||||
m["surface"] = json!(true);
|
||||
}
|
||||
if let Some((_, carry)) = &r.resume {
|
||||
m["carry"] = carry.clone();
|
||||
m["resume"] = json!(true);
|
||||
|
||||
Reference in new issue
Block a user