48 lines
741 B
Rust
48 lines
741 B
Rust
use bevy::prelude::*;
|
|
|
|
#[derive(Component)]
|
|
#[require(Sprite, Transform, Visibility)]
|
|
pub struct Item {
|
|
wear: u8,
|
|
quality: u8,
|
|
weight: u8,
|
|
stain_time: u16,
|
|
}
|
|
|
|
impl Default for Item {
|
|
fn default() -> Self {
|
|
Self {
|
|
wear: 0,
|
|
quality: 0,
|
|
weight: 0,
|
|
stain_time: 16,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Item {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
..Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Bundle)]
|
|
pub struct ItemBundle {
|
|
pub item: Item,
|
|
pub transform: Transform,
|
|
pub sprite: Sprite,
|
|
pub visibility: Visibility,
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct Nameable {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct Decaying {
|
|
decay: u8,
|
|
}
|