Possible to mod the "engine" files, or just the modules

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Denigrate
Low Yeek
Posts: 7
Joined: Sat Nov 25, 2017 8:54 pm

Possible to mod the "engine" files, or just the modules

#1 Post 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?

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Possible to mod the "engine" files, or just the modules

#2 Post 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.
My feedback meter decays into coding. Give me feedback and I make mods.

minmay
Wyrmic
Posts: 286
Joined: Fri Sep 07, 2012 1:34 am
Contact:

Re: Possible to mod the "engine" files, or just the modules

#3 Post by minmay »

Superloading and overloading work fine with engine files.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Possible to mod the "engine" files, or just the modules

#4 Post by HousePet »

...how do you do that?

(Not that you should as its bad and evil and naughty.)
My feedback meter decays into coding. Give me feedback and I make mods.

minmay
Wyrmic
Posts: 286
Joined: Fri Sep 07, 2012 1:34 am
Contact:

Re: Possible to mod the "engine" files, or just the modules

#5 Post 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

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Possible to mod the "engine" files, or just the modules

#6 Post by HousePet »

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.

Denigrate
Low Yeek
Posts: 7
Joined: Sat Nov 25, 2017 8:54 pm

Re: Possible to mod the "engine" files, or just the modules

#7 Post by Denigrate »

Thank you all for the replies - this is very helpful!

Post Reply