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", "scene_update_macros",
"transaction_derive", "transaction_derive",
"map", "map",
"rpg_components",
] ]
[workspace.dependencies] [workspace.dependencies]

View file

@ -22,6 +22,7 @@ promise = { path = "../promise" }
lua-wrapper = { path = "../lua-wrapper" } lua-wrapper = { path = "../lua-wrapper" }
controllable_thread = { path = "../controllable_thread" } controllable_thread = { path = "../controllable_thread" }
map = { path = "../map" } map = { path = "../map" }
rpg_components = { path = "../rpg_components" }
[features] [features]
wayland = [] wayland = []

View file

@ -2,33 +2,17 @@ pub mod animation_info;
pub mod hitbox; pub mod hitbox;
pub mod movement; pub mod movement;
#[macro_use]
mod macros;
mod ability_location_info; mod ability_location_info;
mod ability_slots;
mod abilityloader; mod abilityloader;
pub mod ai;
mod aoe; mod aoe;
mod attributes; pub mod aoe_arc;
mod character_status; pub mod damage_number;
mod crafting_materials;
mod entity_faction; mod entity_faction;
mod ghost; mod ghost;
mod item_slots; pub mod health_bar;
mod level;
mod loot_stash; mod loot_stash;
mod npc_name; 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; mod npc_type;
pub use self::{ai::*, aoe_arc::AreaOfEffectArc}; pub use self::{ai::*, aoe_arc::AreaOfEffectArc};

View file

@ -2,6 +2,7 @@ use anyhow::Result;
use assetpath::AssetPath; use assetpath::AssetPath;
use cgmath::{vec2, Vector2}; use cgmath::{vec2, Vector2};
use engine::prelude::*; use engine::prelude::*;
use rpg_components::components::{crafting_materials::CraftingMaterials, statistics::Statistics};
use super::super::prelude::*; 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 anyhow::Result;
use cgmath::{Vector2, Zero}; use cgmath::{Vector2, Zero};
use engine::prelude::*; use engine::prelude::*;
use std::slice::IterMut;
use crate::game::{configloader::*, content::prelude::*};
use crate::game::game::GameHandle;
use paste; use paste;
use std::str::FromStr;
use std::slice::Iter; use std::{
slice::{Iter, IterMut},
str::FromStr,
};
macro_rules! load { macro_rules! load {
($me: ident, $save_game:ident, $($index:literal,)+) => { ($me: ident, $save_game:ident, $($index:literal,)+) => {

View file

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

View file

@ -2,9 +2,6 @@ use engine::prelude::*;
use paste::paste; use paste::paste;
use crate::game::configloader::*;
use crate::game::content::prelude::*;
macro_rules! check_consume { macro_rules! check_consume {
($self: ident, $var: ident, $amount: ident) => { ($self: ident, $var: ident, $amount: ident) => {
paste! { paste! {

View file

@ -1,6 +1,3 @@
use crate::game::configloader::*;
use crate::game::content::prelude::*;
use anyhow::Result; use anyhow::Result;
use engine::prelude::*; use engine::prelude::*;
use std::slice::Iter; 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 anyhow::Result;
use engine::prelude::*; use engine::prelude::*;
use paste; use paste;
use std::{collections::HashMap, sync::Arc};
macro_rules! load_item { macro_rules! load_item {
($me:ident, $var_name:ident, $slot:ident, $save_game:ident, $item_system:ident) => { ($me:ident, $var_name:ident, $slot:ident, $save_game:ident, $item_system:ident) => {
if $save_game.$var_name.used { if $save_game.$var_name.used {

View file

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

View file

@ -101,7 +101,7 @@ macro_rules! generate_stat {
}; };
} }
use super::Attributes; use super::attributes::Attributes;
pub trait AttributeAssociation { pub trait AttributeAssociation {
fn attribute_level(&self, attributes: &Attributes) -> u32; 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 anyhow::Result;
use engine::prelude::*; use engine::prelude::*;

View file

@ -1,5 +1,3 @@
use crate::game::{configloader::*, content::prelude::*};
use engine::prelude::*; use engine::prelude::*;
use super::macros::AttributeAssociation; 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 anyhow::Result;
use assetpath::AssetPath; use assetpath::AssetPath;
use engine::prelude::*; use engine::prelude::*;

View file

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

View file

@ -3,9 +3,9 @@ use anyhow::Result;
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
use crate::*; use crate::components::statistic_types::StatisticType;
use self::game::configloader::ItemSettings; use super::Jewel;
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub enum ItemAffix { pub enum ItemAffix {

View file

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

View file

@ -2,14 +2,11 @@ use anyhow::Result;
use assetpath::AssetPath; use assetpath::AssetPath;
use engine::prelude::*; use engine::prelude::*;
use std::collections::HashMap;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::collections::HashMap;
use image::{imageops::FilterType, DynamicImage, ImageBuffer, Pixel, Rgba, RgbaImage}; use image::{imageops::FilterType, DynamicImage, ImageBuffer, Pixel, Rgba, RgbaImage};
use crate::game::{configloader::*, content::prelude::*};
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Loot { pub enum Loot {
Item(Item), Item(Item),

View file

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

View file

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

View file

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

View file

@ -1,13 +1,14 @@
use crate::game::configloader::*;
use anyhow::Result; use anyhow::Result;
use engine::prelude::*; use engine::prelude::*;
use crate::game::content::prelude::*;
use image::RgbaImage; use image::RgbaImage;
use std::{fmt, slice::Iter}; use std::{fmt, slice::Iter};
use crate::config::items::{ItemSettings, RarityColorSettings};
use super::ItemSystem;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Rarities { pub enum Rarities {
Common, Common,

View file

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

View file

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