local window = require('window') local entity = require('entity') -- item prototype -- name -- image -- description local m = entity:from{ _t = 'item', width = 60, height = 60, name = "item", description = "sample description", } --[[ Item ]]-- function m:pickupMode() self.mousepressed = window.mousepressed(function (self, x, y, button) self:itemMode() self.room:remove(self) inventory:pickup(self) end) end function m:itemMode() self.mousepressed = window.mousepressed(function (self, x, y, button) log:info(self) inventory.selected_item = self end) end local install = m.install function m:install(room, x, y) self:pickupMode() install(self, room, x, y) end function m:spawn(room, x, y) self:new():install(room, x, y) end return m