mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Repaired common such that it works for plugin targets
This commit is contained in:
parent
358f9f268d
commit
1b1287f407
@ -21,13 +21,20 @@ common-base = { package = "veloren-common-base", path = "base" }
|
||||
# Serde
|
||||
serde = { version = "1.0.110", features = ["derive", "rc"] }
|
||||
|
||||
# Util
|
||||
enum-iterator = "0.6"
|
||||
vek = { version = "=0.14.1", features = ["serde"] }
|
||||
|
||||
# Strum
|
||||
strum = "0.20"
|
||||
strum_macros = "0.20"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
approx = "0.4.0"
|
||||
clap = "2.33"
|
||||
crossbeam-utils = "0.8.1"
|
||||
bitflags = "1.2"
|
||||
crossbeam-channel = "0.5"
|
||||
enum-iterator = "0.6"
|
||||
lazy_static = "1.4.0"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
@ -36,7 +43,6 @@ rayon = "1.5"
|
||||
roots = "0.0.6"
|
||||
spin_sleep = "1.0"
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
vek = { version = "=0.14.1", features = ["serde"] }
|
||||
uuid = { version = "0.8.1", default-features = false, features = ["serde", "v4"] }
|
||||
rand = "0.8"
|
||||
|
||||
@ -61,10 +67,6 @@ slotmap = { version = "1.0", features = ["serde"] }
|
||||
indexmap = "1.3.0"
|
||||
slab = "0.4.2"
|
||||
|
||||
# Strum
|
||||
strum = "0.20"
|
||||
strum_macros = "0.20"
|
||||
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control", "nightly"], rev = "f985bec5d456f7b0dd8aae99848f9473c2cd9d46" }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "8be2abcddf8f524cb5876e8dd20a7e47cfaf7573" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::comp::buff::{Buff, BuffChange, BuffData, BuffKind, BuffSource};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::{
|
||||
comp::{
|
||||
buff::{Buff, BuffChange, BuffData, BuffKind, BuffSource},
|
||||
inventory::{
|
||||
item::{
|
||||
armor::Protection,
|
||||
@ -814,6 +814,7 @@ pub fn get_weapons(inv: &Inventory) -> (Option<ToolKind>, Option<ToolKind>) {
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn weapon_rating<T: ItemDesc>(item: &T, msm: &MaterialStatManifest) -> f32 {
|
||||
const DAMAGE_WEIGHT: f32 = 2.0;
|
||||
const POISE_WEIGHT: f32 = 1.0;
|
||||
@ -834,6 +835,7 @@ pub fn weapon_rating<T: ItemDesc>(item: &T, msm: &MaterialStatManifest) -> f32 {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn weapon_skills(inventory: &Inventory, skill_set: &SkillSet) -> f32 {
|
||||
let (mainhand, offhand) = get_weapons(inventory);
|
||||
let mainhand_skills = if let Some(tool) = mainhand {
|
||||
@ -849,6 +851,7 @@ fn weapon_skills(inventory: &Inventory, skill_set: &SkillSet) -> f32 {
|
||||
mainhand_skills.max(offhand_skills)
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn get_weapon_rating(inventory: &Inventory, msm: &MaterialStatManifest) -> f32 {
|
||||
let mainhand_rating =
|
||||
if let Some((item, _)) = equipped_item_and_tool(inventory, EquipSlot::ActiveMainhand) {
|
||||
@ -901,6 +904,7 @@ pub fn combat_rating(
|
||||
combined_rating * body.combat_multiplier()
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn compute_crit_mult(inventory: Option<&Inventory>) -> f32 {
|
||||
// Starts with a value of 1.25 when summing the stats from each armor piece, and
|
||||
// defaults to a value of 1.25 if no inventory is equipped
|
||||
@ -918,6 +922,7 @@ pub fn compute_crit_mult(inventory: Option<&Inventory>) -> f32 {
|
||||
}
|
||||
|
||||
/// Computes the energy reward modifer from worn armor
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn compute_energy_reward_mod(inventory: Option<&Inventory>) -> f32 {
|
||||
// Starts with a value of 1.0 when summing the stats from each armor piece, and
|
||||
// defaults to a value of 1.0 if no inventory is present
|
||||
@ -936,6 +941,7 @@ pub fn compute_energy_reward_mod(inventory: Option<&Inventory>) -> f32 {
|
||||
|
||||
/// Computes the modifier that should be applied to max energy from the
|
||||
/// currently equipped items
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn compute_max_energy_mod(energy: &Energy, inventory: Option<&Inventory>) -> f32 {
|
||||
// Defaults to a value of 0 if no inventory is present
|
||||
let energy_increase = inventory.map_or(0, |inv| {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::uid::Uid;
|
||||
use core::{cmp::Ordering, time::Duration};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -7,8 +7,6 @@ use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs_idvs::IdvStorage;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use std::{cmp::Ordering, time::Duration};
|
||||
use strum_macros::EnumIter;
|
||||
|
||||
/// De/buff Kind.
|
||||
@ -101,7 +99,6 @@ impl BuffKind {
|
||||
}
|
||||
|
||||
// Struct used to store data relevant to a buff
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BuffData {
|
||||
pub strength: f32,
|
||||
@ -116,7 +113,6 @@ impl BuffData {
|
||||
/// De/buff category ID.
|
||||
/// Similar to `BuffKind`, but to mark a category (for more generic usage, like
|
||||
/// positive/negative buffs).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub enum BuffCategory {
|
||||
Natural,
|
||||
@ -127,7 +123,6 @@ pub enum BuffCategory {
|
||||
FromAura(bool), // bool used to check if buff recently set by aura
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ModifierKind {
|
||||
Additive,
|
||||
@ -135,7 +130,6 @@ pub enum ModifierKind {
|
||||
}
|
||||
|
||||
/// Data indicating and configuring behaviour of a de/buff.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum BuffEffect {
|
||||
/// Periodically damages or heals entity
|
||||
@ -175,7 +169,6 @@ pub enum BuffEffect {
|
||||
///
|
||||
/// To provide more classification info when needed,
|
||||
/// buff can be in one or more buff category.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Buff {
|
||||
pub kind: BuffKind,
|
||||
@ -188,7 +181,6 @@ pub struct Buff {
|
||||
|
||||
/// Information about whether buff addition or removal was requested.
|
||||
/// This to implement "on_add" and "on_remove" hooks for constant buffs.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum BuffChange {
|
||||
/// Adds this buff.
|
||||
@ -371,7 +363,6 @@ impl PartialEq for Buff {
|
||||
}
|
||||
|
||||
/// Source of the de/buff
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub enum BuffSource {
|
||||
/// Applied by a character
|
||||
@ -485,7 +476,6 @@ impl Buffs {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub type BuffId = u64;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
@ -1,7 +1,6 @@
|
||||
use super::{
|
||||
body::{object, Body},
|
||||
Density, Ori, Vel,
|
||||
};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use super::body::{object, Body};
|
||||
use super::{Density, Ori, Vel};
|
||||
use crate::{
|
||||
consts::{AIR_DENSITY, WATER_DENSITY},
|
||||
util::{Dir, Plane, Projection},
|
||||
@ -93,6 +92,7 @@ pub struct Wings {
|
||||
pub ori: Ori,
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl Body {
|
||||
pub fn aerodynamic_forces(
|
||||
&self,
|
||||
|
@ -12,8 +12,10 @@ mod character_state;
|
||||
pub mod compass;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod controller;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod dialogue;
|
||||
#[cfg(not(target_arch = "wasm32"))] mod energy;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod fluid_dynamics;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod group;
|
||||
mod health;
|
||||
|
@ -17,6 +17,7 @@
|
||||
)]
|
||||
|
||||
/// Re-exported crates
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub use uuid;
|
||||
|
||||
// modules
|
||||
@ -31,7 +32,6 @@ pub mod character;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod cmd;
|
||||
pub mod combat;
|
||||
pub mod comp;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod consts;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod depot;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@ -46,9 +46,7 @@ pub mod generation;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod grid;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod lottery;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod npc;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod npc;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod outcome;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod path;
|
||||
@ -61,6 +59,7 @@ pub mod resources;
|
||||
#[cfg(not(target_arch = "wasm32"))] pub mod rtsim;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod skillset_builder;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod slowjob;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod spiral;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::comp::Pos;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs::Entity;
|
||||
|
||||
/// A resource that stores the time of day.
|
||||
@ -14,6 +16,7 @@ pub struct Time(pub f64);
|
||||
#[derive(Default)]
|
||||
pub struct DeltaTime(pub f32);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Default)]
|
||||
pub struct EntitiesDiedLastTick(pub Vec<(Entity, Pos)>);
|
||||
|
||||
@ -34,6 +37,7 @@ pub enum GameMode {
|
||||
|
||||
/// A resource that stores the player's entity (on the client), and None on the
|
||||
/// server
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Copy, Clone, Default, Debug)]
|
||||
pub struct PlayerEntity(pub Option<Entity>);
|
||||
|
||||
@ -65,6 +69,7 @@ impl PlayerPhysicsSetting {
|
||||
/// List of which players are using client-authoratative vs server-authoratative
|
||||
/// physics, as a stop-gap until we can use server-authoratative physics for
|
||||
/// everyone
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct PlayerPhysicsSettings {
|
||||
pub settings: hashbrown::HashMap<uuid::Uuid, PlayerPhysicsSetting>,
|
||||
|
Loading…
Reference in New Issue
Block a user