Page 1 of 1
[0.16.22] Inconsistent fields for events
Posted: Sun Feb 11, 2018 7:12 pm
by fbo
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.
Re: Inconsistent fields for events
Posted: Sun Feb 11, 2018 7:16 pm
by impetus maximus
Re: [0.16.22] Inconsistent fields for events
Posted: Sun Feb 11, 2018 8:49 pm
by Rseding91
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.
Re: [0.16.22] Inconsistent fields for events
Posted: Sun Feb 11, 2018 9:28 pm
by fbo
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
Posted: Mon Feb 12, 2018 12:49 am
by Rseding91
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.
I'm not understanding. The only things you can place in armor is equipment?
Re: [0.16.22] Inconsistent fields for events
Posted: Mon Feb 12, 2018 10:48 pm
by fbo
The thing is: It's not equipment if outside a grid. The API doc for LuaEquipment clearly states:
Note: An equipment reference becomes invalid once the equipment is removed or the equipment grid (see LuaEquipmentGrid) it resides in is destroyed.
Same concept like entities, duh. Just a case of RTFM
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