package ItemObject import public Escaper /** Abstract class for Entities that are items like Keys, Coins, etc. */ class ItemEntityBridge extends UnitEntity ItemObject obj construct(unit setup, ItemObject obj, vec2 pos) super(setup) this.obj = obj actor..addAbility(GHOST_VIS_ID)..setXY(pos) override function serialize() returns Json return obj.serialize() ondestroy obj.terminate() public abstract class ItemObject extends ItemEntity ItemEntityBridge setup UnitEntity holder = null construct(vec2 pos, item i, unit setup) super(i, setup.getOwner()) this.setup = new ItemEntityBridge(setup, this, pos) override function onUse(UnitEntity user) override function onPickup(UnitEntity holder) override function onDrop(UnitEntity e) ondestroy setup.terminate()