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};
23use crate::content::VoxelContentPlugin;
24#[cfg(feature = "items")]
25use crate::content::{BlockDropContentPlugin, ItemContentPlugin};
26#[cfg(feature = "crafting")]
27use crate::crafting::{CraftingPlugin, CraftingUiPlugin};
28use crate::effects::VoxelEffectsPlugin;
29use crate::fragments::FragmentPlugin;
30use crate::generator::{GeneratorPlugin, MultiGeneratorPlugin};
31#[cfg(feature = "items")]
32use crate::items::{DropsPlugin, HotbarPlugin, ItemType};
33use crate::mesh::MeshPlugin;
34#[cfg(feature = "mobs")]
35use crate::mobs::MobPlugin;
36use crate::player::PlayerPlugin;
37use crate::player::effects::{StatusEffect, StatusEffectsPlugin};
38use crate::render::RenderPlugin;
39use crate::skybox::SkyboxPlugin;
40use crate::stats::VoxelStatsPlugin;
41use crate::ui::{
42    CrosshairPlugin, DebugOverlayPlugin, LoadingScreenPlugin, PauseMenuPlugin, UiPlugin,
43};
44#[cfg(feature = "items")]
45use crate::ui::{HotbarUiPlugin, PickupNotificationPlugin};
46use crate::voxel::VoxelType;
47#[cfg(feature = "crafting")]
48use crate::world::manifest::WorldManifestPlugin;
49use crate::world::mining::MiningPlugin;
50use crate::world::{
51    DayCyclePlugin, LoadingPlugin, OcclusionPlugin, PersistencePlugin, PlacementPlugin,
52    WorldConfigPlugin, WorldPlugin,
53};
54#[cfg(feature = "items")]
55use crate::world::{MiningInputPlugin, PlacementInputPlugin};
56
57/// Marker for plugins that are part of the `voxel-framework` plugin catalog.
58pub trait VoxelFrameworkPlugin: Plugin {}
59
60/// Foundation/infrastructure plugins for streamable, renderable voxel worlds.
61pub trait EnginePlugin: VoxelFrameworkPlugin {}
62
63/// Chunk source, generation, persistence, and world lifecycle data plugins.
64pub trait WorldDataPlugin: VoxelFrameworkPlugin {}
65
66/// Reusable game rules and interaction plugins.
67pub trait GameplayPlugin: VoxelFrameworkPlugin {}
68
69/// Replaceable UI, audio, visual, and presentation default plugins.
70pub trait DefaultImplementationPlugin: VoxelFrameworkPlugin {}
71
72/// Exceptional compatibility, bundle, input-adapter, recipe, or prototype helper plugins.
73pub trait ConveniencePlugin: VoxelFrameworkPlugin {}
74
75impl VoxelFrameworkPlugin for WorldPlugin {}
76impl EnginePlugin for WorldPlugin {}
77
78impl VoxelFrameworkPlugin for WorldConfigPlugin {}
79impl EnginePlugin for WorldConfigPlugin {}
80
81impl<V: VoxelType> VoxelFrameworkPlugin for RenderPlugin<V> {}
82impl<V: VoxelType> EnginePlugin for RenderPlugin<V> {}
83
84impl<V: VoxelType> VoxelFrameworkPlugin for MeshPlugin<V> {}
85impl<V: VoxelType> EnginePlugin for MeshPlugin<V> {}
86
87impl<V: VoxelType> VoxelFrameworkPlugin for OcclusionPlugin<V> {}
88impl<V: VoxelType> EnginePlugin for OcclusionPlugin<V> {}
89
90impl VoxelFrameworkPlugin for LoadingPlugin {}
91impl EnginePlugin for LoadingPlugin {}
92
93impl<V: VoxelType> VoxelFrameworkPlugin for GeneratorPlugin<V> {}
94impl<V: VoxelType> WorldDataPlugin for GeneratorPlugin<V> {}
95
96impl<V: VoxelType> VoxelFrameworkPlugin for MultiGeneratorPlugin<V> {}
97impl<V: VoxelType> WorldDataPlugin for MultiGeneratorPlugin<V> {}
98
99impl<V: VoxelType> VoxelFrameworkPlugin for PersistencePlugin<V> {}
100impl<V: VoxelType> WorldDataPlugin for PersistencePlugin<V> {}
101
102impl<V: VoxelType> VoxelFrameworkPlugin for VoxelContentPlugin<V> {}
103impl<V: VoxelType> GameplayPlugin for VoxelContentPlugin<V> {}
104
105impl VoxelFrameworkPlugin for VoxelStatsPlugin {}
106impl GameplayPlugin for VoxelStatsPlugin {}
107
108impl VoxelFrameworkPlugin for VoxelEffectsPlugin {}
109impl GameplayPlugin for VoxelEffectsPlugin {}
110
111#[cfg(feature = "items")]
112impl<I: ItemType> VoxelFrameworkPlugin for ItemContentPlugin<I> {}
113#[cfg(feature = "items")]
114impl<I: ItemType> GameplayPlugin for ItemContentPlugin<I> {}
115
116#[cfg(feature = "items")]
117impl<I: ItemType> VoxelFrameworkPlugin for BlockDropContentPlugin<I> {}
118#[cfg(feature = "items")]
119impl<I: ItemType> GameplayPlugin for BlockDropContentPlugin<I> {}
120
121#[cfg(feature = "crafting")]
122impl<V: VoxelType, I: ItemType> VoxelFrameworkPlugin for WorldManifestPlugin<V, I> {}
123#[cfg(feature = "crafting")]
124impl<V: VoxelType, I: ItemType> WorldDataPlugin for WorldManifestPlugin<V, I> {}
125
126impl VoxelFrameworkPlugin for MiningPlugin {}
127impl GameplayPlugin for MiningPlugin {}
128
129impl VoxelFrameworkPlugin for PlacementPlugin {}
130impl GameplayPlugin for PlacementPlugin {}
131
132impl<V: VoxelType> VoxelFrameworkPlugin for PlayerPlugin<V> {}
133impl<V: VoxelType> GameplayPlugin for PlayerPlugin<V> {}
134
135#[cfg(feature = "items")]
136impl VoxelFrameworkPlugin for HotbarPlugin {}
137#[cfg(feature = "items")]
138impl GameplayPlugin for HotbarPlugin {}
139
140#[cfg(feature = "items")]
141impl<I: ItemType> VoxelFrameworkPlugin for DropsPlugin<I> {}
142#[cfg(feature = "items")]
143impl<I: ItemType> GameplayPlugin for DropsPlugin<I> {}
144
145#[cfg(feature = "crafting")]
146impl<I: ItemType> VoxelFrameworkPlugin for CraftingPlugin<I> {}
147#[cfg(feature = "crafting")]
148impl<I: ItemType> GameplayPlugin for CraftingPlugin<I> {}
149
150#[cfg(feature = "mobs")]
151impl<V: VoxelType> VoxelFrameworkPlugin for MobPlugin<V> {}
152#[cfg(feature = "mobs")]
153impl<V: VoxelType> GameplayPlugin for MobPlugin<V> {}
154
155impl<E: StatusEffect> VoxelFrameworkPlugin for StatusEffectsPlugin<E> {}
156impl<E: StatusEffect> GameplayPlugin for StatusEffectsPlugin<E> {}
157
158impl VoxelFrameworkPlugin for FragmentPlugin {}
159impl DefaultImplementationPlugin for FragmentPlugin {}
160
161impl VoxelFrameworkPlugin for SkyboxPlugin {}
162impl DefaultImplementationPlugin for SkyboxPlugin {}
163
164impl VoxelFrameworkPlugin for SfxPlugin {}
165impl DefaultImplementationPlugin for SfxPlugin {}
166
167impl VoxelFrameworkPlugin for DefaultAudioPlugin {}
168impl DefaultImplementationPlugin for DefaultAudioPlugin {}
169
170impl VoxelFrameworkPlugin for UiPlugin {}
171impl DefaultImplementationPlugin for UiPlugin {}
172
173impl VoxelFrameworkPlugin for CrosshairPlugin {}
174impl DefaultImplementationPlugin for CrosshairPlugin {}
175
176impl VoxelFrameworkPlugin for LoadingScreenPlugin {}
177impl DefaultImplementationPlugin for LoadingScreenPlugin {}
178
179#[cfg(feature = "items")]
180impl VoxelFrameworkPlugin for HotbarUiPlugin {}
181#[cfg(feature = "items")]
182impl DefaultImplementationPlugin for HotbarUiPlugin {}
183
184#[cfg(feature = "items")]
185impl<I: ItemType> VoxelFrameworkPlugin for PickupNotificationPlugin<I> {}
186#[cfg(feature = "items")]
187impl<I: ItemType> DefaultImplementationPlugin for PickupNotificationPlugin<I> {}
188
189impl VoxelFrameworkPlugin for PauseMenuPlugin {}
190impl DefaultImplementationPlugin for PauseMenuPlugin {}
191
192impl VoxelFrameworkPlugin for DebugOverlayPlugin {}
193impl DefaultImplementationPlugin for DebugOverlayPlugin {}
194
195impl VoxelFrameworkPlugin for DayCyclePlugin {}
196impl DefaultImplementationPlugin for DayCyclePlugin {}
197
198impl<V: VoxelType> VoxelFrameworkPlugin for crate::VoxelCorePlugin<V> {}
199impl<V: VoxelType> ConveniencePlugin for crate::VoxelCorePlugin<V> {}
200
201impl<V: VoxelType> VoxelFrameworkPlugin for crate::VoxelPlugin<V> {}
202impl<V: VoxelType> ConveniencePlugin for crate::VoxelPlugin<V> {}
203
204#[cfg(feature = "items")]
205impl<V: VoxelType, I: ItemType> VoxelFrameworkPlugin for MiningInputPlugin<V, I> {}
206#[cfg(feature = "items")]
207impl<V: VoxelType, I: ItemType> ConveniencePlugin for MiningInputPlugin<V, I> {}
208
209#[cfg(feature = "items")]
210impl<V: VoxelType> VoxelFrameworkPlugin for PlacementInputPlugin<V> {}
211#[cfg(feature = "items")]
212impl<V: VoxelType> ConveniencePlugin for PlacementInputPlugin<V> {}
213
214#[cfg(feature = "crafting")]
215impl<I: ItemType> VoxelFrameworkPlugin for CraftingUiPlugin<I> {}
216#[cfg(feature = "crafting")]
217impl<I: ItemType> ConveniencePlugin for CraftingUiPlugin<I> {}