Move sharable stuff into extra crate
This commit is contained in:
parent
09425fd0e7
commit
5346559e61
33 changed files with 61 additions and 82 deletions
|
@ -19,6 +19,7 @@ members = [
|
|||
"scene_update_macros",
|
||||
"transaction_derive",
|
||||
"map",
|
||||
"rpg_components",
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
|
|
|
@ -22,6 +22,7 @@ promise = { path = "../promise" }
|
|||
lua-wrapper = { path = "../lua-wrapper" }
|
||||
controllable_thread = { path = "../controllable_thread" }
|
||||
map = { path = "../map" }
|
||||
rpg_components = { path = "../rpg_components" }
|
||||
|
||||
[features]
|
||||
wayland = []
|
||||
|
|
|
@ -2,33 +2,17 @@ pub mod animation_info;
|
|||
pub mod hitbox;
|
||||
pub mod movement;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
mod ability_location_info;
|
||||
mod ability_slots;
|
||||
mod abilityloader;
|
||||
pub mod ai;
|
||||
mod aoe;
|
||||
mod attributes;
|
||||
mod character_status;
|
||||
mod crafting_materials;
|
||||
pub mod aoe_arc;
|
||||
pub mod damage_number;
|
||||
mod entity_faction;
|
||||
mod ghost;
|
||||
mod item_slots;
|
||||
mod level;
|
||||
pub mod health_bar;
|
||||
mod loot_stash;
|
||||
mod npc_name;
|
||||
mod statistic_types;
|
||||
mod statistics;
|
||||
|
||||
pub mod ai;
|
||||
|
||||
pub mod aoe_arc;
|
||||
|
||||
mod inventory;
|
||||
|
||||
pub mod damage_number;
|
||||
pub mod health_bar;
|
||||
mod npc_type;
|
||||
|
||||
pub use self::{ai::*, aoe_arc::AreaOfEffectArc};
|
||||
|
|
|
@ -2,6 +2,7 @@ use anyhow::Result;
|
|||
use assetpath::AssetPath;
|
||||
use cgmath::{vec2, Vector2};
|
||||
use engine::prelude::*;
|
||||
use rpg_components::components::{crafting_materials::CraftingMaterials, statistics::Statistics};
|
||||
|
||||
use super::super::prelude::*;
|
||||
|
||||
|
|
12
rpg_components/Cargo.toml
Normal file
12
rpg_components/Cargo.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "rpg_components"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
paste = { workspace = true }
|
||||
assetpath = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
engine = { path = "../engine" }
|
|
@ -1,18 +1,12 @@
|
|||
use anyhow::Result;
|
||||
use cgmath::{Vector2, Zero};
|
||||
|
||||
use engine::prelude::*;
|
||||
|
||||
use std::slice::IterMut;
|
||||
|
||||
use crate::game::{configloader::*, content::prelude::*};
|
||||
|
||||
use crate::game::game::GameHandle;
|
||||
|
||||
use paste;
|
||||
use std::str::FromStr;
|
||||
|
||||
use std::slice::Iter;
|
||||
use std::{
|
||||
slice::{Iter, IterMut},
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
macro_rules! load {
|
||||
($me: ident, $save_game:ident, $($index:literal,)+) => {
|
|
@ -1,5 +1,3 @@
|
|||
use crate::{game::configloader::*, ItemSystem};
|
||||
|
||||
use anyhow::bail;
|
||||
use engine::prelude::{image::RgbaImage, *};
|
||||
|
|
@ -2,9 +2,6 @@ use engine::prelude::*;
|
|||
|
||||
use paste::paste;
|
||||
|
||||
use crate::game::configloader::*;
|
||||
use crate::game::content::prelude::*;
|
||||
|
||||
macro_rules! check_consume {
|
||||
($self: ident, $var: ident, $amount: ident) => {
|
||||
paste! {
|
|
@ -1,6 +1,3 @@
|
|||
use crate::game::configloader::*;
|
||||
use crate::game::content::prelude::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use engine::prelude::*;
|
||||
use std::slice::Iter;
|
|
@ -1,16 +1,9 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::super::prelude::*;
|
||||
use crate::game::configloader::*;
|
||||
use crate::GameHandle;
|
||||
use anyhow::Result;
|
||||
|
||||
use engine::prelude::*;
|
||||
|
||||
use paste;
|
||||
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
macro_rules! load_item {
|
||||
($me:ident, $var_name:ident, $slot:ident, $save_game:ident, $item_system:ident) => {
|
||||
if $save_game.$var_name.used {
|
|
@ -1,5 +1,3 @@
|
|||
use crate::{game::configloader::experience::ExperienceSettings, *};
|
||||
|
||||
use anyhow::Result;
|
||||
use engine::prelude::*;
|
||||
|
|
@ -101,7 +101,7 @@ macro_rules! generate_stat {
|
|||
};
|
||||
}
|
||||
|
||||
use super::Attributes;
|
||||
use super::attributes::Attributes;
|
||||
|
||||
pub trait AttributeAssociation {
|
||||
fn attribute_level(&self, attributes: &Attributes) -> u32;
|
12
rpg_components/src/components/mod.rs
Normal file
12
rpg_components/src/components/mod.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
pub mod ability_slots;
|
||||
pub mod attributes;
|
||||
pub mod character_status;
|
||||
pub mod crafting_materials;
|
||||
pub mod inventory;
|
||||
pub mod item_slots;
|
||||
pub mod level;
|
||||
pub mod statistic_types;
|
||||
pub mod statistics;
|
||||
|
||||
#[macro_use]
|
||||
pub mod macros;
|
|
@ -1,6 +1,3 @@
|
|||
use crate::game::configloader::*;
|
||||
use crate::game::content::prelude::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use engine::prelude::*;
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
use crate::game::{configloader::*, content::prelude::*};
|
||||
|
||||
use engine::prelude::*;
|
||||
|
||||
use super::macros::AttributeAssociation;
|
5
rpg_components/src/config/mod.rs
Normal file
5
rpg_components/src/config/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub mod abilities;
|
||||
pub mod attributes;
|
||||
pub mod experience;
|
||||
pub mod items;
|
||||
pub mod save_game;
|
|
@ -1,8 +1,3 @@
|
|||
use crate::{
|
||||
game::{configloader::*, content::prelude::*},
|
||||
GameHandle,
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use assetpath::AssetPath;
|
||||
use engine::prelude::*;
|
|
@ -1,7 +1,3 @@
|
|||
use crate::game::{configloader::*, content::prelude::*};
|
||||
|
||||
use crate::GameHandle;
|
||||
|
||||
use anyhow::Result;
|
||||
use cgmath::{Vector2, Vector3};
|
||||
use engine::prelude::*;
|
|
@ -3,9 +3,9 @@ use anyhow::Result;
|
|||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::*;
|
||||
use crate::components::statistic_types::StatisticType;
|
||||
|
||||
use self::game::configloader::ItemSettings;
|
||||
use super::Jewel;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum ItemAffix {
|
|
@ -1,5 +1,3 @@
|
|||
use crate::game::configloader::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use assetpath::AssetPath;
|
||||
use engine::prelude::*;
|
|
@ -2,14 +2,11 @@ use anyhow::Result;
|
|||
use assetpath::AssetPath;
|
||||
use engine::prelude::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use image::{imageops::FilterType, DynamicImage, ImageBuffer, Pixel, Rgba, RgbaImage};
|
||||
|
||||
use crate::game::{configloader::*, content::prelude::*};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Loot {
|
||||
Item(Item),
|
|
@ -3,10 +3,6 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use crate::*;
|
||||
|
||||
use self::game::configloader::ItemSettings;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Jewel {
|
||||
pub rarity: Rarities,
|
|
@ -1,6 +1,8 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::*;
|
||||
use engine::prelude::*;
|
||||
|
||||
use super::{ItemSystem, Rarities};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MapItem {
|
|
@ -1,3 +1,5 @@
|
|||
pub mod ability_addon;
|
||||
pub mod ability_book;
|
||||
mod item;
|
||||
mod item_slots;
|
||||
mod item_system;
|
|
@ -1,13 +1,14 @@
|
|||
use crate::game::configloader::*;
|
||||
use anyhow::Result;
|
||||
use engine::prelude::*;
|
||||
|
||||
use crate::game::content::prelude::*;
|
||||
|
||||
use image::RgbaImage;
|
||||
|
||||
use std::{fmt, slice::Iter};
|
||||
|
||||
use crate::config::items::{ItemSettings, RarityColorSettings};
|
||||
|
||||
use super::ItemSystem;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Rarities {
|
||||
Common,
|
|
@ -1,6 +1,5 @@
|
|||
use crate::*;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use engine::prelude::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct FittingResult {
|
5
rpg_components/src/lib.rs
Normal file
5
rpg_components/src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[macro_use]
|
||||
pub mod components;
|
||||
|
||||
pub mod config;
|
||||
pub mod items;
|
Loading…
Reference in a new issue