[0.12.6] LuaEntity entity-ghost missing keys

Bugs that are actually features.
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

[0.12.6] LuaEntity entity-ghost missing keys

Post by erisco »

A LuaEntity with name "entity-ghost" is missing these properties even when the "ghost_type" is appropriate, as according to this documentation https://forums.factorio.com/wiki/inde ... ate_entity
  • bar
    requestfilters
    conditions
    filters
Attempting to read these properties even when the "ghost_type" is appropriate throws an exception "LuaEntity doesn't contain key …".

Related: https://forums.factorio.com/forum/vie ... 30&t=15496
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by Rseding91 »

Bar is settable/gettable on an inventory: entity.get_inventory()
https://forums.factorio.com/wiki/inde ... ry#has_bar

get_request_slot, set_request_slot, get_circuit_condition, set_circuit_condition, get_filter, set_filter work just fine on ghosts. We've got a test that covers these in fact.
https://forums.factorio.com/wiki/inde ... get_filter
If you want to get ahold of me I'm almost always on Discord.
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by erisco »

I am not using these get_ and set_ methods. For example, I am using "x.filters". You can see my usage from line 48 and onward at https://github.com/erisco/quickprints/b ... ontrol.lua.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by Rseding91 »

erisco wrote:I am not using these get_ and set_ methods. For example, I am using "x.filters". You can see my usage from line 48 and onward at https://github.com/erisco/quickprints/b ... ontrol.lua.
Right. You have to use those to read the values off entities. The URL you linked is for creating entities using the create_entity method - the methods I listed are for reading/writing the values off real entities.
If you want to get ahold of me I'm almost always on Discord.
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by erisco »

Okay I am confused then. The related issue https://forums.factorio.com/forum/vie ... 30&t=15496 suggests (to me) these keys should work. Also, why do "name", "position", "direction", "force", and "recipe" all work? Why shouldn't "bar", "requestfilters", "conditions", and "filters" also work?

This is the documentation I refer to for LuaEntity. https://forums.factorio.com/wiki/inde ... round_type
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by Rseding91 »

erisco wrote:Okay I am confused then. The related issue https://forums.factorio.com/forum/vie ... 30&t=15496 suggests (to me) these keys should work. Also, why do "name", "position", "direction", "force", and "recipe" all work? Why shouldn't "bar", "requestfilters", "conditions", and "filters" also work?

This is the documentation I refer to for LuaEntity. https://forums.factorio.com/wiki/inde ... round_type
name, position, direction, force, recipe all work because they're valid read (and write in most instances) properties on LuaEntity:

https://forums.factorio.com/wiki/inde ... ntity#name
https://forums.factorio.com/wiki/inde ... y#position
https://forums.factorio.com/wiki/inde ... tity#force
https://forums.factorio.com/wiki/inde ... ity#recipe
https://forums.factorio.com/wiki/inde ... #direction

They're basic properties - you can get/set them with 1 variable. Things that take more complex variables or more than 1 (filters taking an index and item name) use methods so you can "get_filter(5)" and get the 5th filter from the entity or "set_request_slot(3, {name="iron-ore", count=30})" and set slot 3 to the item stack iron ore with a count of 30.
If you want to get ahold of me I'm almost always on Discord.
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Re: [0.12.6] LuaEntity entity-ghost missing keys

Post by erisco »

Okay, thanks. I overlooked this, expecting them to behave like the other properties. Especially since "recipe" for example just gives you a recipe object. Shame the others do not work like that.

Seems it will be more complicated to build the ghost objects. Ideally the game engine would just expose whatever it uses already to build ghost objects (construction bots do this, clearly). Anyways, appears there is no bug after all, just maybe some feature requests.

Thanks again.
Post Reply

Return to “Not a bug”