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",
|
"scene_update_macros",
|
||||||
"transaction_derive",
|
"transaction_derive",
|
||||||
"map",
|
"map",
|
||||||
|
"rpg_components",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|
|
@ -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 = []
|
||||||
|
|
|
@ -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};
|
||||||
|
|
|
@ -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
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 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,)+) => {
|
|
@ -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, *};
|
||||||
|
|
|
@ -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! {
|
|
@ -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;
|
|
@ -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 {
|
|
@ -1,5 +1,3 @@
|
||||||
use crate::{game::configloader::experience::ExperienceSettings, *};
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use engine::prelude::*;
|
use engine::prelude::*;
|
||||||
|
|
|
@ -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;
|
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 anyhow::Result;
|
||||||
use engine::prelude::*;
|
use engine::prelude::*;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use crate::game::{configloader::*, content::prelude::*};
|
|
||||||
|
|
||||||
use engine::prelude::*;
|
use engine::prelude::*;
|
||||||
|
|
||||||
use super::macros::AttributeAssociation;
|
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 anyhow::Result;
|
||||||
use assetpath::AssetPath;
|
use assetpath::AssetPath;
|
||||||
use engine::prelude::*;
|
use engine::prelude::*;
|
|
@ -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::*;
|
|
@ -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 {
|
|
@ -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::*;
|
|
@ -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),
|
|
@ -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,
|
|
@ -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 {
|
|
@ -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;
|
|
@ -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,
|
|
@ -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 {
|
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