PTR Changelog 2019-06-24: Store and market


  • Dev Team

    PTR is updated with the latest fixes. Thanks for your reports!



  • I think we may want to create an official reverse shim before moving the .store to MMO.

    I had focused on whether the new .store would be backward compatible with the old plain Object. As far as I can tell that is the case. However, I discovered another failure that I fear might be quite common. In my case I was using something like if(!!struct.store) to change creep behavior when distributing energy among my structures. The new .store property didn't break my code (no errors) but my creeps stopped filling extensions.

    I worry that other players will get frustrated if they run into a similar issue. If we had an official snippet that might help a frustrated player quickly avoid the change to see if their problem goes away (prove to themselves that it's not the new .store at fault).

    I'm imagining something like mirroring .store to .cargo and removing .store from the structures that didn't have it previously. If .cargo is the wrong color of bikeshed it's an easy find replace in the snippet to pick a new one.

    Also the new name makes a clear verification path. Change all of your code to use .cargo instead of .store fixing it along the way. Once you no longer refer to .store anywhere remove the shim and Replace s/\.cargo/.store/g.

    if(globals.Store) {
      for (klass of [StructureExtension, StructureStorage ...]) {
        Object.setProperty(
          klass.prototype,
          'cargo',
          Object.getOwnPropertyDescriptor(klass.prototype, 'store');
      }
      for (klass of [StructureExtension, ...]) {
        delete klass.prototype.store;
        Object.setProperty(
          klass.prototype,
          'energy',
          { get() { return this.cargo? this.cargo.energy: 0; } }
        )
      }
    }
    
    // also clean up non-energy properties in StructurePowerSpawn, StructureLab, and StructureNuker
    

  • Dev Team

    This update has been deployed to ptr private server branch (version 4.0.0-beta.1) on both npm and Steam:

    npm install screeps@ptr
    

    Please note that this change includes backwards-incompatible data migration! It will upgrade your db.json file permanently on the first launch. New Steam client (currently in public-test-realm beta branch) will only connect to servers with version 4.0.0-beta.1 and later. After this change goes to production, Steam clients will no longer be able to connect to 3.x.x server version.


  • Dev Team

    The release date of this feature: October 15. It will go live to production along with all other planned features.