From 07a109e0dde2680404db9c628783e0d870b240d3 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sun, 17 Mar 2024 19:12:27 -0600 Subject: [PATCH] Build fixes (#6) --- .github/workflows/test.yml | 3 ++- src/constants.rs | 5 +++-- src/constants/numbers.rs | 24 +++++++++++++++--------- src/constants/small_enums.rs | 6 +----- src/objects/impls.rs | 13 ++++++++++++- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6991f78..dd79208 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,7 +88,8 @@ jobs: matrix: rust: - stable - - nightly + # temporarily disabled due to https://github.com/rust-lang/rust-clippy/issues/12377 + #- nightly steps: - name: Checkout sources uses: actions/checkout@v2 diff --git a/src/constants.rs b/src/constants.rs index df5dfee..fbd701f 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -69,8 +69,9 @@ mod types; //pub mod look; // TODO: most/all of this is World specific //pub mod find; // TODO: most/all of this is World specific -pub use self::{small_enums::*, types::*, numbers::*}; -//pub use self::{extra::*, look::*, recipes::FactoryRecipe}; // TODO: most/all of this is World specific +pub use self::{numbers::*, small_enums::*, types::*}; +//pub use self::{extra::*, look::*, recipes::FactoryRecipe}; // TODO: most/all +// of this is World specific // pub use self::find::{FindConstant, Find, CREEPS, MY_CREEPS, HOSTILE_CREEPS, // SOURCES_ACTIVE, SOURCES, DROPPED_RESOURCES, STRUCTURES, MY_STRUCTURES, diff --git a/src/constants/numbers.rs b/src/constants/numbers.rs index e40ebb0..ee5d2fc 100644 --- a/src/constants/numbers.rs +++ b/src/constants/numbers.rs @@ -1,15 +1,14 @@ - pub const BODYPART_HITS: u32 = 100; -pub const RANGED_ATTACK_POWER: u32 = 10; +pub const RANGED_ATTACK_POWER: u32 = 10; -pub const RANGED_ATTACK_DISTANCE_RATE: &[f32;4] = &[1.0_f32, 1.0_f32, 0.4_f32, 0.1_f32]; +pub const RANGED_ATTACK_DISTANCE_RATE: &[f32; 4] = &[1.0_f32, 1.0_f32, 0.4_f32, 0.1_f32]; -pub const ATTACK_POWER: u32 = 30; +pub const ATTACK_POWER: u32 = 30; -pub const HEAL_POWER: u32 = 12; +pub const HEAL_POWER: u32 = 12; -pub const RANGED_HEAL_POWER: u32 = 4; +pub const RANGED_HEAL_POWER: u32 = 4; pub const CARRY_CAPACITY: u32 = 50; @@ -25,7 +24,14 @@ pub const HARVEST_POWER: u32 = 2; pub const BUILD_POWER: u32 = 5; -pub const OBSTACLE_OBJECT_TYPES: &[&str;6] = &["creep","tower","constructedWall","spawn","extension","link"]; +pub const OBSTACLE_OBJECT_TYPES: &[&str; 6] = &[ + "creep", + "tower", + "constructedWall", + "spawn", + "extension", + "link", +]; pub const TOWER_ENERGY_COST: u32 = 10; @@ -53,9 +59,9 @@ pub const MAX_CREEP_SIZE: u32 = 50; pub const CREEP_SPAWN_TIME: u32 = 3; -pub const RESOURCE_ENERGY: &str = "energy"; +pub const RESOURCE_ENERGY: &str = "energy"; -pub const RESOURCES_ALL: &[&str;1] = &[RESOURCE_ENERGY]; +pub const RESOURCES_ALL: &[&str; 1] = &[RESOURCE_ENERGY]; pub const SOURCE_ENERGY_REGEN: u32 = 10; diff --git a/src/constants/small_enums.rs b/src/constants/small_enums.rs index 3e2ad4b..6b5eb11 100644 --- a/src/constants/small_enums.rs +++ b/src/constants/small_enums.rs @@ -5,11 +5,7 @@ use num_derive::FromPrimitive; use num_traits::FromPrimitive; use serde::{Deserialize, Serialize}; use serde_repr::{Deserialize_repr, Serialize_repr}; -use std::{ - convert::{Infallible, TryFrom}, - fmt, - str::FromStr, -}; +use std::{convert::Infallible, fmt, str::FromStr}; use wasm_bindgen::prelude::*; //use crate::constants::find::Find; diff --git a/src/objects/impls.rs b/src/objects/impls.rs index c4f919c..4146920 100644 --- a/src/objects/impls.rs +++ b/src/objects/impls.rs @@ -16,7 +16,6 @@ mod structure_tower; mod structure_wall; pub use self::{ - arena::*, construction_site::{ConstructionSite, CONSTRUCTION_SITE_PROTOTYPE}, creep::{Creep, CREEP_PROTOTYPE}, game_object::{GameObject, GAME_OBJECT_PROTOTYPE}, @@ -33,3 +32,15 @@ pub use self::{ structure_tower::{StructureTower, STRUCTURE_TOWER_PROTOTYPE}, structure_wall::{StructureWall, STRUCTURE_WALL_PROTOTYPE}, }; + +#[cfg(feature = "enable-body-part")] +pub use self::arena::{BodyPart, BODY_PART_PROTOTYPE}; + +#[cfg(feature = "enable-flag")] +pub use self::arena::{Flag, FLAG_PROTOTYPE}; + +#[cfg(feature = "enable-area-effect")] +pub use self::arena::{AreaEffect, AREA_EFFECT_PROTOTYPE}; + +#[cfg(feature = "enable-score")] +pub use self::arena::{ScoreCollector, SCORE_COLLECTOR_PROTOTYPE};