Creep.carry inconsistency



  • Creep.carry has an inconsistent case, as shown by the following code:

    let creep = Game.creeps["Bob"] //Bob is a creep that currently has no resources carried. console.log(creep.carry[RESOURCE_ENERGY]) //0 console.log(creep.carry[RESOURCE_HYDROGEN]) //undefined

    Even though in this case the creep has 0 resources for both hydrogen and energy, the resources do not have the same value. This should either be specified in docs (i.e. "indexes of non-energy resources are not present unless they have resources in them"), or should be corrected so that both of these statements have the same result.



  • Good spot, wrote up a quick Pull Request to fix the docs, pending the Screeps devs accepting it, as the behavior is common across other components and mentioned in the docs, looks like it was an oversight.

    https://github.com/screeps/docs/pull/88 for anyone wanting to track this further.



  • I was going to make a pull request myself, but couldn't figure out how to. How do I make a pull request for the docs?



  • Well the docs are at https://github.com/screeps/docs, the back-end engine is at https://github.com/screeps/engine, and there's actually very little at the main https://github.com/screeps/screeps repo. Just issue a PR against the appropriate repo after making the edits.