restore set outfit

This commit is contained in:
Henrique Santiago
2012-01-03 18:41:00 -02:00
parent 26800dfe2a
commit 01a2e3a636
9 changed files with 60 additions and 39 deletions

View File

@@ -15,4 +15,5 @@ Module
onLoad: |
require 'game'
return true
require 'thing'
return true

19
modules/game/thing.lua Normal file
View File

@@ -0,0 +1,19 @@
-- public functions
function Thing:createMenu(menuPosition)
local menu = createWidget('PopupMenu')
menu:addOption('Look', function() Game.look(self) end)
-- Open or Use, depending if thing is a container
if self:isContainer() then
menu:addOption('Open', function() print('open') end)
else
menu:addOption('Use', function() print('use') end)
end
if self:asLocalPlayer() then
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
end
menu:display(menuPosition)
end

View File

@@ -35,20 +35,7 @@ function Inventory.onInventoryItemMousePress(itemWidget, mousePos, mouseButton)
local item = itemWidget:getItem()
if not item then return end
local menu = createWidget('PopupMenu')
-- Look
local itemId = item:getId()
local slotId = tonumber(itemWidget:getId():sub(5))
menu:addOption('Look', function() Game.lookAtInventory(itemId, slotId) end)
-- Open or Use, depending if thing is a container
if item:isContainer() then
menu:addOption('Open', function() print('open') end)
else
menu:addOption('Use', function() print('use') end)
end
menu:display(mousePos)
item:createMenu(mousePos)
end
connect(Game, { onLogin = Inventory.create,