Skip to content

Commit

Permalink
Adding getRawMapData
Browse files Browse the repository at this point in the history
  • Loading branch information
olijeffers0n committed Sep 2, 2021
1 parent 198a0bf commit a0784f4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ camera_image = rust_socket.getCameraFrame("CAMID",FRAMENO)
#Get Map Image:
rust_map = rust_socket.getMap(addIcons = True, addEvents = True, addVendingMachines= True)

#Getting Map Data
rust_map_data = rust_socket.getRawMapData()

#Get Entity Information
entity_info = rust_socket.getEntityInfo(ENTITYID)

Expand Down
2 changes: 1 addition & 1 deletion rustplus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

__name__ = "rustplus"
__author__ = "olijefferson"
__version__ = "2.2.3"
__version__ = "2.3"
__support__ = "Discord: https://discord.gg/nQqJe8qvP8"
22 changes: 22 additions & 0 deletions rustplus/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ def __getMap(self, MAPSIZE):

return (im, monuments)

def __getRawMapData(self):
request = self.__initProto()
request.getMap.CopyFrom(AppEmpty())
data = request.SerializeToString()

self.ws.send_binary(data)

return_data = self.ws.recv()

app_message = AppMessage()
app_message.ParseFromString(return_data)

self.error_checker.check(app_message)

return app_message.response.map

def __getMarkers(self):

request = self.__initProto()
Expand Down Expand Up @@ -357,6 +373,12 @@ def getInfo(self) -> dict:

return outData

def getRawMapData(self) -> AppMap:
"""
Returns the list of monuments on the server. This is a relatively expensive operation as the monuments are part of the map data
"""
return self.__getRawMapData()

def getMap(self, addIcons : bool = False, addEvents : bool = False, addVendingMachines : bool = False) -> Image:
"""
Returns the Map of the server with the option to add icons.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
project_urls={
"Issue tracker": "https://github.com/olijeffers0n/rustplus/issues",
},
version="2.2.3",
version="2.3",
include_package_data=True,
packages = ['rustplus', 'rustplus.api', 'rustplus.api.icons', 'rustplus.exceptions', 'rustplus.objects', 'rustplus.utils'],
license='MIT',
Expand Down

0 comments on commit a0784f4

Please sign in to comment.