Hextorio - Build in hexagons


Expand your hex territory. Loot dungeons. Complete quests. Level up every item in the game. Trade your way to victory. Get rich.

Overhaul
12 days ago
2.0 - 2.1
6.54K
Factorio: Space Age Icon Space Age Mod
Transportation Logistics Combat Enemies Environment Mining Manufacturing Storage

b Bug: Strongbox appears in unclaimed hex

7 months ago

While playing with minimal hex sizes (size=12, stroke=2), I claimed a hex and a strongbox happened to appear in a neighbor cell, which was unclaimed at the time.
My guess is that the spawn logic makes it appear near the core in a fixed radius, independent of the actual hex size

5 months ago

That is correct! It's something I didn't bother generalizing. It's because the modding API's function for finding open positions in the world for spawning entities checks in a rectangular area. I first make it choose a random location within a circular area centered around the hex core (radius of 16 tiles at max), and then I have it search for an open position within a range of 10 tiles from that randomly chosen location around the hex. When hexes are small enough, that will often result in them being put into neighboring hexes. Generalizing this to make them stay within their original hexes could maybe be done by "snapping" positions in the axial coordinate system, and that would work almost all of the time. And while it would almost never really be an issue, the problem of having to find open positions persists (potentially offsetting into a neighboring hex). It's something I could get around to implementing if more people start wanting that for some reason, lol.

New response