On May 12 an update will be deployed that will introduce some changes to the API which can require adjustments in your script. The changes affect two fields:
-
The underlying data structure in which flags data is stored on the server was revised for optimization purposes, and now the
Flag
prototype does not have theid
property. If you have worked only with propertiesname
,color
/secondaryColor
, andmemory
, you have nothing to worry about. Otherwise please change your logic in order not to use theid
property. Besides, the constantsCOLOR_*
now represent integer values rather than strings, so if you used their values directly, please make sure to use names of variables from now on. -
We are considerably expanding the list of prototypes of game objects. Now all the prototypes will be arranged into a hierarchy and inherited in a chain. Here is the tree of prototypes:
Room |
|||
RoomPosition |
|||
RoomObject (room, pos) |
|||
├ | ConstructionSite |
||
├ | Creep |
||
├ | Flag |
||
├ | Mineral |
||
├ | Resource |
||
├ | Source |
||
└ | Structure (structureType, hits, hitsMax, destroy, notifyWhenAttacked, isActive) |
||
├ | OwnedStructure (my, owner) |
||
│ | ├ | StructureController |
|
│ | ├ | StructureExtension |
|
│ | ├ | StructureExtractor |
|
│ | ├ | StructureKeeperLair |
|
│ | ├ | StructureLab |
|
│ | ├ | StructureLink |
|
│ | ├ | StructureNuker |
|
│ | ├ | StructureObserver |
|
│ | ├ | StructurePowerBank |
|
│ | ├ | StructurePowerSpawn |
|
│ | ├ | StructureRampart |
|
│ | ├ | StructureSpawn (aliased as Spawn for backward compatibility) |
|
│ | ├ | StructureStorage |
|
│ | ├ | StructureTerminal |
|
│ | └ | StructureTower |
|
├ | StructureContainer |
||
├ | StructureRoad |
||
└ | StructureWall |
You are free to use these prototypes in your scripts:
Game.rooms.W0N0.storage instanceof StructureStorage // true
Game.rooms.W0N0.storage instanceof OwnedStructure // true
Game.rooms.W0N0.storage instanceof Structure // true
Game.rooms.W0N0.storage instanceof RoomObject // true
So, because of this, if you have overrided some properties or methods, you have to check that you are doing this in the right place of the tree.
These changes have already been deployed on the Public Test Realm, so we recommend to go there and check if your script works correctly before the update goes live on the main server.