Finding blocks by tags. Distributing blocks separately.

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    I would like StarMade being able to use text files like



    "salvage-computer.txt" =
    {Block Tags Separated By Priority =
    front | state false [, state true] | step 0 [, step 1, step 2, step 3]
    [, rear, right, left, top, bottom] }​
    next to "salvage-computer.png/tga" = {Textures in that order} to overwrite loaded textures from a default pack.

    (It could create cache-files storing generated textures...) and only overwrite again if "salvage-computer.txt" or "salavage-computer.png/tga" has changed (timestamp, filesize, hash)

    Example text-files:
    1. My hard black hull =
      • {"black hull hardened = front, rear, top, bottom, left, right"} -- automatically sorted to what the block config wants.
    2. Awesome lava =
      • {"lava = step 1, step 2, step 3, step 4"}
    3. Name needs to be equal to PNG =
      • {"activation module = state false, state true"} -- first is default - possible?
    Does need only minor performance optimizations such as:
    1. search most often used tag (may be "hull"), then split by (has hull | does not have hull) repeat until repeated-tag-count of one sub-group is <5


    str.toLowerCase(), str.split("[=]"), str.split("[,]+"), str.split("[ \n\t]+") = CASE insensitive, split equal, comma, space in that order.
    1. ignore CaSe
    2. blockTags, config = split content at first equal char
    3. tiles[1..x] = split config at each comma char
    4. face, case = split tiles at space chars
    Now players could distribute their per-block textures individually. And you can install textures without having to edit the files.


    ----------


    Finding blocks by tags:
    1. matched blocks : choose by most tags
      • "black hull hardened" should match "hull black" only if "hardened hull (black)" is not available
    2. if there are still >1 choices, use "most matched letters" == "shortest name" or "lowest word-count" as filter:
      • "lava" should match "Lava", not "Black Lava"
    3. A tag should match a word if both share the same letters at start until one of both has no more letters.

    Also usable ingame {"/give Player "dad black hull **** the ID" 1"} would still work.