[WIP] DirectEdit 0.5.0

Discussion in 'Work-In-Progress Mods' started by guest1, February 5, 2015.

  1. eroticburrito

    eroticburrito Post Master General

    Messages:
    1,633
    Likes Received:
    1,836
    Colour patches sound good :)
    guest1 likes this.
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    That can be done with this: http://knockoutjs.com/documentation/textinput-binding.html
    guest1, proeleert and Raevn like this.
  3. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    That isn't working for me in testing. Are you sure textInput is present in PA's version of KnockOut? From what I can tell it's added in KnockOut 3.2.0; PA's ko.version is returning 3.1.0.
  4. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Oh. Okay other method:
    [​IMG]
    When I wrote PA Chat I needed this kind of thing as well and for some reason found this solution before the textinput binding. Like this it definitely works inside PA, the autocomplete names on tab features relies on it.
    guest1 likes this.
  5. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    @cola_colin Yeah, I just tested valueUpdate and it seems to work fine. Thanks!

    While I've got you here, could you help me with a couple other things? I'd like to detect keypresses and use a file selector to grab a file path, but I have no idea how to do either.
  6. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Where do you want to detect keypressed? Everywhere? Then you can do something like
    $(document).keypress(function(e) {console.log(e);})
    If you want to have it work together with the hotkey configuration of PA it will be more complex, I don't know how that works by heart. @proeleert probably is more an expert in that area.

    To open json files:
    api.file.loadDialog().then(function(f) {console.log(f);})

    If the file is not json you will need to fallback to calling the base engine call yourself:
    engine.asyncCall('file.loadDialog', String(undefined)).then(function(raw) { console.log(raw); });

    To save a file:
    api.file.saveDialog("name.json", "some string data");

    I dont think there is a way to get file paths. Only filecontent.
    burntcustard and guest1 like this.
  7. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    New version now available with a few small features and bug fixes.

    Also, here's the Trello I'm using to keep vaguely organized. All the stuff listed there currently will be added or fixed before I put the mod on PAMM.

    I'll give that a shot. I don't need anything fancy, just simple detection.

    I was hoping to be able to get the paths to brush .JSONs with a file selector, since right now typos in the model field will crash PA.
    Last edited: February 9, 2015
  8. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I am not entirely sure, but from a quick look I would guess PA itself uses the file \media\pa\terrain\brush_list.json as the list for all brushes. I guess you could load that file and make a combobox with the json paths. Maybe add an "advanced" option to allow users to enter a path by hand in case the file does not contain it. Though you could also just ask the user to add the path to the file instead.

    Also I think maybe a dev (@masterdigital @jorgenpt @jables) could look into why it crashes when a wrong path to a csg brush in the editor is given. It should handle that issue more gracefully and not just flat out die.

    EDIT:
    Oh another way to get brushs I was using in my hack editor is: Open the biome files of known biomes and grab all brushes you can find from them.
    I found some csg brushes that were not part of the brush list at the time with that. Dunno if they were actually useful or broken. The brushlist might be enough for you.
    guest1 likes this.
  9. Antiglow

    Antiglow Well-Known Member

    Messages:
    342
    Likes Received:
    319
    Not sure if this is a PA thing or something with your mod, but the csg does not seem to be saving for me. Also this really needs a delete all CSG button.
    guest1 likes this.
  10. Tripod27

    Tripod27 Active Member

    Messages:
    185
    Likes Received:
    118
    It's a PA thing, one of your planet settings for height range, water height, water depth, or temperature isn't a whole number (has a decimal with a ton of numbers after it), so you have to edit the .pas file to make it whole or the CFGs won't load

    Also do you put this mod in the client_mods folder or the server_mods folder? I dont have one that just says mods

    EDIT: got it, didn't realize I had to also activate it in PAMM before launching the game
    Last edited: February 10, 2015
    guest1 likes this.
  11. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    I'll give this some thought. There are a few ways we could go here, but I'm concerned in particular with making sure users have access to any brush defined in their directory, whether hidden or mod-created or otherwise.

    Could you give a few more details? If you mean this is happening after you save a system and reopen it, that is a known issue with PA; if you put the map on System Sharing I could try to debug it further.

    Right now the delete button auto-selects the next brush in the list, so you can spam it a bunch and get rid of everything. In future versions you'll be able to double click and select all brushes, which you can then delete in one go.

    If a planet has no CSG at all, though, it will generate it randomly, so you need to have at least one brush present to avoid this.
  12. Antiglow

    Antiglow Well-Known Member

    Messages:
    342
    Likes Received:
    319
    That is so weird, I wonder why it has to be a whole number. Well I guess now I just have to export/import whenever I want to edit a custom system/planet :confused:

    Yeah spamming gets annoying after doing it for 12 planets or so :rolleyes:. But now that I know that you can't have decimals I should not have to do that that much.
    Last edited: February 10, 2015
    guest1 likes this.
  13. Tripod27

    Tripod27 Active Member

    Messages:
    185
    Likes Received:
    118
    in the Properties menu, what do the "no features" and up down buttons do?
    guest1 likes this.
  14. Antiglow

    Antiglow Well-Known Member

    Messages:
    342
    Likes Received:
    319
    I think I am starting to get the hang of it.
    [​IMG]
    [edit] Playtest shows that subtractive brushes or something is needed so that units can pass under the ring :confused:
    Last edited: February 10, 2015
    tesseracta, cdrkf, sierra159 and 3 others like this.
  15. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    For what it's worth, I make sure to set all planet parameters to whole numbers when DirectEdit writes them. I don't know if that fixes the problem for certain (unexpected decimals are one of several reasons this can happen), but I would hope it does, since the entire point of this mod is to avoid having to edit .pas files externally.

    Looks nice!
    Naval units can't path under bridges, but I've found that land units tend to do alright. If you need to debug your pathfinding, you can start a game and then turn the pathing visualizer on; I think the default hotkey is ctrl-shift-f11. Red boxes will appear on unpathable surfaces.

    no_features is meant to prevent feature objects like trees and metal spots from appearing on CSG brushes, but it is currently non-functional. That's a PA bug, not a mod bug. (@jables)

    The up/down buttons change the selected brush's position in the list. This can be important, since brushes are applied sequentially to the planet's Constructive Solid Geometry and can therefore act on one another as well as on the heightmap. For instance, a crater will carve away a mountain if the crater is after the mountain in the brush list.
    Last edited: February 10, 2015
    Tripod27 likes this.
  16. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    New version now available: 0.3.0

    Now with multiple brush selection! Use ctrl-click and shift-click to select multiple brushes in the list, and make changes to all of them simultaneously. You can also double-click to select every brush in the list.

    I've also replaced the overwrite function, since the old one occasionally failed to correctly delete planets due to a weird PA quirk. The new function basically clears the system and adds planets back in, so they will appear to unload after writing. I've done a little bit of testing and it seems okay, but let me know you're losing data somewhere.
    Antiglow likes this.
  17. Antiglow

    Antiglow Well-Known Member

    Messages:
    342
    Likes Received:
    319
    [​IMG]
    [​IMG]

    Does not seem like units can't path there, it just seems like they want to go on the ring first. Also projectiles do not fire under it ether, they just hit an invisible wall...
    guest1 likes this.
  18. guest1

    guest1 Active Member

    Messages:
    113
    Likes Received:
    239
    Strange. This may have broken due to the recent pathing optimizations; I'm fairly certain maps like that worked in the past.

    Might be worth starting a bug report thread. @superouman's been having similar issues I think. https://forums.uberent.com/threads/about-tunnels-and-viaducts.67872/
  19. Antiglow

    Antiglow Well-Known Member

    Messages:
    342
    Likes Received:
    319
    figured it out. CSG needs to have mergeable set to true to be able to have units pass under it.
    [edit] play tested again. only bug is as you said naval units can't pass under csg, really annoying.
    Last edited: February 11, 2015
    guest1 likes this.
  20. zihuatanejo

    zihuatanejo Well-Known Member

    Messages:
    798
    Likes Received:
    577
    guest1 likes this.

Share This Page