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

Make memory extensible #127

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
3 changes: 2 additions & 1 deletion src/creep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface Creep extends RoomObject {
/**
* A shorthand to Memory.creeps[creep.name]. You can use it for quick access the creep’s specific memory data object.
*/
memory: any;
memory: CreepMemory;
/**
* Whether it is your creep or foe.
*/
Expand Down Expand Up @@ -230,5 +230,6 @@ interface Creep extends RoomObject {

interface CreepConstructor extends _Constructor<Creep>, _ConstructorById<Creep> {
}
interface CreepMemory { }

declare const Creep: CreepConstructor;
4 changes: 3 additions & 1 deletion src/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Flag extends RoomObject {
/**
* A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object.
*/
memory: any;
memory: FlagMemory;
/**
* Flag’s name. You can choose the name while creating a new flag, and it cannot be changed later. This name is a hash key to access the spawn via the Game.flags object.
*/
Expand Down Expand Up @@ -52,4 +52,6 @@ interface FlagConstructor extends _Constructor<Flag> {
(name: string, color: number, secondaryColor: number, roomName: string, x: number, y: number): Flag;
}

interface FlagMemory { }

declare const Flag: FlagConstructor;
4 changes: 3 additions & 1 deletion src/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface Room {
/**
* A shorthand to Memory.rooms[room.name]. You can use it for quick access the room’s specific memory data object.
*/
memory: any;
memory: RoomMemory;
/**
* One of the following constants:
* MODE_SIMULATION, MODE_SURVIVAL, MODE_WORLD, MODE_ARENA
Expand Down Expand Up @@ -170,4 +170,6 @@ interface RoomConstructor {
deserializePath(path: string): PathStep[];
}

interface RoomMemory { }

declare const Room: RoomConstructor;
4 changes: 3 additions & 1 deletion src/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface StructureSpawn extends OwnedStructure {
/**
* A shorthand to Memory.spawns[spawn.name]. You can use it for quick access the spawn’s specific memory data object.
*/
memory: any;
memory: SpawnMemory;
/**
* Spawn’s name. You choose the name upon creating a new spawn, and it cannot be changed later. This name is a hash key to access the spawn via the Game.spawns object.
*/
Expand Down Expand Up @@ -120,4 +120,6 @@ interface StructureSpawn extends OwnedStructure {
interface StructureSpawnConstructor extends _Constructor<StructureSpawn>, _ConstructorById<StructureSpawn> {
}

interface SpawnMemory { }

declare const StructureSpawn: StructureSpawnConstructor;