Skip to content

Commit

Permalink
feat: some extra constants
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfrank committed Mar 20, 2024
1 parent 07a109e commit cf1dad4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
// //! [`FromStr`]: std::str::FromStr
// //! [`Display`]: std::fmt::Display

pub mod extra;
pub mod numbers;
pub mod prototypes;
mod small_enums;
Expand Down
38 changes: 19 additions & 19 deletions src/constants/extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -79,16 +79,16 @@ pub const RANGED_MASS_ATTACK_POWER_RANGE_3: u32 = 1;
/// room.
///
/// [`RoomVisual`]: crate::objects::RoomVisual
pub const ROOM_VISUAL_PER_ROOM_SIZE_LIMIT: u32 = 500 * 1024;
//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;
//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";
//pub const SOURCE_KEEPER_USERNAME: &str = "Source Keeper";

/// Maximum length of names of spawns.
pub const SPAWN_NAME_MAX_LENGTH: u32 = 100;
//pub const SPAWN_NAME_MAX_LENGTH: u32 = 100;

/// Exponential scaling rate for terminal energy costs.
///
Expand All @@ -100,4 +100,4 @@ pub const SPAWN_NAME_MAX_LENGTH: u32 = 100;
/// ```
///
/// [source]: https://github.com/screeps/engine/blob/c682c00b058de21e927c3a6c42fadb34c9745767/src/utils.js#L658
pub const TERMINAL_SEND_COST_SCALE: u32 = 30;
//pub const TERMINAL_SEND_COST_SCALE: u32 = 30;

0 comments on commit cf1dad4

Please sign in to comment.