Skip to main content

nil_core/world/cheat/
behavior.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::bail_if_cheats_are_not_allowed;
5use crate::behavior::r#impl::build::{BUILD_TEMPLATE, BuildStep};
6use crate::continent::index::ContinentKey;
7use crate::error::Result;
8use crate::world::World;
9use itertools::Itertools;
10use tap::Pipe;
11
12pub fn get_build_steps(world: &World, key: impl ContinentKey) -> Result<Vec<BuildStep>> {
13  bail_if_cheats_are_not_allowed!(world);
14  let infrastructure = world.infrastructure(key)?;
15  BUILD_TEMPLATE
16    .iter()
17    .filter(|step| !step.is_done(infrastructure))
18    .cloned()
19    .collect_vec()
20    .pipe(Ok)
21}