Skip to main content

vitium_api/game/components/
item.rs

1use bevy_ecs::component::Component;
2use serde::{Deserialize, Serialize};
3use std::collections::HashSet;
4
5/// Basic information of an item is stored here.
6#[derive(Clone, Serialize, Deserialize, Component)]
7#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
8#[cfg_attr(
9    target_family = "wasm",
10    tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
11)]
12pub struct Item {
13    pub name: String,
14    pub descr: String,
15    /// In milimetres.
16    pub length: i32,
17    /// In mililitres.
18    pub volume: i32,
19    /// In grams.
20    pub weight: i32,
21    /// If the item is opaque.
22    pub opaque: bool,
23    /// In the smallest currency unit, like 1 USD cent.
24    pub price: i32,
25    /// Extended information displayed.
26    pub ext_info: Vec<String>,
27    /// Flags.
28    pub flag: HashSet<String>,
29}