JamesWilko / Payday-2-BLT-Lua

Mods folder that controls the ingame aspects of the Payday 2 BLT.
MIT License
16 stars 26 forks source link

Regarding Linux compatibility issues #52

Closed RomanHargrave closed 7 years ago

RomanHargrave commented 7 years ago

I have heard from my users that the latest mod manager relies on DB: for images.

Until we can figure out a way to deal with DB, as we did with mod_overrides, I figured that I would drop on to let you know about a BLT4L API feature that might be helpful for compatibility reasons.

When running via BLT4L, scripts can call BLT::PlatformName, which will yield a string describing the platform. For BLT4L, this is linux.

I had added this with the intention that mods that needed windows-only features (DB) could check this to fall back to compatibility or graceful failure (rather than killing the game).

Currently, per blt4l#79, we (really just @dribbleondo) have been unofficially maintaining an even more unofficial base mod fork that disables image loading. While have yet to personally test neither the unofficial fork of, nor the upstream (this) base mod, I think that BLT adopting BLT::PlatformName might help resolve the issues in the interim.

Luffyyy commented 7 years ago

In my opinion the best way to solve it would be the same way BeardLib does it:

function fm:AddFile(ext, path, file)
    if not DB.create_entry then
        BeardLib:log("[ERROR] Cannot add files!")
        return
    end
    --Add check for supported file types (or unsupported) to give warning
    DB:create_entry(ext:id(), path:id(), file)
    local k_ext = ext:key()
    Global.fm.added_files[k_ext] = Global.fm.added_files[k_ext] or {}
    Global.fm.added_files[k_ext][path:key()] = true
end

This way if Overkill ever decides to do support this function in Linux, users in Linux will be able to use the features without needing to update.

RomanHargrave commented 7 years ago

lgtm

ZNixian commented 7 years ago

See #59

JamesWilko commented 7 years ago

I have disabled image loading if DB.create_entry does not exist.