diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..646419c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +atlassian-ide-plugin.xml diff --git a/Creep.js b/Creep.js new file mode 100644 index 0000000..fd7f727 --- /dev/null +++ b/Creep.js @@ -0,0 +1,65 @@ +Creep = function() +{ + +}; + +Creep.prototype = { + + id: null, + + name: null, + + owner: null, + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + memory: null, + + my: true, + + spawning: true, + + body: [ ], + + energy: 0, + + energyCapacity: 0, + + hits: 0, + + hitsMax: 0, + + ticksToLive: 0, + + fatigue: 0, + + attack: function(target) { }, + + build: function(target) { }, + + dropEnergy: function(amount) { }, + + getActiveBodyparts: function(type) { }, + + harvest: function(target) { }, + + move: function(direction) { }, + + moveTo: function(target, opts) { }, + + pickup: function(target) { }, + + rangedAttack: function(target) { }, + + suicide: function() { }, + + transferEnergy: function(target, amount) { } +}; \ No newline at end of file diff --git a/Energy.js b/Energy.js new file mode 100644 index 0000000..eba6366 --- /dev/null +++ b/Energy.js @@ -0,0 +1,20 @@ +Energy = function() +{ + +}; + +Energy.prototype = { + id: "", + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + energy: 0 +}; \ No newline at end of file diff --git a/Exit.js b/Exit.js new file mode 100644 index 0000000..cf615ce --- /dev/null +++ b/Exit.js @@ -0,0 +1,20 @@ +Exit = function() +{ + +}; + +Exit.prototype = { + id: "", + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + exit: 0 +}; \ No newline at end of file diff --git a/Flag.js b/Flag.js new file mode 100644 index 0000000..f805774 --- /dev/null +++ b/Flag.js @@ -0,0 +1,24 @@ +Flag = function() +{ + +}; + +Flag.prototype = { + id: "", + + name: "", + + roomName: "", + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + remove: function() { } +}; \ No newline at end of file diff --git a/Game.js b/Game.js new file mode 100644 index 0000000..c57181f --- /dev/null +++ b/Game.js @@ -0,0 +1,87 @@ +var Game = function() +{ + +}; + +Game.prototype = { + OK: 0, + ERR_NOT_OWNER: -1, + ERR_NO_PATH: -2, + ERR_NAME_EXISTS: -3, + ERR_BUSY: -4, + ERR_NOT_FOUND: -5, + ERR_NOT_ENOUGH_ENERGY: -6, + ERR_INVALID_TARGET: -6, + ERR_FULL: -8, + ERR_NOT_IN_RANGE: -9, + ERR_INVALID_ARGS: -10, + ERR_TIRED: -11, + ERR_NO_BODYPART: -12, + ERR_NOT_ENOUGH_EXTENSIONS: -13, + + CREEPS: 1, + MY_CREEPS: 2, + HOSTILE_CREEPS: 3, + SOURCES_ACTIVE: 4, + SOURCES: 5, + DROPPED_ENERGY: 6, + STRUCTURES: 7, + MY_STRUCTURES: 8, + HOSTILE_STRUCTURES: 9, + FLAGS: 10, + CONSTRUCTION_SITES: 11, + MY_SPAWNS: 12, + HOSTILE_SPAWNS: 13, + EXIT_TOP: 14, + EXIT_RIGHT: 15, + EXIT_BOTTOM: 16, + EXIT_LEFT: 17, + + TOP: 1, + TOP_RIGHT: 2, + RIGHT: 3, + BOTTOM_RIGHT: 4, + BOTTOM: 5, + BOTTOM_LEFT: 6, + LEFT: 7, + TOP_LEFT: 8, + + MOVE: "move", + WORK: "work", + CARRY: "carry", + ATTACK: "attack", + RANGED_ATTACK: "ranged_attack", + TOUGH: "tough", + HEAL: "heal", + + STRUCTURE_EXTENSION: "extension", + STRUCTURE_RAMPART: "rampart", + STRUCTURE_ROAD: "road", + STRUCTURE_SPAWN: "spawn", + STRUCTURE_WALL: "constructedWall", + + /** + * @type Creep[] + */ + creeps: null, + + flags: null, + + /** + * @type Spawn[] + */ + spawns: null, + + /** + * @type Structure[] + */ + structures: null, + + time: 0, + + getObjectById: function(id) { }, + + getRoom: function(name) { }, + + notify: function(message) { } +}; \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..ad92cda --- /dev/null +++ b/Readme.md @@ -0,0 +1,5 @@ +Screeps Autocomplete +==================== +The purpose of this is to add screeps autocomplete to IDE's by creating a defintion from the documents. People can then +add this project as a library in their IDE, and their IDE should be able to start autocompleting their code. Tested +somewhat in JetBrain's WebStorm \ No newline at end of file diff --git a/Room.js b/Room.js new file mode 100644 index 0000000..12dc194 --- /dev/null +++ b/Room.js @@ -0,0 +1,29 @@ +Room = function() +{ + +}; + +Room.prototype = { + name: "", + + createFlag: function(x, y, name) { }, + + createConstructionSite: function(x, y, structureType) { }, + + find: function(type, opts) { }, + + lookAt: function(x, y, opts) { }, + + findPath: function(fromPos, toPos, opts) { }, + + /** + * + * @param x {Number} The X position. + * @param y {Number} The Y position. + * + * @return RoomPosition + */ + getPositionAt: function(x, y) { }, + + makeSnapshot: function(description) { } +}; \ No newline at end of file diff --git a/RoomPosition.js b/RoomPosition.js new file mode 100644 index 0000000..b7c86d7 --- /dev/null +++ b/RoomPosition.js @@ -0,0 +1,25 @@ +RoomPosition = function() +{ +}; + +RoomPosition.prototype = { + x: 0, + + y: 0, + + roomName: 0, + + inRangeTo: function(toPos, range) { }, + + isNearTo: function(x, y) { }, + + getDirectionTo: function(x, y) { }, + + findPathTo: function(target, opts) { }, + + findNearest: function(type, opts) { }, + + findInRange: function(type, range, opts) { }, + + equalsTo: function(x, y) { } +}; \ No newline at end of file diff --git a/Source.js b/Source.js new file mode 100644 index 0000000..994350a --- /dev/null +++ b/Source.js @@ -0,0 +1,24 @@ +Source = function() +{ + +}; + +Source.prototype = { + id: "", + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + energy: 0, + + energyCapacity: 0, + + ticksToRegeneration: 0 +}; \ No newline at end of file diff --git a/Spawn.js b/Spawn.js new file mode 100644 index 0000000..b3012d3 --- /dev/null +++ b/Spawn.js @@ -0,0 +1,42 @@ +Spawn = function() +{ + +}; + +Spawn.prototype = { + id: "", + + name: "", + + owner: "", + + /** + * @type Room + */ + room: null, + + /** + * @type RoomPosition + */ + pos: null, + + memory: [ ], + + my: true, + + structureType: 'spawn', + + spawning: null, + + energy: 0, + + energyCapacity: 0, + + hits: 0, + + hitsMax: 0, + + createCreep: function(bodyParts, name, memory) { }, + + transferEnergy: function(target, amount) { } +}; \ No newline at end of file diff --git a/Structure.js b/Structure.js new file mode 100644 index 0000000..7a3fe32 --- /dev/null +++ b/Structure.js @@ -0,0 +1,26 @@ +Structure = function() +{ + +}; + +Structure.prototype = { + id: "", + + owner: "", + + room: null, + + pos: null, + + hits: 0, + + hitsMax: 0, + + structureType: "", + + my: true, + + energy: 0, + + energyCapacity: 0 +}; \ No newline at end of file