vintage_schematics/convert/
mod.rs1use crate::formats::internal::PropertyMap;
4
5pub mod block;
6pub mod entities;
7pub mod material;
8pub mod mods;
9
10fn determine_orientation(properties: &PropertyMap) -> Option<&str> {
11 properties
12 .iter()
13 .find_map(|(k, v)| match k.as_str() {
14 "north" | "south" | "east" | "west" if v == "true" => Some(k),
15 _ => None,
16 })
17 .map(String::as_str)
18}
19
20fn reverse_orientation(orientation: &str) -> &str {
29 match orientation {
30 "north" => "south",
31 "south" => "north",
32 "east" => "west",
33 _ => "east",
34 }
35}
36
37fn orientation_to_radians(facing: &str) -> f32 {
38 match facing {
39 "north" => 0.0,
40 "east" => std::f32::consts::PI * 3.0 / 2.0,
41 "south" => std::f32::consts::PI,
42 _ => std::f32::consts::FRAC_PI_2,
43 }
44}