Page 1 of 1
Possible to mod the "engine" files, or just the modules
Posted: Sun Nov 26, 2017 8:26 pm
by Denigrate
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?
Re: Possible to mod the "engine" files, or just the modules
Posted: Sun Nov 26, 2017 10:50 pm
by HousePet
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.
Re: Possible to mod the "engine" files, or just the modules
Posted: Mon Nov 27, 2017 5:09 am
by minmay
Superloading and overloading work fine with engine files.
Re: Possible to mod the "engine" files, or just the modules
Posted: Mon Nov 27, 2017 7:24 am
by HousePet
...how do you do that?
(Not that you should as its bad and evil and naughty.)
Re: Possible to mod the "engine" files, or just the modules
Posted: Mon Nov 27, 2017 6:57 pm
by minmay
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
Posted: Tue Nov 28, 2017 1:08 am
by HousePet
Interesting. I didn't realise it worked for engine files like that.
Re: Possible to mod the "engine" files, or just the modules
Posted: Thu Nov 30, 2017 9:02 pm
by Denigrate
Thank you all for the replies - this is very helpful!