npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

screepsmod-admin-utils

v1.31.2

Published

## This is a Collection of utilities for Screeps Private Server admins

Downloads

410

Readme

screepsmod-admin-utils

This is a Collection of utilities for Screeps Private Server admins

JavaScript Style Guide License Version Downloads CircleCI

npm

Commands

utils.importMap(urlOrId)

NOTE: screepsmod-mongo required for map imports

Imports a map from a url or maps.screepspl.us

If the id is random or random_WxH a map will be randomly selected. 1x1 is assumed if size isn't specified.

The server will be paused on tick one, use system.resumeSimulation() to unpause

utils.addNPCTerminals(interval = 10)

Creates NPC Terminals.

The interval defines how often they are added, with the default value of 10 matching the behavior of the public server.

A simple way to understand the interval is that it will place rooms where x % interval === 0 && y % interval === 0.

utils.removeNPCTerminals()

Removes all NPC Terminals.

utils.removeBots()

Removes all Bots.

utils.setTickRate(value) DEPRECATED

Deprecated in favor of system.setTickDuration(value)
~~Sets the tick rate to value (in milliseconds)~~

utils.getTickRate() DEPRECATED

Deprecated in favor of system.getTickDuration()
~~Gets the current tick rate~~

utils.setSocketUpdateRate(value)

Sets socket update rate (in ms)

utils.getSocketUpdateRate()

Returns current socket update rate

utils.setShardName(value)

Sets the shard name

utils.getCPULimit(username)

Returns current cpu limit for username.

utils.setCPULimit(username, value)

Sets cpu limit to value for username. Will be overriden if GCLToCPU scaling is enabled.

utils.enableGCLToCPU([maxCPU], [baseCPU], [stepCPU])

Enables GCLToCPU scaling which raises all user's CPU limit based on their GCL. The formula is "Math.min( (gclLevel * stepCPU + baseCPU), maxCPU )". Parameters are optional and default to maxCPU = 300, baseCPU = 20, stepCPU = 10. Enabling through the CLI will not persist after a server restart. Update the values in your config.yml to persist the settings.

utils.disableGCLToCPU()

Disables GCLToCPU scaling. Disabling through the CLI will not persist after a server restart. Update the values in your config.yml to persist the setting.

utils.reloadConfig()

Reloads the serverConfig section of a screeps-launcher config.yml

Config file

config.yml example: (This can be the same file as screeps-launcher's config.yml)

# Most of these fields will live reload on save. 
# Values set here will override any saved via CLI on server startup
serverConfig: 
  map: random_1x2 # utils.importMap will be called automatically with this value, see utils.importMap above
  tickRate: 200
  socketUpdateRate: 200
  whitelist: # Does not restrict login, only restricts spawning
  - ags131
  - zeswarm
  shardName: 'screepsplus1'
  constants:
    UPGRADE_POWER: 10
    POWER_CREEP_SPAWN_COOLDOWN: 3600000 # 1 Hour
    POWER_CREEP_DELETE_COOLDOWN: 3600000
  welcomeText: |
    <h1>Welcome</h1>
    <div>Powered by screepsmod-admin-utils</div>
  statsToken: ...splusToken... # This enables submitting stats to S+ Grafana. Note: shardName MUST be set
  gclToCPU: true
  maxCPU: 100
  baseCPU: 20
  stepCPU: 10

Endpoints

A few extra endpoints are implemented enabling some extra debuging and tools

GET /stats Lots of useful stats on server performance GET /api/user/world-start-room Dynamically returns a start room for the client GET /api/experimental/pvp Same as on mmo, returns active pvp rooms. GET /api/experimental/nukes Same as on mmo, returns nukes.