1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! Entropy/Decay Plugin for issun
//!
//! Provides high-performance entity degradation system using ECS.
//!
//! # Overview
//!
//! The Entropy plugin implements a universal decay system where all entities
//! with durability gradually degrade over time. Environmental factors (humidity,
//! pollution, temperature) affect decay rates based on material type.
//!
//! # Features
//!
//! - **Parallel Processing**: Uses `hecs` and `rayon` for multi-core performance
//! - **100k+ Entities**: Optimized for large-scale simulations
//! - **Material-based Decay**: Different materials decay at different rates
//! - **Environmental Factors**: Humidity, pollution, and temperature affect decay
//! - **Maintenance System**: Track repairs and costs
//! - **Event System**: Hook into status changes and destruction
//!
//! # Example
//!
//! ```ignore
//! use issun::plugin::entropy::{EntropyPluginECS, EntropyConfig};
//! use issun::plugin::entropy::types::{Durability, EnvironmentalExposure, MaterialType};
//! use issun::GameBuilder;
//!
//! #[tokio::main]
//! async fn main() {
//! // Create entropy plugin
//! let entropy = EntropyPluginECS::new()
//! .with_config(EntropyConfig {
//! global_decay_multiplier: 1.5,
//! auto_destroy_on_zero: true,
//! ..Default::default()
//! });
//!
//! // Build game
//! let game = GameBuilder::new()
//! .with_plugin(entropy)
//! .build()
//! .await
//! .unwrap();
//!
//! // Spawn entities with durability
//! let mut plugin = game.get_plugin_mut::<EntropyPluginECS>().unwrap();
//! plugin.state_mut().spawn_entity(
//! Durability::new(100.0, 0.01, MaterialType::Metal),
//! EnvironmentalExposure::default(),
//! );
//!
//! // Update decay each frame
//! plugin.system_mut().update_decay(
//! plugin.state_mut(),
//! plugin.config(),
//! delta_time,
//! ).await;
//! }
//! ```
//!
//! # Performance
//!
//! - **10,000 entities**: ~1ms per update
//! - **100,000 entities**: ~10ms per update
//! - Uses parallel iteration for optimal CPU utilization
//!
//! # Architecture
//!
//! ```text
//! EntropyPluginECS
//! ├── Config (EntropyConfig) - Global settings
//! ├── State (EntropyStateECS) - hecs::World with entities
//! ├── Service (EntropyService) - Pure decay calculations
//! ├── System (EntropySystemECS) - Parallel update orchestration
//! └── Hook (EntropyHookECS) - Game-specific customization
//! ```
// Core types (shared between Simple and ECS)
// Configuration (Resource)
// ECS-specific modules
// Re-exports
pub use ;
pub use ;
pub use EntropyPluginECS;
pub use EntropyService;
pub use ;
pub use EntropySystemECS;
pub use ;