Page 1 of 1
					
				LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 6:01 am
				by Therenas
				Honktown wrote: Fri Jun 04, 2021 1:19 am
https://lua-api.factorio.com/latest/Lua ... get_recipe
Works on a ghost of a crafting machine. Not sure if it is intentional or not (there is no other obvious way to check the recipe on a ghost), but it works. get_recipe() and previous_recipe don't do anything on a blueprint of a furnace, which makes sense.
 
Is this more of a comment? What do you think should be changed?
 
			
					
				Re: Small documentation improvement requests
				Posted: Fri Jun 04, 2021 6:26 am
				by DaveMcW
				Can only be used if this is CraftingMachine, or EntityGhost of CraftingMachine.
			 
			
					
				Re: LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 6:28 am
				by Therenas
				Doesn't CraftingMachine already imply that?
			 
			
					
				Re: LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 6:34 am
				by DaveMcW
				Not unless you know the LuaEntity inheritance tree. If you want to document how a LuaEntity can be two types at once, that would be great too!
			 
			
					
				Re: LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 6:44 am
				by Therenas
				You're right, probably best to be explicit. Fixed for the next release.
The whole 'Can only be used if' system is kind of bad in general though, it's due for a re-do at some point I feel like.
			 
			
					
				Re: LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 7:08 am
				by Honktown
				Therenas wrote: Fri Jun 04, 2021 6:28 am
Doesn't CraftingMachine already imply that?
 
Ghosts can't craft and machines of them are an entity-ghost, so from a modder perspective, no. How I viewed it, hence the request. Similarly, seemingly far more important attributes, ghost_name, ghost_prototype, ghost_type, e.g. are separate. No ghost_get_recipe() or ghost_set_recipe()
 
			
					
				Re: LuaEntity::get_recipe() subclasses
				Posted: Fri Jun 04, 2021 12:45 pm
				by eradicator
				Therenas wrote: Fri Jun 04, 2021 6:28 am
Doesn't CraftingMachine already imply that?
 
Intuitively and without evidence and very personal opinion: No.
I generally assume that SomethingGhost behaves entirely different than the real thing.