2 Changes to on_built_entity, 1 Change to vehicles.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

2 Changes to on_built_entity, 1 Change to vehicles.

Post 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.
Will code for Food. I also have 11+ mods!
Rseding91
Factorio Staff
Factorio Staff
Posts: 14337
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

event.created_entity.type == "entity-ghost"/"tile-ghost" - true if the entity is a entity ghost or a tile ghost.
If you want to get ahold of me I'm almost always on Discord.
vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

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

Post 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?
Will code for Food. I also have 11+ mods!
Outsider
Fast Inserter
Fast Inserter
Posts: 115
Joined: Sat Jan 10, 2015 12:23 am
Contact:

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

Post 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.
Advanced Logistics System - Provides a detailed view of your logistics network and the items within it
vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

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

Post 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.
Will code for Food. I also have 11+ mods!
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

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

Post 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?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

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

Post 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...
Will code for Food. I also have 11+ mods!
curiosity
Filter Inserter
Filter Inserter
Posts: 471
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

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

Post 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.
Post Reply

Return to “Implemented mod requests”