[1.1.69] LuaSurface::can_place_entity always returns false for transport belt ghosts
Posted: Sat Oct 01, 2022 4:28 am
I have a mod where I'm replaying other players' actions in multiplayer speedruns for practice purposes. I was calling LuaSurface::can_place_entity on a variety of entities to check if they were placeable before building them, and when attempting to check if ghosts of transport belts could be placed, it unexpectedly returned false, even when the tile is empty and the check returns true on the non-ghost version.
Example (on a new map or in the attached save, where the position just to the right of the starting position is empty):
prints false (it seems like it should be true since it's unimpeded)
prints true (as expected) when it's not a ghost.
prints true (as expected) for other entities I tried.
splitters, underground belts, and the fast/express versions all have the same issue. I'm not sure if I'm doing the right build_check_type, but the behavior is the same for all build_check_types.
Example (on a new map or in the attached save, where the position just to the right of the starting position is empty):
Code: Select all
/c game.print(game.surfaces[1].can_place_entity{direction=0, inner_name="transport-belt", name="entity-ghost", position={x=1.5,y=-0.5}, force="player", build_check_type=defines.build_check_type.script_ghost})
Code: Select all
/c game.print(game.surfaces[1].can_place_entity{direction=0, name="transport-belt", position={x=1.5, y=-0.5}, force="player", build_check_type=defines.build_check_type.script_ghost})
Code: Select all
/c game.print(game.surfaces[1].can_place_entity{direction=0, inner_name="inserter", name="entity-ghost", position={x=1.5, y=-0.5}, force="player", build_check_type=defines.build_check_type.script_ghost})
splitters, underground belts, and the fast/express versions all have the same issue. I'm not sure if I'm doing the right build_check_type, but the behavior is the same for all build_check_types.