east_online_core/model/
placable.rs

1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5use super::{Rotation, Vector3};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct Placable {
9    pub id: String,
10    pub rotation: Rotation,
11}
12
13impl Placable {
14    pub fn repeat(&self, x: i32, y: i32, z: i32) -> BTreeMap<Vector3, Self> {
15        let mut result = BTreeMap::default();
16
17        for x in 0..x {
18            for z in 0..z {
19                for y in 0..y {
20                    result.insert(Vector3 { x, y, z }, self.clone());
21                }
22            }
23        }
24
25        result
26    }
27}