Move sharable stuff into extra crate

This commit is contained in:
hodasemi 2024-08-23 17:17:53 +02:00
parent 09425fd0e7
commit 5346559e61
33 changed files with 61 additions and 82 deletions

View file

@ -19,6 +19,7 @@ members = [
"scene_update_macros",
"transaction_derive",
"map",
"rpg_components",
]
[workspace.dependencies]

View file

@ -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 = []

View file

@ -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};

View file

@ -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
View 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" }

View file

@ -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,)+) => {

View file

@ -1,5 +1,3 @@
use crate::{game::configloader::*, ItemSystem};
use anyhow::bail;
use engine::prelude::{image::RgbaImage, *};

View file

@ -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! {

View file

@ -1,6 +1,3 @@
use crate::game::configloader::*;
use crate::game::content::prelude::*;
use anyhow::Result;
use engine::prelude::*;
use std::slice::Iter;

View file

@ -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 {

View file

@ -1,5 +1,3 @@
use crate::{game::configloader::experience::ExperienceSettings, *};
use anyhow::Result;
use engine::prelude::*;

View file

@ -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;

View 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;

View file

@ -1,6 +1,3 @@
use crate::game::configloader::*;
use crate::game::content::prelude::*;
use anyhow::Result;
use engine::prelude::*;

View file

@ -1,5 +1,3 @@
use crate::game::{configloader::*, content::prelude::*};
use engine::prelude::*;
use super::macros::AttributeAssociation;

View file

@ -0,0 +1,5 @@
pub mod abilities;
pub mod attributes;
pub mod experience;
pub mod items;
pub mod save_game;

View file

@ -1,8 +1,3 @@
use crate::{
game::{configloader::*, content::prelude::*},
GameHandle,
};
use anyhow::Result;
use assetpath::AssetPath;
use engine::prelude::*;

View file

@ -1,7 +1,3 @@
use crate::game::{configloader::*, content::prelude::*};
use crate::GameHandle;
use anyhow::Result;
use cgmath::{Vector2, Vector3};
use engine::prelude::*;

View file

@ -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 {

View file

@ -1,5 +1,3 @@
use crate::game::configloader::*;
use anyhow::Result;
use assetpath::AssetPath;
use engine::prelude::*;

View file

@ -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),

View file

@ -3,10 +3,6 @@ use std::{
sync::Arc,
};
use crate::*;
use self::game::configloader::ItemSettings;
#[derive(Clone, Debug)]
pub struct Jewel {
pub rarity: Rarities,

View file

@ -1,6 +1,8 @@
use std::sync::Arc;
use crate::*;
use engine::prelude::*;
use super::{ItemSystem, Rarities};
#[derive(Clone)]
pub struct MapItem {

View file

@ -1,3 +1,5 @@
pub mod ability_addon;
pub mod ability_book;
mod item;
mod item_slots;
mod item_system;

View file

@ -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,

View file

@ -1,6 +1,5 @@
use crate::*;
use anyhow::{bail, Result};
use engine::prelude::*;
use std::sync::Arc;
pub struct FittingResult {

View file

@ -0,0 +1,5 @@
#[macro_use]
pub mod components;
pub mod config;
pub mod items;