Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not exhaustive API of strokes in RoomVisual #379

Open
xilexio opened this issue Mar 18, 2023 · 1 comment
Open

Not exhaustive API of strokes in RoomVisual #379

xilexio opened this issue Mar 18, 2023 · 1 comment
Labels
C-unimplemented Feature that exists in Screeps, but that is yet unavailable in our API.

Comments

@xilexio
Copy link
Contributor

xilexio commented Mar 18, 2023

In JS, it is possible to supply to, e.g., RoomVisual.circle options with

{
    stroke: undefined
}

It means that there should be no stroke and is different from empty options {} which mean that the stroke should be default (rather thick and light).

Currently in the API it is impossible to supply an undefined stroke. The stroke can either be None meaning default or Some(x) meaning width x, there is no undefined option that means no stroke. A working workaround is supplying transparent stroke color or extremely small (but positive or else it will not work) stroke width. However, this approach requires the stroke data to be sent to the client which needlessly uses up more of the already small (when visualizing something in the whole room) 500kB limit.

@shanemadden shanemadden added the C-unimplemented Feature that exists in Screeps, but that is yet unavailable in our API. label Sep 15, 2023
@MrFaul
Copy link

MrFaul commented Oct 10, 2024

@shanemadden This can be closed, since it is old and no longer true.

It can be accomplished like so:

let rv = RoomVisual::new(None);
    rv.circle(
        10.0,
        10.0,
        Some(CircleStyle::default().fill("blue").radius(5.0)),
    );

undefined isn't valid JSON anyway and gets removed when serialized.
And it will be serialized because it gets send to the client for remote execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-unimplemented Feature that exists in Screeps, but that is yet unavailable in our API.
Projects
None yet
Development

No branches or pull requests

3 participants