Multiplayer step B: every player order is a command (dig, build, cast, hand, orders) and the simulation runs in fixed 50 ms steps, so single player and a match take the same path

This commit is contained in:
Richard Zink committed 2026-11-04 09:57:02 +01:00
1 parent d6bcce3a76
commit 1ec7492189
8 files changed
+635 -101

No files matched your search

+3 -3
View File
@@ -166,7 +166,7 @@ impl Game {
return;
}
let t = self.map.t[i];
if t.kind != Kind::Floor || t.owner != Owner::Player {
if t.kind != Kind::Floor || t.owner != self.me {
self.hint(25, "hint.trap_where");
self.sfx_ui(Sfx::Error);
return;
@@ -201,7 +201,7 @@ impl Game {
self.traps[k].progress += work;
if self.traps[k].progress >= self.traps[k].kind.work() {
// finished: a crate on a forge tile
let spot = self.map.t.iter().enumerate().filter(|(_, t)| t.kind == Kind::Forge && t.owner == Owner::Player).map(|(i, _)| i).nth(self.traps[k].id as usize % self.forge_tiles().max(1));
let spot = self.map.t.iter().enumerate().filter(|(_, t)| t.kind == Kind::Forge && t.owner == self.me).map(|(i, _)| i).nth(self.traps[k].id as usize % self.forge_tiles().max(1));
match spot {
Some(s) => {
let t = &mut self.traps[k];
@@ -219,7 +219,7 @@ impl Game {
}
// orders on lost ground are dropped
let map = &self.map;
self.traps.retain(|t| t.stage == ARMED || map.t[t.tile].owner == Owner::Player);
self.traps.retain(|t| t.stage == ARMED || map.t[t.tile].owner == self.me);
for t in self.traps.iter_mut() {
t.fired += dt;
t.cd -= dt;