Page 1 of 1

2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sat Sep 26, 2015 1:15 am
by vzybilly
  • Add a "show_on_Map" option for vehicles. a new mod of mine is about to fill the game with hidden vehicles.
  • "As of 0.12.0 this event is also fired when a ghost is placed down either via blueprint or manually." either make this a different event or an easy way to tell, maybe "isGhost = true" ... I didn't see an easy way to tell, Entities don't have a is_ghost option...
  • I would like the ability to get the item used to place the entity as well, since "on_put_item" doesn't fire for robo buddies (construction robots build it) or a "on_robot_put_item" event. I could be adding 2^24 entities otherwise.
Also, I couldn't tell from the wiki, does "on_put_item" only fire if "on_built_entity" would also fire?

Sorry if things seem abit jumbled, I'm in a rush and didn't have time to really do anything. I'll hopefully be here tomorrow to actually work on things.

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sat Sep 26, 2015 2:49 am
by Rseding91
event.created_entity.type == "entity-ghost"/"tile-ghost" - true if the entity is a entity ghost or a tile ghost.

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sat Sep 26, 2015 4:20 am
by vzybilly
Rseding91 wrote:event.created_entity.type == "entity-ghost"/"tile-ghost" - true if the entity is a entity ghost or a tile ghost.
OK, thanks, that solves one of the three things... is it possible to make it so ghosts can't be placed for my tile? limiting it to only a player placing it by hand?

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sat Sep 26, 2015 5:33 pm
by Outsider
vzybilly wrote:
  • Add a "show_on_Map" option for vehicles. a new mod of mine is about to fill the game with hidden vehicles.
  • "As of 0.12.0 this event is also fired when a ghost is placed down either via blueprint or manually." either make this a different event or an easy way to tell, maybe "isGhost = true" ... I didn't see an easy way to tell, Entities don't have a is_ghost option...
  • I would like the ability to get the item used to place the entity as well, since "on_put_item" doesn't fire for robo buddies (construction robots build it) or a "on_robot_put_item" event. I could be adding 2^24 entities otherwise.
Also, I couldn't tell from the wiki, does "on_put_item" only fire if "on_built_entity" would also fire?

Sorry if things seem abit jumbled, I'm in a rush and didn't have time to really do anything. I'll hopefully be here tomorrow to actually work on things.
there is kinda a roundabout way to get the item form the on_put_item event.. you can do something like this :

Code: Select all

game.on_event(defines.events.on_put_item, function(event)
    local player = game.players[event.player_index]
    local itemStack = player.cursor_stack
    local name = itemStack.name -- item name
end)
it'd be nice however if this was actually returned in the event itself but this can be used for now.

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sat Sep 26, 2015 6:53 pm
by vzybilly
Outsider wrote:there is kinda a roundabout way to get the item form the on_put_item event.. you can do something like this :

Code: Select all

game.on_event(defines.events.on_put_item, function(event)
    local player = game.players[event.player_index]
    local itemStack = player.cursor_stack
    local name = itemStack.name -- item name
end)
it'd be nice however if this was actually returned in the event itself but this can be used for now.
for that I was talking about getting the item used to place the tile/entity during on_built_entity, since there is no on_robot_put_item.

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Sun Oct 04, 2015 8:17 am
by Adil
vzybilly wrote:is it possible to make it so ghosts can't be placed for my tile? limiting it to only a player placing it by hand?
You can make your placement item a capsule and have the entity placed as an effect of capsule.
Also, does
vzybilly wrote:I could be adding 2^24 entities otherwise.
mean that there are already 2^24 items in your mod?

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Thu Oct 08, 2015 5:18 pm
by vzybilly
Adil wrote:
vzybilly wrote:is it possible to make it so ghosts can't be placed for my tile? limiting it to only a player placing it by hand?
You can make your placement item a capsule and have the entity placed as an effect of capsule.
Also, does
vzybilly wrote:I could be adding 2^24 entities otherwise.
mean that there are already 2^24 items in your mod?
I might have to check in with the capsule, that might actually be what is needed due to a lack of events.

Also, for getting the base to work, it's only got 8 different ones but when it does work then I'll make the others with the max being up at that number. it will only be changing one number so there's no dramatic bloat of any files, just during runtime...

Re: 2 Changes to on_built_entity, 1 Change to vehicles.

Posted: Fri Mar 11, 2022 11:55 pm
by curiosity
There's the "not-on-map" entity prototype flag, vehicle prototypes have a minimap representation sprite, both manual and robot build events have the item stack used for building. I think this thread can be safely considered implemented at this point.