Page 1 of 1

on_player_setup_blueprint ?

Posted: Sat Jul 22, 2017 5:53 am
by d3x0r
on_player_setup_blueprint seems like a pretty useless event...
I was hoping that would be called after the items were set into the blueprint, but before it shows to the player. Rail Power System uses a ghost entity power pole, this shows on the blueprint, but when the blueprint is built the power pole isn't. So I was hoping to change the item in the blueprint to the correct item so it would get built. Seems like doing this fixup during on_player_configured_blueprint would be too late; since the player would have already been accepting what is in the blueprint. (Although it does work to do my fixup there) Unfortunatly components shows a blank icon until the blueprint is re-opened for configuration.

Code: Select all

	local player = game.players[event.player_index]
	local stack = player.cursor_stack
	if not stack.valid then 
		log( "stack not valid" );
		return
	end
	if not stack.valid_for_read then
		log( "stack not valid for read" );
		return
	end
valid_for read is not true; and if I skip that and continue, of course it crashes when I do local entities = stack.get_blueprint_entities().


.

Re: on_player_setup_blueprint ?

Posted: Sun Jul 23, 2017 3:43 am
by Rseding91
The blueprint item isn't actually in the cursor when the player sets up a blueprint. It's stored in a different stack which isn't currently exposed through the Lua API. I'll see about adding in support to read/modify it but it might not make it into 0.15.