Beta Mod Changes

Discussion in 'Mod Discussions' started by o, September 25, 2013.

  1. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Can't wait to see that code :)
  2. dfanz0r

    dfanz0r Active Member

    Messages:
    150
    Likes Received:
    47
    So im able to access anything within the media folder just fine within javascript code.

    I am refering to things with coui:// directly, and am not using relitive paths which can get extremely confusing. And i would reccomend everyone to start doing this also.

    so for example refering to a mod within the mods folder would be like this coui://ui/mods/modName/mod_file.js, rather than /../../mods/modName/mod_file.js.

    Im thinking people just got confused with the relative url's.

    I hadn't actually tried this for myself until just now, i just took proeleert, and chargrove's word and assumed what they did was correct.

    So far i have tried to access a few shaders, and some of the json files.

    Edit:

    I dont know if this makes a differance, but im currently running the game and the ui debugger in linux.

    This is the code i used to verify it. I had put this in the ui_mod_list.json just because why not :p
    Code:
    var req = new XMLHttpRequest();
    req.open('GET', 'coui://pa/units/land/energy_plant/energy_plant.json', false);
    req.send('');
    var test = JSON.parse(req.responseText);
    
    console.log(test)
    Last edited: December 21, 2013
    proeleert and Raevn like this.
  3. dfanz0r

    dfanz0r Active Member

    Messages:
    150
    Likes Received:
    47
    So today after thinking through something, i had somewhat of a useful idea. Instead of adding an engine callback so we can get loaded mods. Why not just mount the mods folders under /mods/ this would allow us to just load the json files directly.

    Engine callbacks would be a nicer solution though.
  4. chargrove

    chargrove Uber Alumni

    Messages:
    107
    Likes Received:
    350
    Nice job on the lateral thinking! :) I hadn't even considered using the coui links directly, and yes you're right the relative path issue was strictly because using ../ parent directories outside of coui://ui/ was giving me trouble (at least in the little bit of time I've looked at it so far). But the internal file handler didn't have a problem with the above-ui paths, so yeah specifying a coui path directly to coui://pa/ makes a lot sense. Glad it worked! :)
  5. dfanz0r

    dfanz0r Active Member

    Messages:
    150
    Likes Received:
    47
    Ok so yeah its definitely the relitive pathing causing the issue tried using them myself and it caps it all within the ui folder.

    so any idea on how your are going to fix this. Now that you specifically know its the relitive paths. And should a bug tracker entry be made for it?


    Also those engine callbacks for the mod information would be useful here soon ;)
    Last edited: December 21, 2013
  6. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Sweet this works fine :)
    Ok gotta read some JSON now :)
  7. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    Makes sense - the browser apparently considers the first part of the url to be the host.
  8. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    @chargrove
    Will you guys implement a engine hook so we could write to our mod folders ?
    Cause at best html5 let's you write files to a sandbox. Or not at all cause of security reasons
    And that isn't really handy. If we could change json files in our mod folders we could do lovely things :)
    I know there are security implications but that's why I would only allow writing to your own mod folder and only parsable json/papa/ ... modtype files .
  9. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Hmm I could cache the pa stats mod that way.
  10. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    cola_colin likes this.
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Now that is nice.
  12. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    I've been playing around with shadowing and I have a quick question. Does it only work for files in the media/UI folder or can you shadow stuff in, say the media/pa folder? I tried using the structure from an icons mod that shadows in the UI folder to shadow a unit json file in the pa folder but it's not working. Thanks!
  13. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    You can. I put the Linux shader fix in a personal catch-all mod that shadows stuff in media/shaders for example. If you look at the mods, there is always a ui folder in there, which shadows the media/ui folder. Your mods have that too, right? Just create a new folder shaders next to it and then files in there should shadow files from media/shaders.
  14. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Thanks! I guess the empty UI folder makes all the difference.
  15. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    Oh, you mean it doesn't work without an ui folder being there? That's really odd.
  16. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Yep. Well thanks to you I just finished my stargate bug fix mod. :D You can check it out in my sig if you're interested.
  17. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    @chargrove, @masterdigital :
    API Request : getKeyboardLayout()
    This can't be done in javascript / would help me a lot :)
    I know you need to do it crossplatform so could be a bitch.
  18. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Maybe you can just ask the user for it?
  19. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Yeah I might do that.
  20. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361

Share This Page