Crates.io | room_visual_ext |
lib.rs | room_visual_ext |
version | |
source | src |
created_at | 2023-03-23 16:56:25.921319 |
updated_at | 2024-10-31 12:02:09.134528 |
description | Additional visualization utilities for Screeps: World |
homepage | https://github.com/rustyscreeps/room_visual_ext |
repository | https://github.com/rustyscreeps/room_visual_ext.git |
max_upload_size | |
id | 818530 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is an implementation of additional visualization utilities for Screeps: World written in Rust for Rust bots.
Add a dependency to your Cargo.toml
:
[dependencies]
room_visual_ext = "0.1.0"
You may also copy the src/lib.rs
file into your project directly (probably renamed) and either use
it as-is or with your modifications.
RoomVisualExt
object much like a RoomVisual
object:use room_visual_ext::RoomVisualExt;
// room_name: RoomName
let room_visual_ext = RoomVisualExt::new(room_name);
structure
method to draw structures of given type at given coordinates and with given opacity.
Use opacity 1.0 for opaque visualization and a smaller, positive value for partially transparent.
Small visual artifacts will appear in partially transparent visualizations.room_visual_ext.structure(42.0, 42.0, StructureType::Spawn, 1.0);
room_visual_ext.structure_roomxy(
unsafe { RoomXY::unchecked_new(42u8, 42u8) },
StructureType::Rampart,
1.0
);
RoomVisual
method directly from the RoomVisualExt
object.RoomVisual
.Below is an example showcasing visualization of all supported structures at opacities 1.0 and 0.5. For comparison, it is presented how they look in the actual game.
You may find the code used to produce these visualizations in the examples/showcase.rs
file.
Originally, a JS version of these visualizations was published on Screeps Slack and maintained by different people (without any particular license). Nowadays, it may be found in the screepers repo. Most of the values for colors and shapes of structures come from screepers' RoomVisual.
This Rust version has some notable changes: