Hello, on_player_placed_equipment contains equipment as LuaEquipment, but in on_player_removed_equipment the same field is only a string with the name.
As the latter could be easily written as event.equipment.name I believe it's a bug.
[0.16.22] Inconsistent fields for events
[0.16.22] Inconsistent fields for events
Last edited by fbo on Sun Feb 11, 2018 7:31 pm, edited 3 times in total.
- impetus maximus
- Smart Inserter
- Posts: 1299
- Joined: Sat Aug 20, 2016 10:07 pm
- Contact:
Re: [0.16.22] Inconsistent fields for events
Once the equipment is removed it doesn't exist anymore to get the name from so it's impossible to give a LuaEquipment in the event that doesn't exist.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.16.22] Inconsistent fields for events
Oh, LuaEquipment is only for things in a grid. My misunderstanding was it would apply to anything that could be placed inside an armor.
Re: [0.16.22] Inconsistent fields for events
I'm not understanding. The only things you can place in armor is equipment?fbo wrote:Oh, LuaEquipment is only for things in a grid. My misunderstanding was it would apply to anything that could be placed inside an armor.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.16.22] Inconsistent fields for events
The thing is: It's not equipment if outside a grid. The API doc for LuaEquipment clearly states:
Further browsing the excellent docs I came up with this to get the type of removed equipment:
Same concept like entities, duh. Just a case of RTFMNote: An equipment reference becomes invalid once the equipment is removed or the equipment grid (see LuaEquipmentGrid) it resides in is destroyed.
Further browsing the excellent docs I came up with this to get the type of removed equipment:
Code: Select all
player.cursor_stack.prototype.place_as_equipment_result.type