From 446e93f904633a9e6d7292b27f818a46129ba681 Mon Sep 17 00:00:00 2001 From: Frankie Fisher Date: Wed, 20 Mar 2024 20:29:33 +0000 Subject: [PATCH 1/2] feat: some extra constants --- src/constants.rs | 1 + src/constants/extra.rs | 55 +++++++++++------------------------------- 2 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index fbd701f..af8697b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -59,6 +59,7 @@ // //! [`FromStr`]: std::str::FromStr // //! [`Display`]: std::fmt::Display +pub mod extra; pub mod numbers; pub mod prototypes; mod small_enums; diff --git a/src/constants/extra.rs b/src/constants/extra.rs index b338b83..6344c8e 100644 --- a/src/constants/extra.rs +++ b/src/constants/extra.rs @@ -6,58 +6,58 @@ pub const CONSTRUCTION_SITE_STOMP_RATIO: f32 = 0.5; /// Maximum length of signs on controllers. -pub const CONTROLLER_SIGN_MAX_LENGTH: u32 = 100; +//pub const CONTROLLER_SIGN_MAX_LENGTH: u32 = 100; /// Maximum amount of CPU that can be accumulated in your bucket per shard. -pub const CPU_BUCKET_MAX: u32 = 10_000; +//pub const CPU_BUCKET_MAX: u32 = 10_000; /// Maximum value of [`CpuInfo::tick_limit`] if more bucket is available than /// can be used this tick. /// /// [`CpuInfo::tick_limit`]: crate::game::cpu::CpuInfo::tick_limit -pub const CPU_TICK_LIMIT_MAX: u32 = 500; +//pub const CPU_TICK_LIMIT_MAX: u32 = 500; /// Hits per creep body part. pub const CREEP_HITS_PER_PART: u32 = 100; /// Maximum length of names of creeps. -pub const CREEP_NAME_MAX_LENGTH: u32 = 100; +//pub const CREEP_NAME_MAX_LENGTH: u32 = 100; /// Maximum length of names of flag objects. -pub const FLAG_NAME_MAX_LENGTH: u32 = 60; +//pub const FLAG_NAME_MAX_LENGTH: u32 = 60; /// Maximum size in bytes (100 KiB) of the string contents allowed for inter /// shard memory. -pub const INTER_SHARD_MEMORY_SIZE_LIMIT: u32 = 100 * 1024; +//pub const INTER_SHARD_MEMORY_SIZE_LIMIT: u32 = 100 * 1024; /// Owner username of hostile non-player structures and creeps which create /// strongholds and spawn in rooms due to energy harvesting. -pub const INVADER_USERNAME: &str = "Invader"; +//pub const INVADER_USERNAME: &str = "Invader"; /// Maximum range from a lab to the input or output labs it's interacting with. -pub const LAB_REACTION_RANGE: u32 = 2; +//pub const LAB_REACTION_RANGE: u32 = 2; /// The maximum size (1000 KiB) of the serialized [`MapVisual`] data. -pub const MAP_VISUAL_SIZE_LIMIT: u32 = 1000 * 1024; +//pub const MAP_VISUAL_SIZE_LIMIT: u32 = 1000 * 1024; /// The maximum number of times that you can deal on market orders in a single tick. -pub const MARKET_MAX_DEALS_PER_TICK: u32 = 10; +//pub const MARKET_MAX_DEALS_PER_TICK: u32 = 10; /// Maximum size in bytes (100 KiB) of the string contents allowed in memory /// segments. -pub const MEMORY_SEGMENT_SIZE_LIMIT: u32 = 100 * 1024; +//pub const MEMORY_SEGMENT_SIZE_LIMIT: u32 = 100 * 1024; /// Maximum size in bytes (2 MiB) of the string contents allowed in memory. -pub const MEMORY_SIZE_LIMIT: u32 = 2 * 1024 * 1024; +//pub const MEMORY_SIZE_LIMIT: u32 = 2 * 1024 * 1024; /// Fatigue points removed per effective move part per tick. pub const MOVE_POWER: u32 = 2; /// Maximum hits of a power creep per level. -pub const POWER_CREEP_HITS_PER_LEVEL: u32 = 1000; +//pub const POWER_CREEP_HITS_PER_LEVEL: u32 = 1000; /// Maximum length of names of power creeps. -pub const POWER_CREEP_NAME_MAX_LENGTH: u32 = 100; +//pub const POWER_CREEP_NAME_MAX_LENGTH: u32 = 100; /// Hits of damage per effective ranged attack part per /// [`Creep::ranged_mass_attack`] action at range 1. @@ -74,30 +74,3 @@ pub const RANGED_MASS_ATTACK_POWER_RANGE_2: u32 = 4; /// /// [`Creep::ranged_mass_attack`]: crate::objects::Creep::ranged_mass_attack pub const RANGED_MASS_ATTACK_POWER_RANGE_3: u32 = 1; - -/// The maximum size (500 KiB) of the serialized [`RoomVisual`] data for each -/// room. -/// -/// [`RoomVisual`]: crate::objects::RoomVisual -pub const ROOM_VISUAL_PER_ROOM_SIZE_LIMIT: u32 = 500 * 1024; - -/// Maximum length of strings that creeps and power creeps can say. -pub const SAY_MAX_LENGTH: u32 = 10; - -/// Owner username of hostile non-player structures and creeps which occupy sector center rooms. -pub const SOURCE_KEEPER_USERNAME: &str = "Source Keeper"; - -/// Maximum length of names of spawns. -pub const SPAWN_NAME_MAX_LENGTH: u32 = 100; - -/// Exponential scaling rate for terminal energy costs. -/// -/// Energy cost to send resources with a terminal is determined by the formula -/// ([source]): -/// -/// ```js -/// Math.ceil(resource_amount * (1 - Math.exp(-range / 30))) -/// ``` -/// -/// [source]: https://github.com/screeps/engine/blob/c682c00b058de21e927c3a6c42fadb34c9745767/src/utils.js#L658 -pub const TERMINAL_SEND_COST_SCALE: u32 = 30; From 3e5a3ccceaab9933df30c3563baeaa7b94326b86 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sun, 24 Mar 2024 10:38:15 -0600 Subject: [PATCH 2/2] fmt --- src/constants/extra.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants/extra.rs b/src/constants/extra.rs index 6344c8e..d50d19b 100644 --- a/src/constants/extra.rs +++ b/src/constants/extra.rs @@ -40,7 +40,8 @@ pub const CREEP_HITS_PER_PART: u32 = 100; /// The maximum size (1000 KiB) of the serialized [`MapVisual`] data. //pub const MAP_VISUAL_SIZE_LIMIT: u32 = 1000 * 1024; -/// The maximum number of times that you can deal on market orders in a single tick. +/// The maximum number of times that you can deal on market orders in a single +/// tick. //pub const MARKET_MAX_DEALS_PER_TICK: u32 = 10; /// Maximum size in bytes (100 KiB) of the string contents allowed in memory