forked from McArcady/dfhack-client-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblendwarf.py
More file actions
27 lines (21 loc) · 783 Bytes
/
blendwarf.py
File metadata and controls
27 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import asyncio
from dfhack_remote import remote, connect, close, StringMessage, EmptyMessage
## Declare DFHack exported interfaces
@remote
async def GetVersion(output: StringMessage = None): pass
from BasicApi_pb2 import GetWorldInfoOut
@remote
async def GetWorldInfo(output: GetWorldInfoOut = None): pass
from RemoteFortressReader_pb2 import VersionInfo
@remote(plugin='RemoteFortressReader')
async def GetVersionInfo(output: VersionInfo = None): pass
from RemoteFortressReader_pb2 import UnitList
@remote(plugin='RemoteFortressReader')
async def GetUnitList(output: UnitList = None): pass
# Test
async def main():
await connect()
print( await GetVersionInfo() )
print( "Units: ", len((await GetUnitList()).creature_list) )
await close()
asyncio.run(main())