Skip to content

About

No description, website, or topics provided.

Resources

Stars

51 stars

Watchers

3 watching

Forks

Repository files navigation

RoomVisual

Prototype extension methods for RoomVisual object in screeps. Including structures, road connections, speech, resource icons, and even animated position markers.

Installation

Screeps (copy the file). Download RoomVisual.js from the latest release into your code folder. Older versions are on the releases page. To build it yourself, run pnpm install && pnpm build and use dist/screeps/RoomVisual.js.

require('./RoomVisual')

npm. @screepers/room-visual ships ESM, CJS and types (needs @types/screeps for TypeScript).

// Patch RoomVisual.prototype (the methods below become available on room.visual)
import '@screepers/room-visual/register'

// ...or import only what you use (tree-shakable, no side effects)
import { structure, resource } from '@screepers/room-visual'
structure(room.visual, 8, 13, STRUCTURE_TOWER)

Usage

Structure

Draws structureType at x, y.

// .structure(x, y, structureType)
room.visual.structure(8, 13, STRUCTURE_TOWER)

Connect Roads

Connects roads drawn with the above .structure() the same way the game would.

// .connectRoads()
room.visual.connectRoads()

Speech

Simulates creep.say() through room visuals.

// .speech(text, x, y)
room.visual.speech('Hello World', 22, 24)

Animated Position

Animates a marker at x, y.

// .animatedPosition(x, y)
room.visual.animatedPosition(12, 32)

Resource badges

resource-badges

Draws resource icon of type at x, y, and given size. size is the badge radius in grid units, so 0.5 fills one tile. It defaults to 0.25, except for symbol resources, which default to 0.5 (one full tile).

// .resource(type, x, y)
room.visual.resource("XGHO2", 12, 32)
// .resource(type, x, y, size)
room.visual.resource("K", 12, 32, 0.5)

About

No description, website, or topics provided.

Resources

Stars

51 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages