2012-01-03 21:41:00 +01:00
|
|
|
|
|
|
|
-- public functions
|
2012-01-04 14:02:35 +01:00
|
|
|
function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
2012-01-03 21:41:00 +01:00
|
|
|
local menu = createWidget('PopupMenu')
|
2012-01-04 14:02:35 +01:00
|
|
|
|
|
|
|
if lookThing then
|
|
|
|
menu:addOption('Look', function() Game.look(lookThing) end)
|
|
|
|
end
|
2012-01-03 21:41:00 +01:00
|
|
|
|
|
|
|
-- Open or Use, depending if thing is a container
|
2012-01-04 14:02:35 +01:00
|
|
|
if useThing then
|
|
|
|
if useThing:isContainer() then
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addOption('Open', function() print('open') end)
|
|
|
|
else
|
2012-01-04 14:02:35 +01:00
|
|
|
if useThing:isMultiUse() then
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addOption('Use with ...', function() print('use with...') end)
|
|
|
|
else
|
2012-01-04 14:02:35 +01:00
|
|
|
menu:addOption('Use', function() Game.use(useThing) end)
|
2012-01-03 23:27:31 +01:00
|
|
|
end
|
|
|
|
end
|
2012-01-04 14:02:35 +01:00
|
|
|
|
|
|
|
if useThing:isRotateable() then
|
|
|
|
menu:addOption('Rotate', function() Game.rotate(useThing) end)
|
2012-01-03 23:27:31 +01:00
|
|
|
end
|
2012-01-04 14:02:35 +01:00
|
|
|
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addSeparator()
|
2012-01-04 14:02:35 +01:00
|
|
|
|
|
|
|
if not useThing:isNotMoveable() and useThing:isPickupable() then
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addOption('Trade with ...', function() print('trade with') end)
|
|
|
|
end
|
2012-01-04 14:02:35 +01:00
|
|
|
end
|
2012-01-03 23:27:31 +01:00
|
|
|
|
2012-01-04 14:02:35 +01:00
|
|
|
if creatureThing then
|
2012-01-03 21:41:00 +01:00
|
|
|
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addSeparator()
|
|
|
|
|
2012-01-04 14:02:35 +01:00
|
|
|
if creatureThing:asLocalPlayer() then
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
|
|
|
|
else
|
|
|
|
-- todo: check for stop attack/follow
|
2012-01-04 14:02:35 +01:00
|
|
|
menu:addOption('Attack', function() Game.attack(creatureThing) end)
|
|
|
|
menu:addOption('Follow', function() Game.follow(creatureThing)end)
|
2012-01-03 23:27:31 +01:00
|
|
|
|
2012-01-04 14:02:35 +01:00
|
|
|
if creatureThing:asPlayer() then
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addSeparator()
|
2012-01-04 14:02:35 +01:00
|
|
|
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
|
2012-01-04 15:30:28 +01:00
|
|
|
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
|
2012-01-04 14:02:35 +01:00
|
|
|
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
|
2012-01-03 23:27:31 +01:00
|
|
|
menu:addOption('Invite to Party', function() print('invite to party') end)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
menu:addSeparator()
|
|
|
|
menu:addOption('Copy Name', function() print('copy name') end)
|
|
|
|
|
2012-01-03 21:41:00 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
menu:display(menuPosition)
|
|
|
|
end
|