Skip to content

Getting all tiles in local map #1

@hyperioo

Description

@hyperioo

Hello,

First I would like to thank you for putting up this work. I am struggling a bit with the interface.

Basically I want to grab information about all ingame tiles of the currently opened Fortress with DFHack running in the background. Ideally, this would be a 3D matrix with each cell containing information about the type of the associated tile (air, rock, water, wood...), potentially with buildings, items and creatures in that tile.

I dug a bit in DFHack documentation and from what I understand tiles are gathered in blocks. So I was trying to use the GetBlockList function to see what I could get (and from what I see in https://github.com/DFHack/dfhack/blob/b954cd7a0d574fa92d7c9a26a9e2298ab9126959/plugins/remotefortressreader/remotefortressreader.cpp#L1395 it seems to access tile info).

Sadly the ouput has an empty field for the map_blocks and I don't really know if the interface is broken somehow or if I am doing something wrong.

I edited blendwarf.py with theses lines:

from RemoteFortressReader_pb2 import BlockRequest

from RemoteFortressReader_pb2 import BlockList
@remote(plugin='RemoteFortressReader')
async def GetBlockList(input: BlockRequest, output: BlockList): pass

and

    # Input argument
    blockRequest = BlockRequest()
    # Values based on what I saw in GetMapInfo
    blockRequest.min_x = 88
    blockRequest.max_x = 90
    blockRequest.min_y = 66
    blockRequest.max_y = 68
    blockRequest.min_z = -16
    blockRequest.max_z = -14

    # Reproducing the formulas of plugins/remotefortressreader/remotefortressreader.cpp
    center_x = (blockRequest.min_x + blockRequest.max_x) / 2
    center_y = (blockRequest.min_y + blockRequest.max_y) / 2
    nb_points = ((blockRequest.max_x - center_x + 1) * 2) * ((blockRequest.max_y - center_y + 1) * 2)
    blockRequest.blocks_needed = int(nb_points * (blockRequest.max_z - blockRequest.min_z))

    # Output argument
    blockList = BlockList()

    # Call to function
    print("Blocks: ", (await GetBlockList(blockRequest, blockList)))
    print(blockList)

I just see Blocks: map_x: 89 map_y: 67 so the funtion is well-called and returns values, but nothing for the blocks.

Do you have any idea about what is wrong?

Thank you for your help,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions