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

Feat!: Remove prototype access to instance interfaces #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ declare const POWER_INFO: {
* You can remove enemy construction sites by moving a creep on it.
*/
interface ConstructionSite<T extends BuildableStructureConstant = BuildableStructureConstant> extends RoomObject {
readonly prototype: ConstructionSite;
/**
* A unique object identifier.
*
Expand Down Expand Up @@ -1100,8 +1099,6 @@ declare const ConstructionSite: ConstructionSiteConstructor;
* | TOUGH | 10 | No effect, just additional hit points to the creep's body. Can be boosted to resist damage.
*/
interface Creep extends RoomObject {
readonly prototype: Creep;

/**
* An array describing the creep's body.
*/
Expand Down Expand Up @@ -1679,8 +1676,6 @@ declare const Deposit: DepositConstructor;
* Flags can be used to mark particular spots in a room. Flags are visible to their owners only. You cannot have more than 10,000 flags.
*/
interface Flag extends RoomObject {
readonly prototype: Flag;

/**
* Flag color. One of the {@link ColorConstant COLOR_*} constants.
*/
Expand Down Expand Up @@ -3671,10 +3666,6 @@ declare const Memory: Memory;
* | | DENSITY_ULTRA: 100% chance*
*/
interface Mineral<T extends MineralConstant = MineralConstant> extends RoomObject {
/**
* The prototype is stored in the Mineral.prototype global object. You can use it to extend game objects behaviour globally.
*/
readonly prototype: Mineral;
/**
* The density of this mineral deposit, one of the {@link DensityConstant DENSITY_*} constants.
*/
Expand Down Expand Up @@ -3723,8 +3714,6 @@ declare const Mineral: MineralConstructor;
* The room controller is hit by triggering {@link StructureController.upgradeBlocked} period, which means it is unavailable to activate safe mode again within the next 200 ticks.
*/
interface Nuke extends RoomObject {
readonly prototype: Nuke;

/**
* A unique object identifier.
*
Expand Down Expand Up @@ -4412,8 +4401,6 @@ declare const RawMemory: RawMemory;
*/

interface Resource<T extends ResourceConstant = ResourceConstant> extends RoomObject {
readonly prototype: Resource;

/**
* The amount of resource units containing.
*/
Expand All @@ -4440,7 +4427,6 @@ declare const Resource: ResourceConstructor;
*/

interface RoomObject {
readonly prototype: RoomObject;
/**
* Effects currently being applied to the object.
*/
Expand Down Expand Up @@ -4521,8 +4507,6 @@ interface PowerEffect {
* The position object of a custom location can be obtained using the {@link Room.getPositionAt()} method or using the constructor.
*/
interface RoomPosition {
readonly prototype: RoomPosition;

/**
* The name of the room.
*/
Expand Down Expand Up @@ -5034,8 +5018,6 @@ interface TextStyle {
* Every object in the room contains its linked Room instance in the {@link RoomObject.room} property.
*/
interface Room {
readonly prototype: Room;

/**
* The Controller structure of this room, if present, otherwise undefined.
*/
Expand Down Expand Up @@ -5360,10 +5342,6 @@ declare const Ruin: RuinConstructor;
* | Energy regeneration | Every 300 game ticks
*/
interface Source extends RoomObject {
/**
* The prototype is stored in the Source.prototype global object. You can use it to extend game objects behaviour globally:
*/
readonly prototype: Source;
/**
* The remaining amount of energy.
*/
Expand Down Expand Up @@ -5415,7 +5393,6 @@ declare const Source: SourceConstructor;
* | **Energy auto-regeneration** | 1 energy unit per tick while energy available | in the room (in all spawns and extensions) is less than 300
*/
interface StructureSpawn extends OwnedStructure<STRUCTURE_SPAWN> {
readonly prototype: StructureSpawn;
/**
* The amount of energy containing in the spawn.
* @deprecated An alias for .store[RESOURCE_ENERGY].
Expand Down Expand Up @@ -5576,8 +5553,6 @@ declare const Spawn: StructureSpawnConstructor; // legacy alias
// declare type Spawn = StructureSpawn;

interface Spawning {
readonly prototype: Spawning;

/**
* An array with the spawn directions
*
Expand Down Expand Up @@ -5755,8 +5730,6 @@ type GenericStore = GenericStoreBase & { [P in ResourceConstant]: number };
* The base prototype object of all structures.
*/
interface Structure<T extends StructureConstant = StructureConstant> extends RoomObject {
readonly prototype: Structure;

/**
* The current amount of hit points of the structure.
*/
Expand Down Expand Up @@ -5815,8 +5788,6 @@ declare const Structure: StructureConstructor;
* Such structures can be found using {@link Room.find} and the {@link FIND_MY_STRUCTURES} & {@link FIND_HOSTILE_STRUCTURES} constants.
*/
interface OwnedStructure<T extends StructureConstant = StructureConstant> extends Structure<T> {
readonly prototype: OwnedStructure;

/**
* Whether this is your own structure.
*
Expand Down Expand Up @@ -5846,8 +5817,6 @@ declare const OwnedStructure: OwnedStructureConstructor;
* It can be addressed by {@link Room.controller} property.
*/
interface StructureController extends OwnedStructure<STRUCTURE_CONTROLLER> {
readonly prototype: StructureController;

/**
* Whether using power is enabled in this room.
*
Expand Down Expand Up @@ -5927,8 +5896,6 @@ declare const StructureController: StructureControllerConstructor;
* Extensions can be placed anywhere in the room, any spawns will be able to use them regardless of distance.
*/
interface StructureExtension extends OwnedStructure<STRUCTURE_EXTENSION> {
readonly prototype: StructureExtension;

/**
* The amount of energy containing in the extension.
*
Expand Down Expand Up @@ -5956,8 +5923,6 @@ declare const StructureExtension: StructureExtensionConstructor;
* Remotely transfers energy to another Link in the same room.
*/
interface StructureLink extends OwnedStructure<STRUCTURE_LINK> {
readonly prototype: StructureLink;

/**
* The amount of game ticks the link has to wait until the next transfer is possible.
*/
Expand Down Expand Up @@ -6009,8 +5974,6 @@ declare const StructureLink: StructureLinkConstructor;
* This structure cannot be destroyed.
*/
interface StructureKeeperLair extends OwnedStructure<STRUCTURE_KEEPER_LAIR> {
readonly prototype: StructureKeeperLair;

/**
* Time to spawning of the next Source Keeper.
*/
Expand All @@ -6025,8 +5988,6 @@ declare const StructureKeeperLair: StructureKeeperLairConstructor;
* Provides visibility into a distant room from your script.
*/
interface StructureObserver extends OwnedStructure<STRUCTURE_OBSERVER> {
readonly prototype: StructureObserver;

/**
* Provide visibility into a distant room from your script.
*
Expand All @@ -6053,8 +6014,6 @@ declare const StructureObserver: StructureObserverConstructor;
* Hits the attacker creep back on each attack.
*/
interface StructurePowerBank extends OwnedStructure<STRUCTURE_POWER_BANK> {
readonly prototype: StructurePowerBank;

/**
* The amount of power containing.
*/
Expand All @@ -6076,7 +6035,6 @@ declare const StructurePowerBank: StructurePowerBankConstructor;
* Hits the attacker creep back on each attack.
*/
interface StructurePowerSpawn extends OwnedStructure<STRUCTURE_POWER_SPAWN> {
readonly prototype: StructurePowerSpawn;
/**
* The amount of energy containing in this structure.
* @deprecated An alias for .store[RESOURCE_ENERGY].
Expand Down Expand Up @@ -6126,8 +6084,6 @@ declare const StructurePowerSpawn: StructurePowerSpawnConstructor;
* the same tile. Can be used as a controllable gate.
*/
interface StructureRampart extends OwnedStructure<STRUCTURE_RAMPART> {
readonly prototype: StructureRampart;

/**
* The amount of game ticks when this rampart will lose some hit points.
*/
Expand Down Expand Up @@ -6161,8 +6117,6 @@ declare const StructureRampart: StructureRampartConstructor;
* Using roads allows creating creeps with less `MOVE` body parts.
*/
interface StructureRoad extends Structure<STRUCTURE_ROAD> {
readonly prototype: StructureRoad;

/**
* The amount of game ticks when this road will lose some hit points.
*/
Expand All @@ -6179,8 +6133,6 @@ declare const StructureRoad: StructureRoadConstructor;
* Only one structure per room is allowed that can be addressed by {@link Room.storage} property.
*/
interface StructureStorage extends OwnedStructure<STRUCTURE_STORAGE> {
readonly prototype: StructureStorage;

/**
* An object with the storage contents.
*/
Expand All @@ -6203,8 +6155,6 @@ declare const StructureStorage: StructureStorageConstructor;
* distance. Each action consumes energy.
*/
interface StructureTower extends OwnedStructure<STRUCTURE_TOWER> {
readonly prototype: StructureTower;

/**
* The amount of energy containing in this structure.
* @deprecated An alias for .store[RESOURCE_ENERGY].
Expand Down Expand Up @@ -6269,7 +6219,6 @@ declare const StructureTower: StructureTowerConstructor;
* Blocks movement of all creeps.
*/
interface StructureWall extends Structure<STRUCTURE_WALL> {
readonly prototype: StructureWall;
/**
* The amount of game ticks when the wall will disappear (only for automatically placed border walls at the start of the game).
*/
Expand All @@ -6284,7 +6233,6 @@ declare const StructureWall: StructureWallConstructor;
* Allows to harvest mineral deposits.
*/
interface StructureExtractor extends OwnedStructure<STRUCTURE_EXTRACTOR> {
readonly prototype: StructureExtractor;
/**
* The amount of game ticks until the next harvest action is possible.
*/
Expand All @@ -6299,7 +6247,6 @@ declare const StructureExtractor: StructureExtractorConstructor;
* Produces mineral compounds from base minerals and boosts creeps.
*/
interface StructureLab extends OwnedStructure<STRUCTURE_LAB> {
readonly prototype: StructureLab;
/**
* The amount of game ticks the lab has to wait until the next reaction is possible.
*/
Expand Down Expand Up @@ -6416,7 +6363,6 @@ declare const StructureLab: StructureLabConstructor;
* Sends any resources to a Terminal in another room.
*/
interface StructureTerminal extends OwnedStructure<STRUCTURE_TERMINAL> {
readonly prototype: StructureTerminal;
/**
* The remaining amount of ticks while this terminal cannot be used to make {@link StructureTerminal.send} or {@link Game.market.deal} calls.
*/
Expand Down Expand Up @@ -6456,7 +6402,6 @@ declare const StructureTerminal: StructureTerminalConstructor;
* Contains up to 2,000 resource units. Can be constructed in neutral rooms. Decays for 5,000 hits per 100 ticks.
*/
interface StructureContainer extends Structure<STRUCTURE_CONTAINER> {
readonly prototype: StructureContainer;
/**
* An object with the structure contents.
*
Expand Down Expand Up @@ -6488,7 +6433,6 @@ declare const StructureContainer: StructureContainerConstructor;
* be launched from or to novice rooms.
*/
interface StructureNuker extends OwnedStructure<STRUCTURE_NUKER> {
readonly prototype: StructureNuker;
/**
* The amount of energy contained in this structure.
* @deprecated An alias for .store[RESOURCE_ENERGY].
Expand Down Expand Up @@ -6544,7 +6488,6 @@ declare const StructureNuker: StructureNukerConstructor;
* Portals appear randomly in the central room of each sector.
*/
interface StructurePortal extends Structure<STRUCTURE_PORTAL> {
readonly prototype: StructurePortal;
/**
* The portal's destination.
*
Expand All @@ -6567,7 +6510,6 @@ declare const StructurePortal: StructurePortalConstructor;
* A structure which produces trade commodities from base minerals and other commodities.
*/
interface StructureFactory extends OwnedStructure<STRUCTURE_FACTORY> {
readonly prototype: StructureFactory;
/**
* The amount of game ticks the factory has to wait until the next produce is possible.
*/
Expand Down Expand Up @@ -6610,7 +6552,6 @@ declare const StructureFactory: StructureFactoryConstructor;
* A structure which is a control center of NPC Strongholds, and also rules all invaders in the sector.
*/
interface StructureInvaderCore extends OwnedStructure<STRUCTURE_INVADER_CORE> {
readonly prototype: StructureInvaderCore;
/**
* The level of the stronghold.
*
Expand Down
1 change: 0 additions & 1 deletion src/construction-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* You can remove enemy construction sites by moving a creep on it.
*/
interface ConstructionSite<T extends BuildableStructureConstant = BuildableStructureConstant> extends RoomObject {
readonly prototype: ConstructionSite;
/**
* A unique object identifier.
*
Expand Down
2 changes: 0 additions & 2 deletions src/creep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* | TOUGH | 10 | No effect, just additional hit points to the creep's body. Can be boosted to resist damage.
*/
interface Creep extends RoomObject {
readonly prototype: Creep;

/**
* An array describing the creep's body.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Flags can be used to mark particular spots in a room. Flags are visible to their owners only. You cannot have more than 10,000 flags.
*/
interface Flag extends RoomObject {
readonly prototype: Flag;

/**
* Flag color. One of the {@link ColorConstant COLOR_*} constants.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/mineral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* | | DENSITY_ULTRA: 100% chance*
*/
interface Mineral<T extends MineralConstant = MineralConstant> extends RoomObject {
/**
* The prototype is stored in the Mineral.prototype global object. You can use it to extend game objects behaviour globally.
*/
readonly prototype: Mineral;
/**
* The density of this mineral deposit, one of the {@link DensityConstant DENSITY_*} constants.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/nuke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* The room controller is hit by triggering {@link StructureController.upgradeBlocked} period, which means it is unavailable to activate safe mode again within the next 200 ticks.
*/
interface Nuke extends RoomObject {
readonly prototype: Nuke;

/**
* A unique object identifier.
*
Expand Down
2 changes: 0 additions & 2 deletions src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

interface Resource<T extends ResourceConstant = ResourceConstant> extends RoomObject {
readonly prototype: Resource;

/**
* The amount of resource units containing.
*/
Expand Down
1 change: 0 additions & 1 deletion src/room-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

interface RoomObject {
readonly prototype: RoomObject;
/**
* Effects currently being applied to the object.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/room-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* The position object of a custom location can be obtained using the {@link Room.getPositionAt()} method or using the constructor.
*/
interface RoomPosition {
readonly prototype: RoomPosition;

/**
* The name of the room.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Every object in the room contains its linked Room instance in the {@link RoomObject.room} property.
*/
interface Room {
readonly prototype: Room;

/**
* The Controller structure of this room, if present, otherwise undefined.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
* | Energy regeneration | Every 300 game ticks
*/
interface Source extends RoomObject {
/**
* The prototype is stored in the Source.prototype global object. You can use it to extend game objects behaviour globally:
*/
readonly prototype: Source;
/**
* The remaining amount of energy.
*/
Expand Down
Loading