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

Game log now has a nice little icon for the source of damage kills & tooltips

Message log now also has entity icons, tooltips and for actors you can right click them to fully inspect


git-svn-id: http://svn.net-core.org/repos/t-engine4@6052 51575b47-30f0-44d4-a5cc-537603b46e54
parent 14074dbd
No related branches found
No related tags found
No related merge requests found
......@@ -479,3 +479,8 @@ function _M:isNear(x, y, radius)
return true
end
--- Return the kind of the entity
function _M:getEntityKind()
return "actor"
end
......@@ -883,3 +883,8 @@ function _M:loadList(file, no_default, res, mod, loaded)
return res
end
--- Return the kind of the entity
function _M:getEntityKind()
return "entity"
end
......@@ -42,3 +42,9 @@ function _M:setupMinimapInfo(mo, map)
else mo:minimap(0, 0, 0)
end
end
--- Return the kind of the entity
function _M:getEntityKind()
return "grid"
end
......@@ -239,3 +239,8 @@ function _M:getMapStackMO(map, x, y)
return _mo
end
--- Return the kind of the entity
function _M:getEntityKind()
return "object"
end
......@@ -306,3 +306,8 @@ function _M:makeHoming(src, display, def, target, count, on_move, on_hit)
return p
end
--- Return the kind of the entity
function _M:getEntityKind()
return "projectile"
end
......@@ -159,3 +159,8 @@ end
function _M:canTrigger(x, y, who)
return true
end
--- Return the kind of the entity
function _M:getEntityKind()
return "trap"
end
......@@ -1052,9 +1052,9 @@ function _M:displayDelayedLogDamage()
for src, tgts in pairs(self.delayed_log_damage) do
for target, dams in pairs(tgts) do
if #dams.descs > 1 then
self.logSeen(target, "%s hits %s for %s damage (total %0.2f).", src.name:capitalize(), target.name, table.concat(dams.descs, ", "), dams.total)
self.logSeen(target, "%s%s hits %s for %s damage (total %0.2f).", src:getDisplayString(), src.name:capitalize(), target.name, table.concat(dams.descs, ", "), dams.total)
else
self.logSeen(target, "%s hits %s for %s damage.", src.name:capitalize(), target.name, table.concat(dams.descs, ", "))
self.logSeen(target, "%s%s hits %s for %s damage.", src:getDisplayString(), src.name:capitalize(), target.name, table.concat(dams.descs, ", "))
end
local rsrc = src.resolveSource and src:resolveSource() or src
......@@ -1064,7 +1064,7 @@ function _M:displayDelayedLogDamage()
if target.dead then
if self.level.map.seens(x, y) and (rsrc == self.player or rtarget == self.player or self.party:hasMember(rsrc) or self.party:hasMember(rtarget)) then
self.flyers:add(sx, sy, 30, (rng.range(0,2)-1) * 0.5, rng.float(-2.5, -1.5), ("Kill (%d)!"):format(dams.total), {255,0,255}, true)
game.logSeen(target, "#{bold}#%s killed %s!#{normal}#", src.name:capitalize(), target.name)
game.logSeen(target, "#{bold}#%s%s killed %s!#{normal}#", src:getDisplayString(), src.name:capitalize(), target.name)
end
else
if self.level.map.seens(x, y) and (rsrc == self.player or self.party:hasMember(rsrc)) then
......
......@@ -17,6 +17,8 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
bx = x or 0
by = y or 0
local nb = 0
return { generator = function()
local radius = radius
......@@ -35,8 +37,8 @@ return { generator = function()
life = 30,
size = 3, sizev = 0, sizea = 0,
x = x, xv = 0, xa = 0,
y = y, yv = 0, ya = 0,
x = bx + x, xv = 0, xa = 0,
y = by + y, yv = 0, ya = 0,
dir = a, dirv = 0, dira = 0,
vel = sradius / 2 / 30, velv = 0, vela = 0,
......
......@@ -19,6 +19,8 @@
base_size = 32
x = x or 0
y = y or 0
local nb = 0
return { generator = function()
......@@ -29,8 +31,8 @@ return { generator = function()
life = life,
size = fs, sizev = 0, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
x = x, xv = 0, xa = 0,
y = y, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
......
......@@ -330,7 +330,17 @@ newTalent{
no_npc_use = true,
no_unlearn_last = true,
action = function(self, t)
for i = 1, 5 do
local rad = rng.float(0.5, 1)
local bx = rng.range(-24, 24)
local by = rng.range(-24, 24)
if core.shader.active(4) then game.level.map:particleEmitter(self.x, self.y, 1, "shader_ring", {radius=rad * 2, life=12, x=bx, y=by}, {type="sparks", zoom=1, time_factor=400, hide_center=0, color1={0.6, 0.3, 0.8, 1}, color2={0.8, 0, 0.8, 1}})
else game.level.map:particleEmitter(self.x, self.y, 1, "generic_ball", {rm=150, rM=180, gm=20, gM=60, bm=180, bM=200, am=80, aM=150, radius=rad, x=bx, y=by})
end
end
game:playSoundNear(self, "talents/arcane")
return true
end,
info = [[Use 10 Fortress energy to send a powerful blast to the ground, directly below the Fortress, heavily damaging any creatures caught inside.]]
......
......@@ -114,22 +114,57 @@ function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event)
elseif button == "wheeldown" and event == "button" then self.key:triggerVirtual("MOVE_DOWN")
else
if not self.dlist then return end
local citem = nil
local citem, gitem = nil, nil
for i = #self.dlist, 1, -1 do
local item = self.dlist[i]
if item.dh and by >= item.dh then citem = self.dlist[i].src break end
if item.dh and by >= item.dh then citem = self.dlist[i].src gitem = self.dlist[i].d break end
end
if event == "motion" then
local tooltip = nil
if citem and citem.extra_data and citem.extra_data.mode == "tooltip" then
game:tooltipDisplayAtMap(game.w, game.h, citem.extra_data.tooltip)
tooltip = citem.extra_data.tooltip
tooltip = tooltip:toTString()
end
if gitem then
local sub_es = {}
for di = 1, #gitem._dduids do sub_es[#sub_es+1] = gitem._dduids[di].e end
if sub_es and #sub_es > 0 then
if not tooltip then tooltip = tstring{} end
for i, e in ipairs(sub_es) do
if e.tooltip then
tooltip:merge(e:tooltip())
if e:getEntityKind() == "actor" then tooltip:add(true, "Right click to inspect.", true) end
if i < #sub_es then tooltip:add(true, "---", true)
else tooltip:add(true) end
end
end
end
end
if tooltip then
game:tooltipDisplayAtMap(game.w, game.h, tooltip)
else
game.tooltip_x, game.tooltip_y = nil, nil
end
elseif event == "button" and button == "left" then
if citem and citem.url then
elseif event == "button" then
if citem and citem.url and button == "left" then
util.browserOpenUrl(citem.url)
end
if gitem and button == "right" then
local sub_es = {}
for di = 1, #gitem._dduids do sub_es[#sub_es+1] = gitem._dduids[di].e end
if sub_es and #sub_es > 0 then
if not tooltip then tooltip = tstring{} end
for i, e in ipairs(sub_es) do
if e:getEntityKind() == "actor" then
game:registerDialog(require("mod.dialogs.CharacterSheet").new(e))
end
end
end
end
end
end
end
......@@ -184,7 +219,7 @@ function _M:setScroll(i)
local stop = false
local tstr = self.lines[z]
if not tstr then break end
local gen = self.font:draw(tstr.str, self.iw - 10, 255, 255, 255)
local gen = self.font:draw(tstr.str, self.iw - 10, 255, 255, 255, false, true)
for i = 1, #gen do
self.dlist[#self.dlist+1] = {d=gen[i], src=self.lines[z].src}
nb = nb + 1
......@@ -201,6 +236,9 @@ function _M:innerDisplay(x, y, nb_keyframes, tx, ty)
local item = self.dlist[i].d
if self.shadow then item._tex:toScreenFull(x+2, h+2, item.w, item.h, item._tex_w, item._tex_h, 0,0,0, self.shadow) end
item._tex:toScreenFull(x, h, item.w, item.h, item._tex_w, item._tex_h)
for di = 1, #item._dduids do item._dduids[di].e:toScreen(nil, x + item._dduids[di].x, h, item._dduids[di].w, item._dduids[di].w, 1) end
self.dlist[i].dh = h - y
-- print("<<",i,"::",h + ty)
h = h + self.font_h
......
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