1use crate::prelude::*;
2
3pub struct ActionList {
4 pub actions: Vec<Box<dyn Action>>,
5}
6
7impl Default for ActionList {
8 fn default() -> Self {
9 Self::new()
10 }
11}
12
13impl ActionList {
14 pub fn new() -> Self {
15 let actions: Vec<Box<dyn Action>> = vec![
16 Box::new(crate::tools::editing_camera::EditingCamera::new()),
17 Box::new(crate::tools::firstp_camera::FirstPCamera::new()),
18 Box::new(crate::tools::iso_camera::IsoCamera::new()),
19 Box::new(crate::tools::orbit_camera::OrbitCamera::new()),
20 Box::new(crate::tools::add_arch::AddArch::new()),
21 Box::new(crate::tools::apply_tile::ApplyTile::new()),
22 Box::new(crate::tools::clear_profile::ClearProfile::new()),
23 Box::new(crate::tools::clear_tile::ClearTile::new()),
24 Box::new(crate::tools::copy_tile_id::CopyTileID::new()),
25 Box::new(crate::tools::copy_vcode::CopyVCode::new()),
26 Box::new(crate::tools::create_center_vertex::CreateCenterVertex::new()),
27 Box::new(crate::tools::create_campfire::CreateCampfire::new()),
28 Box::new(crate::tools::create_fence::CreateFence::new()),
29 Box::new(crate::tools::create_linedef::CreateLinedef::new()),
30 Box::new(crate::tools::create_palisade::CreatePalisade::new()),
31 Box::new(crate::tools::create_prop::CreateProp::new()),
32 Box::new(crate::tools::create_roof::CreateRoof::new()),
33 Box::new(crate::tools::create_sector::CreateSector::new()),
34 Box::new(crate::tools::create_stairs::CreateStairs::new()),
35 Box::new(crate::tools::clear_palette::ClearPalette::new()),
36 Box::new(crate::tools::duplicate::Duplicate::new()),
37 Box::new(crate::tools::duplicate_tile::DuplicateTile::new()),
38 Box::new(crate::tools::edit_maximize::EditMaximize::new()),
39 Box::new(crate::tools::edit_linedef::EditLinedef::new()),
40 Box::new(crate::tools::edit_sector::EditSector::new()),
41 Box::new(crate::tools::edit_vertex::EditVertex::new()),
42 Box::new(crate::tools::editing_slice::EditingSlice::new()),
43 Box::new(crate::tools::edit_tile_meta::EditTileMeta::new()),
44 Box::new(crate::tools::export_vcode::ExportVCode::new()),
45 Box::new(crate::tools::extrude_linedef::ExtrudeLinedef::new()),
46 Box::new(crate::tools::extrude_sector::ExtrudeSector::new()),
47 Box::new(crate::tools::gate_door::GateDoor::new()),
48 Box::new(crate::tools::window::Window::new()),
49 Box::new(crate::tools::import_vcode::ImportVCode::new()),
50 Box::new(crate::tools::paste_vcode::PasteVCode::new()),
51 Box::new(crate::tools::import_palette::ImportPalette::new()),
52 Box::new(crate::tools::new_tile::NewTile::new()),
53 Box::new(crate::tools::minimize::Minimize::new()),
54 Box::new(crate::tools::recess::Recess::new()),
55 Box::new(crate::tools::relief::Relief::new()),
56 Box::new(crate::tools::remap_tile::RemapTile::new()),
57 Box::new(crate::tools::set_editing_surface::SetEditingSurface::new()),
58 Box::new(crate::tools::set_tile_material::SetTileMaterial::new()),
59 Box::new(crate::tools::split::Split::new()),
60 Box::new(crate::tools::toggle_editing_geo::ToggleEditingGeo::new()),
61 Box::new(crate::tools::toggle_rect_geo::ToggleRectGeo::new()),
62 ];
63 Self { actions }
64 }
65
66 pub fn get_action_by_id(&self, id: Uuid) -> Option<&Box<dyn Action>> {
68 for action in &self.actions {
69 if action.id().uuid == id {
70 return Some(action);
71 }
72 }
73 None
74 }
75
76 pub fn get_action_by_id_mut(&mut self, id: Uuid) -> Option<&mut Box<dyn Action>> {
78 for action in &mut self.actions {
79 if action.id().uuid == id {
80 return Some(action);
81 }
82 }
83 None
84 }
85}