Page 1 of 1
[0.12.6] LuaEntity entity-ghost missing keys
Posted: Fri Sep 04, 2015 8:31 pm
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
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Fri Sep 04, 2015 9:06 pm
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
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Fri Sep 04, 2015 11:10 pm
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.
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Fri Sep 04, 2015 11:45 pm
by Rseding91
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.
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Sat Sep 05, 2015 12:00 am
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
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Sat Sep 05, 2015 12:07 am
by Rseding91
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.
Re: [0.12.6] LuaEntity entity-ghost missing keys
Posted: Sat Sep 05, 2015 12:22 am
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.