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

ESP is only computed when needed

git-svn-id: http://svn.net-core.org/repos/t-engine4@2579 51575b47-30f0-44d4-a5cc-537603b46e54
parent aa5dbb18
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,7 @@ function _M:init(t, no_default)
t.positive_negative_rating = t.positive_negative_rating or 3
t.psi_rating = t.psi_rating or 1
t.esp = t.esp or {range=10}
t.esp = t.esp or {}
t.talent_cd_reduction = t.talent_cd_reduction or {}
......@@ -1961,14 +1961,14 @@ end
function _M:canSeeNoCache(actor, def, def_pct)
if not actor then return false, 0 end
-- ESP, see all, or only types/subtypes
if self:attr("esp") then
local esp = self:attr("esp")
-- Full ESP
if esp.all and esp.all > 0 then
return true, 100
end
-- Full ESP
if self.esp_all and self.esp_all > 0 then
return true, 100
end
-- ESP, see all, or only types/subtypes
if self.esp then
local esp = self.esp
-- Type based ESP
if esp[actor.type] and esp[actor.type] > 0 then
return true, 100
......
......@@ -323,21 +323,21 @@ function _M:getTextualDesc()
desc:add(("Increases damage type: %s."):format(table.concat(rs, ',')), true)
end
local esps = {}
if w.esp_all then esps[#esps+1] = "all" end
if w.esp_range then esps[#esps+1] = "increase range by "..w.esp_range end
if w.esp then
local rs = {}
for type, i in pairs(w.esp) do
if type == "all" then rs[#rs+1] = "all"
elseif type == "range" then rs[#rs+1] = "increase range by "..i
local _, _, t, st = type:find("^([^/]+)/?(.*)$")
if st and st ~= "" then
esps[#esps+1] = st
else
local _, _, t, st = type:find("^([^/]+)/?(.*)$")
if st and st ~= "" then
rs[#rs+1] = st
else
rs[#rs+1] = t
end
esps[#esps+1] = t
end
end
desc:add(("Grants telepathy: %s."):format(table.concat(rs, ',')), true)
end
if #esps > 0 then
desc:add(("Grants telepathy: %s."):format(table.concat(esps, ',')), true)
end
if w.talents_types_mastery then
......
......@@ -284,7 +284,9 @@ function _M:playerFOV()
end
-- Compute ESP FOV, using cache
self:computeFOV(self.esp.range or 10, "block_esp", function(x, y) game.level.map:applyESP(x, y, 0.6) end, true, true, true)
if (self.esp_all and self.esp_all > 0) or next(self.esp) then
self:computeFOV(self.esp_range or 10, "block_esp", function(x, y) game.level.map:applyESP(x, y, 0.6) end, true, true, true)
end
-- Handle Sense spell, a simple FOV, using cache. Note that this means some terrain features can be made to block sensing
if self:attr("detect_range") then
......
......@@ -75,7 +75,7 @@ newEntity{
cost = 25,
wielder = {
life_regen = -3,
esp = {all=1},
esp_all = 1,
},
}
newEntity{
......@@ -85,7 +85,7 @@ newEntity{
rarity = 15,
cost = 15,
wielder = {
esp = {range=10},
esp_range = 10,
},
}
newEntity{
......
......@@ -63,7 +63,7 @@ newEntity{
cost = 25,
wielder = {
life_regen = -3,
esp = {all=1},
esp_all = 1,
},
}
newEntity{
......@@ -73,7 +73,7 @@ newEntity{
rarity = 15,
cost = 15,
wielder = {
esp = {range=10},
esp_range = 10,
},
}
newEntity{
......
......@@ -76,7 +76,7 @@ newEntity{
cost = 25,
wielder = {
life_regen = -3,
esp = {all=1},
esp_all = 1,
},
}
newEntity{
......@@ -86,7 +86,7 @@ newEntity{
rarity = 15,
cost = 15,
wielder = {
esp = {range=10},
esp_range = 10,
},
}
newEntity{
......
......@@ -295,7 +295,7 @@ newEntity{ theme={nature=true}, name="water breathing", points = 10, rarity = 15
wielder = { can_breath = {water=1}, },
}
newEntity{ theme={psionic=true}, name="telepathy", points = 60, rarity = 65, level_range = {1, 50},
wielder = { esp = {all=1}, },
wielder = { esp_all = 1 },
}
newEntity{ theme={psionic=true}, name="orc telepathy", points = 15, rarity = 25, level_range = {1, 50},
wielder = { esp = {["humanoid/orc"]=1}, },
......
......@@ -193,7 +193,7 @@ function _M:use(item)
end
end
self:eidolonPlane()
game.log("#LIGHT_RED#You have %s left.", self.actor:attr("easy_mode_lifes") and (self.actor:attr("easy_mode_lifes").." life(s)" or "no more lifes"))
game.log("#LIGHT_RED#You have %s left.", (self.actor:attr("easy_mode_lifes") and self.actor:attr("easy_mode_lifes").." life(s)") or "no more lifes")
elseif act == "skeleton" then
self.actor:attr("re-assembled", 1)
game.logPlayer(self.actor, "#YELLOW#Your bones magically come back together. You are once more able to dish out pain to your foes!")
......
......@@ -55,13 +55,11 @@ function _M:use(item)
if act == "godmode" then
game.player:forceLevelup(50)
game.player.invulnerable = 1
game.player.esp.all = 1
game.player.esp.range = 50
game.player.esp_all = 1
game.player.esp_range = 50
game.player.no_breath = 1
game.player.invulnerable = 1
game.player.money = 500
game.player.esp.all = 1
game.player.esp.range = 50
game.player.auto_id = 100
game.player.inc_damage.all = 100000
game.player:incStat("str", 100) game.player:incStat("dex", 100) game.player:incStat("mag", 100) game.player:incStat("wil", 100) game.player:incStat("cun", 100) game.player:incStat("con", 100)
......
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