Skip to content
Snippets Groups Projects
Commit 71110953 authored by dg's avatar dg
Browse files

Items in the transmo chest will appear with a greenish background in the inventory

git-svn-id: http://svn.net-core.org/repos/t-engine4@5291 51575b47-30f0-44d4-a5cc-537603b46e54
parent bfd6c6f8
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ function _M:init(t)
self.on_select_tab = t.select_tab
self.on_drag = t.on_drag
self.on_drag_end = t.on_drag_end
self.special_bg = t.special_bg
if self.tabslist == nil and self.default_tabslist then
if type(self.default_tabslist) == "function" then self.tabslist = self.default_tabslist(self)
......@@ -250,7 +251,7 @@ function _M:generateList(no_update)
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), sortname=o:getName():toString():removeColorCodes(), color=o:getDisplayColor(), object=o, inven=self.actor.INVEN_INVEN, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
list[#list+1] = { id=#list+1, char=char, name=o:getName(), sortname=o:getName():toString():removeColorCodes(), color=o:getDisplayColor(), object=o, inven=self.actor.INVEN_INVEN, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc(), special_bg=self.special_bg }
chars[char] = #list
i = i + 1
end
......
......@@ -65,6 +65,7 @@ function _M:init(t)
col.surface = core.display.newSurface(col.width, self.fh)
col.frame = self:makeFrame(nil, col.width, self.fh)
col.frame_special = self:makeFrame("ui/selector", col.width, self.fh)
col.frame_sel = self:makeFrame("ui/selector-sel", col.width, self.fh)
col.frame_usel = self:makeFrame("ui/selector", col.width, self.fh)
col.frame_col = self:makeFrame("ui/heading", col.width, self.fh)
......@@ -326,6 +327,15 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
if item.focus_decay <= 0 then item.focus_decay = nil end
end
end
if item.special_bg then
local c = item.special_bg
if type(c) == "function" then c = c(item) end
if c then
self:drawFrame(col.frame_special, x, y, c.r, c.g, c.b, c.a or 1)
end
end
if col.direct_draw then
col.direct_draw(item, x, y, col.fw, self.fh)
elseif item._tex then
......
......@@ -54,8 +54,7 @@ Fillarel: "You! @playerdescriptor.race@! Help me defeat this monster or begone!"
Krogar: "Ah, looking for help? Bah. @playerdescriptor.race@, kill this wench for me and I shall reward you!"]],
answers = {
{"[attack Krogar]", action=attack_krogar},
-- Not available yet
-- {"[attack Fillarel]", action=attack_fillarel},
{"[attack Fillarel]", action=attack_fillarel, cond=function(npc, player) return not player:hasQuest("start-sunwall") and config.settings.cheat end},
}
}
return "welcome"
......@@ -67,6 +67,7 @@ function _M:init(title, actor, filter, action, on_select)
select_tab=function(item) self:select(item) end,
on_drag=function(item) self:onDrag(item) end,
on_drag_end=function() self:onDragTakeoff() end,
special_bg=function(item) if item.object and item.object.__transmo then return colors.GOLD end end,
}
local uis = {
......@@ -181,7 +182,7 @@ function _M:updateTitle(title)
end
function _M:onDrag(item)
if item and item.object and not item.object.__transmo then
if item and item.object then
local s = item.object:getEntityFinalSurface(nil, 64, 64)
local x, y = core.mouse.get()
game.mouse:startDrag(x, y, s, {kind="inventory", item_idx=item.item, inven=item.inven, object=item.object, id=item.object:getName{no_add_name=true, force_id=true, no_count=true}}, function(drag, used)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment