feat(match): 添加画面上下镜像、跳过准备和装甲板整局复位
This commit is contained in:
39 files changed
+1094
-54
No files matched your search
@@ -122,21 +122,35 @@ fn spawn_armor(state: Arc<AppState>) {
|
||||
let mut ticks = [0u32, 7];
|
||||
let mut hits = [0usize, 1];
|
||||
let mut dead_for = [0u32, 0];
|
||||
let mut reset_epoch = 0;
|
||||
|
||||
loop {
|
||||
let epoch = state
|
||||
.demo_reset_epoch
|
||||
.load(std::sync::atomic::Ordering::Acquire);
|
||||
if epoch != reset_epoch {
|
||||
reset_epoch = epoch;
|
||||
hp = [100; 2];
|
||||
ticks = [0, 7];
|
||||
hits = [0, 1];
|
||||
dead_for = [0; 2];
|
||||
}
|
||||
let scripted = reset_epoch == 0 || state.demo_damage_enabled();
|
||||
for (slot, (board, team, port)) in boards.iter().enumerate() {
|
||||
ticks[slot] += 1;
|
||||
if scripted {
|
||||
ticks[slot] += 1;
|
||||
}
|
||||
|
||||
if hp[slot] == 0 {
|
||||
// 打空之后停一会儿再重置:让界面上的胜负横幅真的能被看到。
|
||||
dead_for[slot] += 1;
|
||||
if dead_for[slot] >= 10 {
|
||||
if reset_epoch == 0 && dead_for[slot] >= 10 {
|
||||
hp[slot] = 100;
|
||||
dead_for[slot] = 0;
|
||||
ticks[slot] = 0;
|
||||
log::info!("demo: 0x{board:08X} 重置为满血(长按 BOOT 的等价动作)");
|
||||
}
|
||||
} else if ticks[slot] % 15 == 0 {
|
||||
} else if scripted && ticks[slot] % 15 == 0 {
|
||||
// 约 3 秒一次。
|
||||
let damage = DAMAGE_CYCLE[hits[slot] % DAMAGE_CYCLE.len()];
|
||||
hits[slot] += 1;
|
||||
|
||||
Reference in new issue
Block a user