Force blueprint placement
Posted: Sat Jun 02, 2018 8:10 pm
Hi all,
I'm trying to modify a blueprint as it's placed. Specifically, I want to insert landfill underneath the entities.
I have a custom input set on "SHIFT + mouse-button-1" to intercept the BP placement, and add the ground tiles. The issue is if the entire BP is over water, no entities are placeable, and so the added tiles don't get placed either.
I tried inserting a hidden entity with no collision mask (ie placeable over water) during the custom-input event, to force blueprint placement. The custom-input event does trigger before blueprint placement, because the added entity shows up over land, but apparently the decision whether or not to place the blueprint occurs before the custom-input event, because over water still nothing get placed. Interestingly, this works if you double-click over water, since the first time the hidden item gets added to the BP, the second time it's already present and the BP gets placed.
So, are any of the following fixable:
If I add the hidden entity during on_player_cursor_stack_changed, everything works, since the hidden item is already in the BP when the decision to place is made (by the game). The issue there is the mod would corrupt every BP with a hidden entity, which would remain if exported or the mod is uninstalled.
I could call LuaItemStack.build_blueprint() from my custom-input event, but as far as I know, there's no way to get the cursor's in-game position.
Is there a way to programmatically emulate a user input? (force the double-click action)
Is there a way to intercept the BP placement decision (occurring before custom-input event)?
I'm trying to modify a blueprint as it's placed. Specifically, I want to insert landfill underneath the entities.
I have a custom input set on "SHIFT + mouse-button-1" to intercept the BP placement, and add the ground tiles. The issue is if the entire BP is over water, no entities are placeable, and so the added tiles don't get placed either.
I tried inserting a hidden entity with no collision mask (ie placeable over water) during the custom-input event, to force blueprint placement. The custom-input event does trigger before blueprint placement, because the added entity shows up over land, but apparently the decision whether or not to place the blueprint occurs before the custom-input event, because over water still nothing get placed. Interestingly, this works if you double-click over water, since the first time the hidden item gets added to the BP, the second time it's already present and the BP gets placed.
So, are any of the following fixable:
If I add the hidden entity during on_player_cursor_stack_changed, everything works, since the hidden item is already in the BP when the decision to place is made (by the game). The issue there is the mod would corrupt every BP with a hidden entity, which would remain if exported or the mod is uninstalled.
I could call LuaItemStack.build_blueprint() from my custom-input event, but as far as I know, there's no way to get the cursor's in-game position.
Is there a way to programmatically emulate a user input? (force the double-click action)
Is there a way to intercept the BP placement decision (occurring before custom-input event)?