Keep refnum when moving objects to/from inventory (partially resolves #6148)
Changes:
- Picking up an item preserves RefNum and Lua scripts if the item is not stacked. It means that references to the item in Lua scripts remain valid.
- Dropping an item from inventory to the world via Lua (
obj:teleport) preserves RefNum and Lua scripts.
Note: Dropping an item via GUI still creates a copy and generates a new RefNum. I didn't change it yet, because I afraid to break something. - Fixed a bug that after copying an object (e.g. by dropping to the ground) the new object was linked to the Lua scripts of the old object.
Edited by Petr Mikheev