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

Wands can be correctly hotkeyed

Wands work after a reload


git-svn-id: http://svn.net-core.org/repos/t-engine4@1482 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3a0d2683
No related branches found
No related tags found
No related merge requests found
......@@ -101,10 +101,10 @@ function _M:display()
color = {0,255,0}
end
elseif ts[3] == "inventory" then
local o = a:findInAllInventories(ts[1])
local o = a:findInAllInventories(ts[1], {no_add_name=true, force_id=true, no_count=true})
local cnt = 0
if o then cnt = o:getNumber() end
txt = ("%s (%d)"):format(ts[1], cnt)
txt = ("%s (%d)"):format(o:getName{no_count=true}, cnt)
if cnt == 0 then
color = {128,128,128}
end
......
......@@ -129,8 +129,8 @@ function _M:defineHotkey(id)
end
if not item or not item.object then return end
self.actor.hotkey[id] = {"inventory", item.object:getName{no_count=true}}
self:simplePopup("Hotkey "..id.." assigned", item.object:getName{no_count=true}:capitalize().." assigned to hotkey "..id)
self.actor.hotkey[id] = {"inventory", item.object:getName{no_add_name=true, no_count=true}}
self:simplePopup("Hotkey "..id.." assigned", item.object:getName{no_add_name=true, no_count=true}:capitalize().." assigned to hotkey "..id)
self.actor.changed = true
end
......
......@@ -167,7 +167,7 @@ function _M:getName(t)
return self:descAttribute(attr)
end)
if self.add_name and self:isIdentified() then
if not t.no_add_name and self.add_name and self:isIdentified() then
name = name .. self.add_name:gsub("#([^#]+)#", function(attr)
return self:descAttribute(attr)
end)
......
......@@ -488,7 +488,7 @@ function _M:hotkeyInventory(name)
local find = function(name)
local os = {}
for inven_id, inven in pairs(self.inven) do
local o, item = self:findInInventory(inven, name, getname)
local o, item = self:findInInventory(inven, name, {no_count=true, force_id=true, no_add_name=true})
if o and item then os[#os+1] = {o, item, inven_id, inven} end
end
if #os == 0 then return end
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local DamageType = require "engine.DamageType"
newEntity{
name = "solid ", prefix=true,
level_range = {1, 50},
......@@ -64,7 +62,7 @@ newEntity{
cost_per_charge = 0.4,
use_power = { name = "light the area", power = 3, use = function(self, who)
who:project({type="ball", range=0, friendlyfire=true, radius=15}, who.x, who.y, engine.DamageType.LITE, 1)
who:project({type="ball", range=0, friendlyfire=true, radius=15}, who.x, who.y, engine.engine.DamageType.LITE, 1)
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
end}
......@@ -149,7 +147,7 @@ newEntity{
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local dam = (40 + who:getMag(20)) * self.material_level
who:project(tg, x, y, DamageType.LIGHTNING, rng.avg(dam / 3, dam, 3))
who:project(tg, x, y, engine.DamageType.LIGHTNING, rng.avg(dam / 3, dam, 3))
local _ _, x, y = who:canProject(tg, x, y)
game.level.map:particleEmitter(who.x, who.y, math.max(math.abs(x-who.x), math.abs(y-who.y)), "lightning", {tx=x-who.x, ty=y-who.y})
game:playSoundNear(who, "talents/lightning")
......@@ -169,7 +167,7 @@ newEntity{
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local dam = (35 + who:getMag(20)) * self.material_level
who:project(tg, x, y, DamageType.FIRE, dam, {type="flame"})
who:project(tg, x, y, engine.DamageType.FIRE, dam, {type="flame"})
game:playSoundNear(who, "talents/fire")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
......@@ -187,7 +185,7 @@ newEntity{
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local dam = (80 + who:getMag(50)) * self.material_level
who:project(tg, x, y, DamageType.HEAL, dam)
who:project(tg, x, y, engine.DamageType.HEAL, dam)
game:playSoundNear(who, "talents/heal")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
......
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