Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • amagad/t-engine4
  • HirumaKai/t-engine4
  • Hogulus/t-engine4
  • Inkie/t-engine4
  • Liberty/t-engine4
  • Lokean/t-engine4
  • Mawootad/t-engine4
  • Michelle/t-engine4
  • MrFrog/t-engine4
  • Nagyhal/t-engine4
  • Recaiden/t-engine4
  • RootOfAllThings/t-engine4
  • Sebsebeleb/t-engine4
  • Sheila/t-engine4
  • Shibari/t-engine4
  • Stof/t-engine4
  • Umbral/t-engine4
  • tome/t-engine4
  • 0player/t-engine4
  • BreezyIdiot/t-engine4
  • Bunny/t-engine4
  • Effigy/t-engine4
  • Hachem_Muche/t-engine4
  • razakai/t-engine4
  • Zireael/t-engine4
  • cinornu/t-engine4
  • edge2054/t-engine4
  • gordaxx727/t-engine4
  • grayswandir/t-engine4
  • helminthauge/t-engine4
  • housepet/t-engine4
  • minqmay/t-engine4
  • nsrr/t-engine4
  • orange/t-engine4
  • otowakotori/t-engine4
  • purequestion/t-engine4
  • rexorcorum/t-engine4
  • rgeens/t-engine4
  • sageacrin/t-engine4
  • stuntofthelitter/t-engine4
  • tiger_eye/t-engine4
  • xelivous/t-engine4
  • yutio888/t-engine4
43 results
Show changes
Commits on Source (21)
Showing
with 128 additions and 19 deletions
...@@ -739,6 +739,8 @@ function _M:scan(dir, radius, sx, sy, filter, kind) ...@@ -739,6 +739,8 @@ function _M:scan(dir, radius, sx, sy, filter, kind)
sy = sy or self.target.y sy = sy or self.target.y
if not sx or not sy then return end if not sx or not sy then return end
if not filter and self.target_type and self.target_type.custom_scan_filter then filter = self.target_type.custom_scan_filter end
kind = kind or engine.Map.ACTOR kind = kind or engine.Map.ACTOR
radius = radius or 20 radius = radius or 20
local actors = {} local actors = {}
......
...@@ -165,6 +165,15 @@ function _M:activateHotkey(id) ...@@ -165,6 +165,15 @@ function _M:activateHotkey(id)
end end
end end
--- Grabs info of an hotkey
function _M:getHotkeyInfo(id)
if self.hotkey[id] then
return self.hotkey[id][1], self.hotkey[id][2]
else
return nil
end
end
--- Activates a hotkey with a type "talent" --- Activates a hotkey with a type "talent"
function _M:hotkeyTalent(tid) function _M:hotkeyTalent(tid)
self:useTalent(tid) self:useTalent(tid)
......
...@@ -61,6 +61,19 @@ function _M:makeData(w, h, fill_with) ...@@ -61,6 +61,19 @@ function _M:makeData(w, h, fill_with)
return data return data
end end
function _M:isEmpty(filled_with)
if not filled_with then filled_with = ' ' end
if not self.data then return true end
for y = 1, self.data_h do
for x = 1, self.data_w do
if self.data[y][x] ~= filled_with then
return false
end
end
end
return true
end
function _M:erase(fill_with) function _M:erase(fill_with)
self.data = self:makeData(self.data_w, self.data_h, fill_with or '#') self.data = self:makeData(self.data_w, self.data_h, fill_with or '#')
end end
...@@ -865,7 +878,11 @@ function _M:fillGroup(group, char) ...@@ -865,7 +878,11 @@ function _M:fillGroup(group, char)
-- print("[Tilemap] Filling group of", #group.list, "with", char) -- print("[Tilemap] Filling group of", #group.list, "with", char)
for j = 1, #group.list do for j = 1, #group.list do
local jn = group.list[j] local jn = group.list[j]
self.data[jn.y][jn.x] = char if type(char) == "function" then
self.data[jn.y][jn.x] = char(jn.x, jn.y, self.data[jn.y][jn.x])
else
self.data[jn.y][jn.x] = char
end
end end
end end
...@@ -1117,8 +1134,10 @@ function _M:merge(x, y, tm, char_order, empty_char) ...@@ -1117,8 +1134,10 @@ function _M:merge(x, y, tm, char_order, empty_char)
self.data[sj][si] = tm.data[j][i] self.data[sj][si] = tm.data[j][i]
end end
else else
if char_order(si, sj, sc, c) then local v = char_order(si, sj, sc, c)
self.data[sj][si] = tm.data[j][i] if v then
if v == true then v = tm.data[j][i] end
self.data[sj][si] = v
end end
end end
end end
......
...@@ -57,6 +57,7 @@ function _M:parseResult(data) ...@@ -57,6 +57,7 @@ function _M:parseResult(data)
x = x + 1 x = x + 1
end end
end end
return true
end end
--- Called by the constructor to actaully start doing stuff --- Called by the constructor to actaully start doing stuff
...@@ -79,7 +80,7 @@ function _M:waitCompute() ...@@ -79,7 +80,7 @@ function _M:waitCompute()
local data = self.async_data:wait() local data = self.async_data:wait()
self.async_data = nil self.async_data = nil
self:parseResult(data) if not self:parseResult(data) then return end
return self:hasResult() return self:hasResult()
end end
...@@ -89,7 +90,7 @@ function _M:waitAll(...) ...@@ -89,7 +90,7 @@ function _M:waitAll(...)
local all_have_data = true local all_have_data = true
for _, wfcasync in ipairs{...} do for _, wfcasync in ipairs{...} do
wfcasync:waitCompute() wfcasync:waitCompute()
if not wfcasync:hasResult() then all_have_data = false end -- We cant break, we need to wait all the threads to not leave them dangling in the wind if not wfcasync:hasResult() or wfcasync:isEmpty() then all_have_data = false end -- We cant break, we need to wait all the threads to not leave them dangling in the wind
end end
return all_have_data return all_have_data
end end
...@@ -1277,6 +1277,51 @@ function string.split(str, char, keep_separator) ...@@ -1277,6 +1277,51 @@ function string.split(str, char, keep_separator)
return lpeg.match(p, str) return lpeg.match(p, str)
end end
-- Returns the Levenshtein distance between the two given strings
function string.levenshtein(str1, str2)
local len1 = string.len(str1)
local len2 = string.len(str2)
local matrix = {}
local cost = 0
-- quick cut-offs to save time
if (len1 == 0) then
return len2
elseif (len2 == 0) then
return len1
elseif (str1 == str2) then
return 0
end
-- initialise the base matrix values
for i = 0, len1, 1 do
matrix[i] = {}
matrix[i][0] = i
end
for j = 0, len2, 1 do
matrix[0][j] = j
end
-- actual Levenshtein algorithm
for i = 1, len1, 1 do
for j = 1, len2, 1 do
if (str1:byte(i) == str2:byte(j)) then
cost = 0
else
cost = 1
end
matrix[i][j] = math.min(matrix[i-1][j] + 1, matrix[i][j-1] + 1, matrix[i-1][j-1] + cost)
end
end
-- return the last value - this is the Levenshtein distance
return matrix[len1][len2]
end
function string.levenshtein_p(str1, str2)
return string.levenshtein(str1, str2) / #str1
end
local hex_to_dec = { local hex_to_dec = {
["0"] = 0, ["0"] = 0,
...@@ -2874,7 +2919,7 @@ function util.findFreeGrid(sx, sy, radius, block, what) ...@@ -2874,7 +2919,7 @@ function util.findFreeGrid(sx, sy, radius, block, what)
end end
end end end end
if #gs == 0 then return nil end if #gs == 0 then return nil, nil, {} end
table.sort(gs, function(a, b) table.sort(gs, function(a, b)
if a[3] == b[3] then if a[3] == b[3] then
......
...@@ -6156,6 +6156,8 @@ function _M:fireTalentCheck(event, ...) ...@@ -6156,6 +6156,8 @@ function _M:fireTalentCheck(event, ...)
self.__object_use_running = tid self.__object_use_running = tid
ret = tid:check(event, self, ...) or ret ret = tid:check(event, self, ...) or ret
self.__object_use_running = nil self.__object_use_running = nil
elseif kind == "self" then
ret = tid.__self_callbacks[event](self, ...) or ret
else else
self.__project_source = self.sustain_talents[tid] self.__project_source = self.sustain_talents[tid]
ret = self:callTalent(tid, event, ...) or ret ret = self:callTalent(tid, event, ...) or ret
...@@ -6202,6 +6204,11 @@ function _M:iterCallbacks(event) ...@@ -6202,6 +6204,11 @@ function _M:iterCallbacks(event)
self.__project_source = old_ps self.__project_source = old_ps
return ret return ret
end, priority, kind end, priority, kind
elseif kind == "self" then
return function(...)
local ret = tid.__self_callbacks[event](self, ...)
return ret
end, priority, kind
else else
return function(...) return function(...)
local old_ps = self.__project_source local old_ps = self.__project_source
......
...@@ -2030,7 +2030,15 @@ function _M:setupCommands() ...@@ -2030,7 +2030,15 @@ function _M:setupCommands()
if self.posteffects and self.posteffects.gestures and self.posteffects.gestures.shad then self.gestures.shader = self.posteffects.gestures.shad end if self.posteffects and self.posteffects.gestures and self.posteffects.gestures.shad then self.gestures.shader = self.posteffects.gestures.shad end
-- Helper function to not allow some actions on the wilderness map -- Helper function to not allow some actions on the wilderness map
local not_wild = function(f, bypass) return function(...) if self.zone and (not self.zone.wilderness or (bypass and bypass())) then f(...) else self.logPlayer(self.player, "You cannot do that on the world map.") end end end local not_wild = function(f, bypass)
return function(...)
if self.zone and (not self.zone.wilderness or (bypass and bypass()))
then f(...)
else
self.logPlayer(self.player, "You cannot do that on the world map.")
end
end
end
-- Debug mode -- Debug mode
self.key:addCommands{ self.key:addCommands{
...@@ -2513,10 +2521,10 @@ do return end ...@@ -2513,10 +2521,10 @@ do return end
end, end,
LUA_CONSOLE = self.key.virtuals.LUA_CONSOLE, LUA_CONSOLE = self.key.virtuals.LUA_CONSOLE,
} }
engine.interface.PlayerHotkeys:bindAllHotkeys(self.key, not_wild(function(i) engine.interface.PlayerHotkeys:bindAllHotkeys(self.key, function(i)
self:targetTriggerHotkey(i) self:targetTriggerHotkey(i)
self.player:activateHotkey(i) self.player:activateHotkey(i)
end, function() return self.player.allow_talents_worldmap end)) end)
self:setupWASD() self:setupWASD()
self.key:setCurrent() self.key:setCurrent()
......
...@@ -911,7 +911,7 @@ end ...@@ -911,7 +911,7 @@ end
local function spotHostiles(self, actors_only) local function spotHostiles(self, actors_only)
local seen = {} local seen = {}
if not self.x then return seen end if not self.x or not game.level then return seen end
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent resting -- Check for visible monsters, only see LOS actors, so telepathy wont prevent resting
core.fov.calc_circle(self.x, self.y, game.level.map.w, game.level.map.h, self.sight or 10, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y) core.fov.calc_circle(self.x, self.y, game.level.map.w, game.level.map.h, self.sight or 10, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
...@@ -1319,6 +1319,20 @@ end ...@@ -1319,6 +1319,20 @@ end
--- Uses an hotkeyed talent --- Uses an hotkeyed talent
-- This requires the ActorTalents interface to use talents and a method player:playerUseItem(o, item, inven) to use inventory objects -- This requires the ActorTalents interface to use talents and a method player:playerUseItem(o, item, inven) to use inventory objects
function _M:activateHotkey(id) function _M:activateHotkey(id)
local kind, tid = self:getHotkeyInfo(id)
if kind == "talent" then
local t = self:getTalentFromId(tid)
if (not t) or (not t.allow_use_worldmap and not self.allow_talents_worldmap and (not game.zone or game.zone.wilderness)) then
game.logPlayer(self, "You cannot do that on the world map.")
return false
end
else
if not game.zone or game.zone.wilderness then
game.logPlayer(self, "You cannot do that on the world map.")
return false
end
end
-- Visual feedback to show whcih key was pressed -- Visual feedback to show whcih key was pressed
if config.settings.tome.visual_hotkeys and game.uiset.hotkeys_display and game.uiset.hotkeys_display.clics and game.uiset.hotkeys_display.clics[id] and self.hotkey[id] then if config.settings.tome.visual_hotkeys and game.uiset.hotkeys_display and game.uiset.hotkeys_display.clics and game.uiset.hotkeys_display.clics[id] and self.hotkey[id] then
local zone = game.uiset.hotkeys_display.clics[id] local zone = game.uiset.hotkeys_display.clics[id]
......
...@@ -318,7 +318,6 @@ function _M:crossTierEffect(eff_id, apply_power, apply_save, use_given_e) ...@@ -318,7 +318,6 @@ function _M:crossTierEffect(eff_id, apply_power, apply_save, use_given_e)
ct_effect = cross_tier_effects[save_for_effects[e.type]] ct_effect = cross_tier_effects[save_for_effects[e.type]]
end end
local dur = self:getTierDiff(apply_power, save) local dur = self:getTierDiff(apply_power, save)
print("!!!!! from", eff_id," =>" , ct_effect, dir, apply_power, save)
self:setEffect(ct_effect, dur, {}) self:setEffect(ct_effect, dur, {})
return ct_effect return ct_effect
end end
......
...@@ -1809,7 +1809,7 @@ function _M:displayHotkeys(scale, bx, by) ...@@ -1809,7 +1809,7 @@ function _M:displayHotkeys(scale, bx, by)
return return
end end
if event == "button" and button == "left" and ((game.zone and game.zone.wilderness and not game.player.allow_talents_worldmap) or (game.key ~= game.normal_key)) then return end -- if event == "button" and button == "left" and ((game.zone and game.zone.wilderness and not game.player.allow_talents_worldmap) or (game.key ~= game.normal_key)) then return end
self.hotkeys_display:onMouse(button, mx, my, event == "button", self.hotkeys_display:onMouse(button, mx, my, event == "button",
function(text) function(text)
text = text:toTString() text = text:toTString()
......
...@@ -95,6 +95,8 @@ newBirthDescriptor{ ...@@ -95,6 +95,8 @@ newBirthDescriptor{
if actor.achievement_data[id] and actor.achievement_data[id].nb > 0 then return true end if actor.achievement_data[id] and actor.achievement_data[id].nb > 0 then return true end
-- Lumberjack massacre -- Lumberjack massacre
if (actor:hasQuest("lumberjack-cursed") and (actor:hasQuest("lumberjack-cursed").lumberjacks_died or 0) >= 20) then return true end if (actor:hasQuest("lumberjack-cursed") and (actor:hasQuest("lumberjack-cursed").lumberjacks_died or 0) >= 20) then return true end
-- Slave arena
if (actor:hasQuest("ring-of-blood") and actor:hasQuest("ring-of-blood"):isStatus(engine.Quest.DONE)) and actor:hasQuest("ring-of-blood"):isCompleted("won-fight") then return true end
return false return false
end, end,
stores_restock_by_level = 1, stores_restock_by_level = 1,
......
...@@ -132,7 +132,7 @@ Good luck in your adventures, and come visit us when you are done! ...@@ -132,7 +132,7 @@ Good luck in your adventures, and come visit us when you are done!
g.name = _t"exit to Derth" g.name = _t"exit to Derth"
game.zone:addEntity(game.level, g, "terrain", player.x, player.y) game.zone:addEntity(game.level, g, "terrain", player.x, player.y)
if game.player:isQuestStatus("arena-unlock", engine.Quest.DONE) then if not game.player:isQuestStatus("arena-unlock", engine.Quest.DONE) then
game.party:reward(_t"Select the party member to receive the +2 generic talent points:", function(player) game.party:reward(_t"Select the party member to receive the +2 generic talent points:", function(player)
player.unused_generics = player.unused_generics + 2 player.unused_generics = player.unused_generics + 2
end) end)
......
...@@ -119,7 +119,7 @@ Please, make sure the world is safe.]], ...@@ -119,7 +119,7 @@ Please, make sure the world is safe.]],
{_t"You will never be forgotten.", action=function(npc, player) {_t"You will never be forgotten.", action=function(npc, player)
local aeryn = aeryn_alive(npc, player) local aeryn = aeryn_alive(npc, player)
game.level:removeEntity(aeryn, true) game.level:removeEntity(aeryn, true)
if p.descriptor.subclass == "Sun Paladin" then if player.descriptor and player.descriptor.subclass == "Sun Paladin" then
game:setAllowedBuild("paladin_fallen", true) game:setAllowedBuild("paladin_fallen", true)
end end
player:hasQuest("high-peak"):win("aeryn-sacrifice") player:hasQuest("high-peak"):win("aeryn-sacrifice")
......
...@@ -56,13 +56,13 @@ setDefaultProjector(function(src, x, y, type, dam, state) ...@@ -56,13 +56,13 @@ setDefaultProjector(function(src, x, y, type, dam, state)
local add_dam = 0 local add_dam = 0
if not src.turn_procs or not src.turn_procs.damage_type_fix_type then if not src.turn_procs or not src.turn_procs.damage_type_fix_type then
if src:attr("all_damage_convert") and src:attr("all_damage_convert_percent") and src.all_damage_convert ~= type then if not src._all_damage_convert_recurs and src:attr("all_damage_convert") and src:attr("all_damage_convert_percent") and src.all_damage_convert ~= type then
local ndam = dam * src.all_damage_convert_percent / 100 local ndam = dam * src.all_damage_convert_percent / 100
dam = dam - ndam dam = dam - ndam
local nt = src.all_damage_convert local nt = src.all_damage_convert
-- src.all_damage_convert = nil src._all_damage_convert_recurs = true
add_dam = DamageType:get(nt).projector(src, x, y, nt, ndam, state) add_dam = DamageType:get(nt).projector(src, x, y, nt, ndam, state)
-- src.all_damage_convert = nt src._all_damage_convert_recurs = nil
if dam <= 0 then return add_dam end if dam <= 0 then return add_dam end
end end
...@@ -4464,7 +4464,9 @@ newDamageType{ ...@@ -4464,7 +4464,9 @@ newDamageType{
if target == src then if target == src then
target:incPositive(2) target:incPositive(2)
elseif target:reactionToward(src) < 0 then elseif target:reactionToward(src) < 0 then
target:setEffect(target.EFF_BLINDING_LIGHT, 1, {src=src, power=dam.dam, apply_power=dam.pow, no_ct_effect=true}) if target:canBe("blind") then
target:setEffect(target.EFF_BLINDING_LIGHT, 1, {src=src, power=dam.dam, apply_power=dam.pow, no_ct_effect=true})
end
DamageType:get(DamageType.LIGHT).projector(src, x, y, DamageType.LIGHT, dam.dam, state) DamageType:get(DamageType.LIGHT).projector(src, x, y, DamageType.LIGHT, dam.dam, state)
end end
end end
......
...@@ -161,6 +161,7 @@ newEntity{ ...@@ -161,6 +161,7 @@ newEntity{
-- add_displays = class:makeWater(true, "poison_"), -- add_displays = class:makeWater(true, "poison_"),
always_remember = true, always_remember = true,
air_level = -5, air_condition="water", air_level = -5, air_condition="water",
special_minimap = colors.DARK_GREEN,
mindam = resolvers.mbonus(10, 25), mindam = resolvers.mbonus(10, 25),
maxdam = resolvers.mbonus(20, 50), maxdam = resolvers.mbonus(20, 50),
......
...@@ -28,7 +28,7 @@ else ...@@ -28,7 +28,7 @@ else
end end
local speed = speed or 0.023 local speed = speed or 0.023
local a = (a or 60) / 255 local a = ((type(a) == "number" and a) or 60) / 255
local basesize = (shader and 1.75 or 1) * 2 * radius * (engine.Map.tile_w + engine.Map.tile_h) / 2 + engine.Map.tile_w * 1.8 * (oversize or 1) local basesize = (shader and 1.75 or 1) * 2 * radius * (engine.Map.tile_w + engine.Map.tile_h) / 2 + engine.Map.tile_w * 1.8 * (oversize or 1)
local appear = appear or 0 local appear = appear or 0
local appear_size = appear_size or 3 local appear_size = appear_size or 3
......
game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png

1.78 KiB | W: 0px | H: 0px

game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png

2.88 KiB | W: 0px | H: 0px

game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_down_tactical_powerful.png
  • 2-up
  • Swipe
  • Onion skin
game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png

1.81 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png

3.2 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png
game/modules/tome/data/gfx/shockbolt/alt_side_tactical_powerful.png
  • 2-up
  • Swipe
  • Onion skin
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png

2.1 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png

5.51 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_back.png
  • 2-up
  • Swipe
  • Onion skin
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png

2.06 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png

5.24 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png
game/modules/tome/data/gfx/shockbolt/npc/boss_indicators/elite_boss_circle_front.png
  • 2-up
  • Swipe
  • Onion skin