Skip to main content

voxel_framework/
plugin_category.rs

1//! Official plugin category marker traits.
2//!
3//! `voxel-framework` exposes a flat catalog of Bevy plugins. These marker
4//! traits document each plugin's primary architectural responsibility without
5//! changing Bevy's normal [`Plugin`] composition model.
6//!
7//! A plugin should normally belong to exactly one category:
8//!
9//! - [`EnginePlugin`] — foundation for streamable/renderable voxel worlds.
10//! - [`WorldDataPlugin`] — chunk sources, generation, persistence, and world
11//!   lifecycle data.
12//! - [`GameplayPlugin`] — reusable game rules and interactions.
13//! - [`DefaultImplementationPlugin`] — replaceable UI/audio/visual defaults.
14//! - [`ConveniencePlugin`] — compatibility bundles, input adapters, recipes,
15//!   and prototyping helpers.
16//!
17//! New domain behavior should not start as [`ConveniencePlugin`]. Convenience
18//! plugins should compose or adapt plugins from the stricter categories.
19
20use bevy::app::Plugin;
21
22use crate::audio::{DefaultAudioPlugin, SfxPlugin};
23#[cfg(feature = "crafting")]
24use crate::crafting::{CraftingPlugin, CraftingUiPlugin};
25use crate::fragments::FragmentPlugin;
26use crate::generator::{GeneratorPlugin, MultiGeneratorPlugin};
27#[cfg(feature = "items")]
28use crate::items::{DropsPlugin, HotbarPlugin, ItemType};
29use crate::mesh::MeshPlugin;
30#[cfg(feature = "mobs")]
31use crate::mobs::MobPlugin;
32use crate::player::PlayerPlugin;
33use crate::player::effects::{StatusEffect, StatusEffectsPlugin};
34use crate::render::RenderPlugin;
35use crate::skybox::SkyboxPlugin;
36use crate::ui::{
37    CrosshairPlugin, DebugOverlayPlugin, LoadingScreenPlugin, PauseMenuPlugin, UiPlugin,
38};
39#[cfg(feature = "items")]
40use crate::ui::{HotbarUiPlugin, PickupNotificationPlugin};
41use crate::voxel::VoxelType;
42#[cfg(feature = "crafting")]
43use crate::world::manifest::WorldManifestPlugin;
44use crate::world::mining::MiningPlugin;
45use crate::world::{
46    DayCyclePlugin, LoadingPlugin, OcclusionPlugin, PersistencePlugin, PlacementPlugin,
47    WorldConfigPlugin, WorldPlugin,
48};
49#[cfg(feature = "items")]
50use crate::world::{MiningInputPlugin, PlacementInputPlugin};
51
52/// Marker for plugins that are part of the `voxel-framework` plugin catalog.
53pub trait VoxelFrameworkPlugin: Plugin {}
54
55/// Foundation/infrastructure plugins for streamable, renderable voxel worlds.
56pub trait EnginePlugin: VoxelFrameworkPlugin {}
57
58/// Chunk source, generation, persistence, and world lifecycle data plugins.
59pub trait WorldDataPlugin: VoxelFrameworkPlugin {}
60
61/// Reusable game rules and interaction plugins.
62pub trait GameplayPlugin: VoxelFrameworkPlugin {}
63
64/// Replaceable UI, audio, visual, and presentation default plugins.
65pub trait DefaultImplementationPlugin: VoxelFrameworkPlugin {}
66
67/// Exceptional compatibility, bundle, input-adapter, recipe, or prototype helper plugins.
68pub trait ConveniencePlugin: VoxelFrameworkPlugin {}
69
70impl VoxelFrameworkPlugin for WorldPlugin {}
71impl EnginePlugin for WorldPlugin {}
72
73impl VoxelFrameworkPlugin for WorldConfigPlugin {}
74impl EnginePlugin for WorldConfigPlugin {}
75
76impl<V: VoxelType> VoxelFrameworkPlugin for RenderPlugin<V> {}
77impl<V: VoxelType> EnginePlugin for RenderPlugin<V> {}
78
79impl<V: VoxelType> VoxelFrameworkPlugin for MeshPlugin<V> {}
80impl<V: VoxelType> EnginePlugin for MeshPlugin<V> {}
81
82impl<V: VoxelType> VoxelFrameworkPlugin for OcclusionPlugin<V> {}
83impl<V: VoxelType> EnginePlugin for OcclusionPlugin<V> {}
84
85impl VoxelFrameworkPlugin for LoadingPlugin {}
86impl EnginePlugin for LoadingPlugin {}
87
88impl<V: VoxelType> VoxelFrameworkPlugin for GeneratorPlugin<V> {}
89impl<V: VoxelType> WorldDataPlugin for GeneratorPlugin<V> {}
90
91impl<V: VoxelType> VoxelFrameworkPlugin for MultiGeneratorPlugin<V> {}
92impl<V: VoxelType> WorldDataPlugin for MultiGeneratorPlugin<V> {}
93
94impl<V: VoxelType> VoxelFrameworkPlugin for PersistencePlugin<V> {}
95impl<V: VoxelType> WorldDataPlugin for PersistencePlugin<V> {}
96
97#[cfg(feature = "crafting")]
98impl<V: VoxelType, I: ItemType> VoxelFrameworkPlugin for WorldManifestPlugin<V, I> {}
99#[cfg(feature = "crafting")]
100impl<V: VoxelType, I: ItemType> WorldDataPlugin for WorldManifestPlugin<V, I> {}
101
102impl VoxelFrameworkPlugin for MiningPlugin {}
103impl GameplayPlugin for MiningPlugin {}
104
105impl VoxelFrameworkPlugin for PlacementPlugin {}
106impl GameplayPlugin for PlacementPlugin {}
107
108impl<V: VoxelType> VoxelFrameworkPlugin for PlayerPlugin<V> {}
109impl<V: VoxelType> GameplayPlugin for PlayerPlugin<V> {}
110
111#[cfg(feature = "items")]
112impl VoxelFrameworkPlugin for HotbarPlugin {}
113#[cfg(feature = "items")]
114impl GameplayPlugin for HotbarPlugin {}
115
116#[cfg(feature = "items")]
117impl<I: ItemType> VoxelFrameworkPlugin for DropsPlugin<I> {}
118#[cfg(feature = "items")]
119impl<I: ItemType> GameplayPlugin for DropsPlugin<I> {}
120
121#[cfg(feature = "crafting")]
122impl<I: ItemType> VoxelFrameworkPlugin for CraftingPlugin<I> {}
123#[cfg(feature = "crafting")]
124impl<I: ItemType> GameplayPlugin for CraftingPlugin<I> {}
125
126#[cfg(feature = "mobs")]
127impl<V: VoxelType> VoxelFrameworkPlugin for MobPlugin<V> {}
128#[cfg(feature = "mobs")]
129impl<V: VoxelType> GameplayPlugin for MobPlugin<V> {}
130
131impl<E: StatusEffect> VoxelFrameworkPlugin for StatusEffectsPlugin<E> {}
132impl<E: StatusEffect> GameplayPlugin for StatusEffectsPlugin<E> {}
133
134impl VoxelFrameworkPlugin for FragmentPlugin {}
135impl DefaultImplementationPlugin for FragmentPlugin {}
136
137impl VoxelFrameworkPlugin for SkyboxPlugin {}
138impl DefaultImplementationPlugin for SkyboxPlugin {}
139
140impl VoxelFrameworkPlugin for SfxPlugin {}
141impl DefaultImplementationPlugin for SfxPlugin {}
142
143impl VoxelFrameworkPlugin for DefaultAudioPlugin {}
144impl DefaultImplementationPlugin for DefaultAudioPlugin {}
145
146impl VoxelFrameworkPlugin for UiPlugin {}
147impl DefaultImplementationPlugin for UiPlugin {}
148
149impl VoxelFrameworkPlugin for CrosshairPlugin {}
150impl DefaultImplementationPlugin for CrosshairPlugin {}
151
152impl VoxelFrameworkPlugin for LoadingScreenPlugin {}
153impl DefaultImplementationPlugin for LoadingScreenPlugin {}
154
155#[cfg(feature = "items")]
156impl VoxelFrameworkPlugin for HotbarUiPlugin {}
157#[cfg(feature = "items")]
158impl DefaultImplementationPlugin for HotbarUiPlugin {}
159
160#[cfg(feature = "items")]
161impl<I: ItemType> VoxelFrameworkPlugin for PickupNotificationPlugin<I> {}
162#[cfg(feature = "items")]
163impl<I: ItemType> DefaultImplementationPlugin for PickupNotificationPlugin<I> {}
164
165impl VoxelFrameworkPlugin for PauseMenuPlugin {}
166impl DefaultImplementationPlugin for PauseMenuPlugin {}
167
168impl VoxelFrameworkPlugin for DebugOverlayPlugin {}
169impl DefaultImplementationPlugin for DebugOverlayPlugin {}
170
171impl VoxelFrameworkPlugin for DayCyclePlugin {}
172impl DefaultImplementationPlugin for DayCyclePlugin {}
173
174impl<V: VoxelType> VoxelFrameworkPlugin for crate::VoxelCorePlugin<V> {}
175impl<V: VoxelType> ConveniencePlugin for crate::VoxelCorePlugin<V> {}
176
177impl<V: VoxelType> VoxelFrameworkPlugin for crate::VoxelPlugin<V> {}
178impl<V: VoxelType> ConveniencePlugin for crate::VoxelPlugin<V> {}
179
180#[cfg(feature = "items")]
181impl<V: VoxelType, I: ItemType> VoxelFrameworkPlugin for MiningInputPlugin<V, I> {}
182#[cfg(feature = "items")]
183impl<V: VoxelType, I: ItemType> ConveniencePlugin for MiningInputPlugin<V, I> {}
184
185#[cfg(feature = "items")]
186impl<V: VoxelType> VoxelFrameworkPlugin for PlacementInputPlugin<V> {}
187#[cfg(feature = "items")]
188impl<V: VoxelType> ConveniencePlugin for PlacementInputPlugin<V> {}
189
190#[cfg(feature = "crafting")]
191impl<I: ItemType> VoxelFrameworkPlugin for CraftingUiPlugin<I> {}
192#[cfg(feature = "crafting")]
193impl<I: ItemType> ConveniencePlugin for CraftingUiPlugin<I> {}