Last active
September 19, 2016 02:09
-
-
Save seth10/82b32688a27f20233a2935d025f8c1dd to your computer and use it in GitHub Desktop.
Trying to figure out storing absolute positions in Screeps. Turns out you could use ids for this, but shouldn't.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Game.creeps.Snowflake1.pos.findClosestByRange(FIND_SOURCES) | |
< [source #579fa8b80700be0674d2e2e8] | |
> Game.creeps.Snowflake1.room.find(FIND_SOURCES) | |
< [source #579fa8b80700be0674d2e2e8] | |
> Game.creeps.Snowflake1.room.find(FIND_SOURCES)[0].pos | |
< [room W53N6 pos 14,42] | |
> new RoomPosition(14, 42, 'W53N6') | |
< [room W53N6 pos 14,42] | |
> new RoomPosition(14, 42) // room required | |
//Error: invalid arguments in RoomPosition constructor | |
> Game.rooms.W53N6 | |
< [room W53N6] | |
> Game.rooms.W53N6.getPositionAt(14,42) | |
< [room W53N6 pos 14,42] | |
> Game.spawns | |
< [object Object] | |
> Game.spawns['Arendelle'] | |
< [spawn Arendelle] | |
> Game.spawns['Arendelle'].pos | |
< [room W53N6 pos 26,39] | |
> Game.creeps.Snowflake1.room.find(FIND_SOURCES)[0].pos | |
< [room W53N6 pos 14,42] | |
> Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0].pos | |
< [room W53N6 pos 14,42] | |
> Game.creeps.Snowflake1.pos.findClosestByRange(FIND_SOURCES) | |
< [source #579fa8b80700be0674d2e2e8] | |
> Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0] | |
< [source #579fa8b80700be0674d2e2e8] | |
> Game.rooms.W53N6.getPositionAt(26,39) | |
< [room W53N6 pos 26,39] | |
> Game.rooms.W53N6.getPositionAt(26,39).look() | |
< [object Object],[object Object] | |
> Game.rooms.W53N6.getPositionAt(26,39).look()[0] | |
< [object Object] | |
> Game.rooms.W53N6.getPositionAt(26,39).look()[0].type | |
< structure | |
> Game.rooms.W53N6.getPositionAt(26,39).look()[1].type | |
< terrain | |
> Game.rooms.W53N6.getPositionAt(26,39).look()[0].structure | |
< [spawn Arendelle] | |
> Game.rooms.W53N6.getPositionAt(14,42).look()[0].source | |
< [source #579fa8b80700be0674d2e2e8] | |
> Game.rooms.W53N6.getPositionAt(14,42).look()[0].source.id | |
< 579fa8b80700be0674d2e2e8 | |
> Game.getObjectById('579fa8b80700be0674d2e2e8') | |
< [source #579fa8b80700be0674d2e2e8] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment