cwtools / cwtools-vscode

A VS Code extension providing language server support for paradox script files using cwtools
Other
88 stars 12 forks source link

Blank Scope Context information inside on_actions (HOI4) #92

Open insilications opened 11 months ago

insilications commented 11 months ago

Everything else is working perfectly. It seems that https://github.com/cwtools/cwtools-hoi4-config/blob/master/Config/on_actions.cwt is wrong. I've managed to fix it by changing some aspects of it. I've read the wiki for CWTools (.cwt config file format guidance and architecture). I'm a C/C++ programmer primarily and I like FP, but I'm having a hard time understanding the F# that parses and generates the config rules used by the language server. So I have no idea what is really going on behind my "fix".

As an example of my changes, my modified on_actions.cwt:

Config/on_actions.cwt:

types = {
    type[on_actions] = {
        path = "game/common/on_actions"
        ## type_key_filter = on_nuke_drop
        subtype[on_nuke_drop] = {}
        ## type_key_filter = on_new_term_election
        subtype[on_new_term_election] = {}
    }
}

on_actions = {
    ## replace_scope = { THIS = country ROOT = country FROM = state }
    ## cardinality = 0..1
    on_nuke_drop = {
        ## cardinality = 0..1
        random_events = {
            ## cardinality = 0..inf
            int = 0
            ## cardinality = 0..inf
            int = <event>
        }
        ## cardinality = 0..1
        effect = {
            alias_name[effect] = alias_match_left[effect]
        }
    }

    ## replace_scope = { THIS = country ROOT = country FROM = country }
    ## cardinality = 0..1
    on_new_term_election = {
        ## cardinality = 0..1
        random_events = {
            ## cardinality = 0..inf
            int = 0
            ## cardinality = 0..inf
            int = <event>
        }
        ## cardinality = 0..1
        effect = {
            alias_name[effect] = alias_match_left[effect]
        }
    }
}

The on_actions used inside my mod:

on_actions = {
    on_nuke_drop = {
        effect = {
            FROM = {
                save_event_target_as = the_nuke
                log = "[GetDateText]: Nuke dropped on [This.GetName], controller [This.controller.GetName], dropped by [Root.GetName]"
            }
        }
    }
    on_new_term_election = {
        effect = {
            FROM = {
            }
        }
    }
}

It is even registering the save_event_target_as = the_nuke in the model for proper usage in localisation. In the latest upstream cwtools-hoi4-config, that also was not working properly. 2023-07-19_02-14

In the attached screenshots you can see the the Scope Context information inside on_actions being successfully provided inside both on_nuke_drop and on_new_term_election. 2023-07-19_01-59 2023-07-19_01-59_1

I have no idea what is really going on behind my "fix".

EndsM commented 7 months ago

Yes, I have the same problem, the language suggestion inside on_action/effect is missing. Without language suggestion is quite painful while work inside the on actions.

Pelmen323 commented 1 week ago

I can't reproduce the issue, it should've been fixed in https://github.com/cwtools/cwtools-hoi4-config/commit/98113cb1bf43812d5753f9ea937b31d3a483ce3a

Please report hoi4 issues here https://github.com/cwtools/cwtools-hoi4-config/issues

insilications commented 1 week ago

Yes, it seems it should've been fixed. I can't test it right now.