I've modded the module files (i.e. .../game/modules/tome.team), but can you mod the "engine" files as well? (.../game/engines/te4-1.5.5.teae)
If so, can you simply overload or superload files like you can in the /modules/ folder, or does it require something more in-depth like hooks?
Possible to mod the "engine" files, or just the modules
Moderator: Moderator
Re: Possible to mod the "engine" files, or just the modules
You can modify engine components. The base game module actually does this in a few places.
However to do it, you need to overwrite the specific functions, so a simple overload or superload won't work.
However to do it, you need to overwrite the specific functions, so a simple overload or superload won't work.
My feedback meter decays into coding. Give me feedback and I make mods.
Re: Possible to mod the "engine" files, or just the modules
Superloading and overloading work fine with engine files.
Re: Possible to mod the "engine" files, or just the modules
...how do you do that?
(Not that you should as its bad and evil and naughty.)
(Not that you should as its bad and evil and naughty.)
My feedback meter decays into coding. Give me feedback and I make mods.
Re: Possible to mod the "engine" files, or just the modules
The exact same way you do it with other files. For example, here's superload/engine/interface/WorldAchievements.lua from my Quiet Achievements addon:
Code: Select all
local _M = loadPrevious(...)
function _M:showAchievement()
-- do nothing
end
function _M:gainPersonalAchievement(silent, id, src, ...)
local a = self.achiev_defs[id]
-- World achievements can not be gained multiple times
if a.mode == "world" then return end
if src.resolveSource then src = src:resolveSource() end
src.achievements = src.achievements or {}
if src.achievements[id] then return end
src.achievements[id] = {turn=game.turn, who=self:achievementWho(src), when=os.date("%Y-%m-%d %H:%M:%S")}
if not silent then
local color = a.huge and "GOLD" or "LIGHT_GREEN"
game.log("#"..color.."#Personal New Achievement: %s!", a.name)
self:showAchievement("Personal New Achievement: #"..color.."#"..a.name, a)
-- only addon change: respect option and no_chat_broadcast flag
if not (config.settings.tome.no_achievement_announce or a.no_chat_broadcast) then profile.chat:achievement(a.name, a.huge, false) end
end
if a.on_gain then a:on_gain(src, true) end
return true
end
local base_gainAchievement = _M.gainAchievement
function _M:gainAchievement(id, src, ...)
local isNormallySilent = self.achiev_defs[id].no_chat_broadcast
if (not isNormallySilent) and config.settings.tome.no_achievement_announce then
self.achiev_defs[id].no_chat_broadcast = true
end
local rval = base_gainAchievement(self, id, src, ...)
self.achiev_defs[id].no_chat_broadcast = isNormallySilent
return rval
end
return _M
Re: Possible to mod the "engine" files, or just the modules
Interesting. I didn't realise it worked for engine files like that.
My feedback meter decays into coding. Give me feedback and I make mods.
Re: Possible to mod the "engine" files, or just the modules
Thank you all for the replies - this is very helpful!