Skip to content

Commit 681633b

Browse files
committed
added place_spawn, world_status, world_start_room
1 parent 5264654 commit 681633b

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

screepsapi/screepsapi.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright @dzhu, @tedivm
2-
# https://gist.github.com/dzhu/d6999d126d0182973b5c
2+
# https://github.com/screepers/python-screeps
33

44
from base64 import b64decode
55
from collections import OrderedDict
@@ -158,25 +158,29 @@ def msg_send(self, respondent, text):
158158
def gen_unique_name(self, type):
159159
return self.post('game/gen-unique-object-name', type=type)
160160

161-
def flag_create(self, room, x, y, name=None, color='white', secondaryColor=None):
161+
def flag_create(self, room, x, y, name=None, color='white', secondaryColor=None, shard='shard0'):
162162
if name is None:
163163
name = self.gen_unique_name('flag')['name']
164164
if secondaryColor is None:
165165
secondaryColor = color
166166

167-
return self.post('game/create-flag', room=room, x=x, y=y, name=name, color=color, secondaryColor=secondaryColor)
167+
return self.post('game/create-flag', room=room, x=x, y=y, name=name, color=color, secondaryColor=secondaryColor, shard='shard0')
168168

169169
def flag_change_pos(self, _id, room, x, y):
170170
return self.post('game/change-flag', _id=_id, room=room, x=x, y=y)
171171

172-
def flag_change_color(self, _id, color, secondaryColor=None):
172+
def flag_change_color(self, _id, color, secondaryColor=None, shard='shard0'):
173173
if secondaryColor is None:
174174
secondaryColor = color
175175

176-
return self.post('game/change-flag-color', _id=_id, color=color, secondaryColor=secondaryColor)
176+
return self.post('game/change-flag-color', _id=_id, color=color, secondaryColor=secondaryColor, shard='shard0')
177177

178-
def create_site(self, typ, room, x, y):
179-
return self.post('game/create-construction', structureType=typ, room=room, x=x, y=y)
178+
def create_site(self, type, room, x, y, shard='shard0'):
179+
return self.post('game/create-construction', structureType=type, room=room, x=x, y=y, shard=shard)
180+
181+
def place_spawn(self, room, name, x, y, shard='shard0'):
182+
self.post('game/place-spawn', room=room, name=name, x=x, y=y, shard=shard)
183+
pass
180184

181185

182186
#### battle info methods
@@ -203,6 +207,12 @@ def map_stats(self, rooms, statName, shard='shard0'):
203207
def worldsize(self, shard='shard0'):
204208
return self.get('game/world-size', shard=shard)
205209

210+
def world_status(self):
211+
return self.get('user/world-status')
212+
213+
def world_start_room(self, shard=None):
214+
return self.get('user/world-start-room', shard=shard)
215+
206216
def history(self, room, tick):
207217
return self.get('../room-history/%s/%s.json' % (room, tick - (tick % 20)))
208218

0 commit comments

Comments
 (0)