Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hard-coded Steam CDN URLs with Asset "Keys" #487

Open
matanlurey opened this issue Oct 16, 2021 · 0 comments
Open

Replace hard-coded Steam CDN URLs with Asset "Keys" #487

matanlurey opened this issue Oct 16, 2021 · 0 comments
Labels
🔨 development priority 2: soon Not tied to a specific release, but important.
Projects
Milestone

Comments

@matanlurey
Copy link
Collaborator

Based on an idea by @dicewrench, would close #342.


Right now we directly refer to assets by the (steam) CDN URL:

templateInfo.speed3 = "http://cdn.steam.com/some/random/1234/url"

This is all fine and dandy, but if that URL is ever deleted (it happens!), the mod is effectively broken until it's re-published.

What if instead, we published an assets.json file:

{
  "speed3": "http://cdn.steam.com/some/random/1234/url"
}

And we referred to stuff indirectly, i.e.

_G.assets = {}

function getAsset(name)
  return _G._assets[name]
end

templateInfo.speed3 = getAsset("speed3")

This would be quite simple (programming wise, at least), and we could add tests to make sure that new URLs are never (directly) added to the mod. One big downside is that getAsset could never be called before the JSON file is downloaded, which means we'd have to be very careful with onLoad() code:

function onLoad()
  spawnModel({
    -- Error: assets.json has not been downloaded yet.
    mesh = getAsset("oneMeshyBoi")
  })
end
@matanlurey matanlurey added priority 2: soon Not tied to a specific release, but important. 🔨 development labels Oct 16, 2021
@matanlurey matanlurey added this to the v7 milestone Oct 16, 2021
@matanlurey matanlurey added this to To do in V7 Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 development priority 2: soon Not tied to a specific release, but important.
Projects
V7
To do
Development

No branches or pull requests

1 participant