DragonKnightOfBreeze / Paradox-Language-Support

IDEA Plugin: Paradox Language Support.
https://windea.icu/Paradox-Language-Support
MIT License
33 stars 4 forks source link

Allow referencing an existing cwt configuration. #81

Open adriangaro opened 1 month ago

adriangaro commented 1 month ago

In some cases, you do not have an alias for a specific context type, for example the plugin cannot infer that something is for example part of a pop_job declaration or part of authority declaration.

For example i have to copy the below, to make sure (especially with dynamic calls) that the inlines know the context.

inline_scripts = {

    ## context_configs_type = multiple
    ant:governments/authorities/* = {
        ## cardinality = 0..inf
        advanced_authority_swap = {
            ### Will also be used to attempt and find an icon from "interface/icons/governments/authorities/"
            ## cardinality = 0..1
            name = localisation
            ### Used to customize the description in the case of a swap
            ## cardinality = 0..1
            description = localisation
            ## cardinality = 0..1
            negative_description = negative_localisation
            ## cardinality = 0..1
            inherit_name = bool
            ### Decides if we should inherit the modifiers from the base Authority and combine it with the advanced authority
            ## cardinality = 0..1
            inherit_effects = bool
            ### Decides if we should inherit the icon of the original authority
            ## cardinality = 0..1
            inherit_icon = bool
            ### Used to swap out the ruler council position
            ## cardinality = 0..1
            ruler_council_position = <councilor>
            ### This will decide when the swap to advanced authority type will be made
            ## cardinality = 0..1
            ## replace_scopes = { this = country root = country }
            trigger = single_alias_right[trigger_clause]
            ### The modifiers that are used instead of the authority after the swap, can include the original by using inherit_effects
            ## cardinality = 0..1
            ## replace_scopes = { this = country root = country }
            modifier = single_alias_right[modifier_clause]
            ### Translation tags used for the authority swap
            ## cardinality = 0..1
            tags = {
                ## cardinality = 1..inf
                localisation
            }
            ### you can either have a hereditary system (has_heir = yes), or an election system (has_heir = no)
            ## cardinality = 0..1
            has_heir = bool
            ### oligarchic generate candidates only from leaders in the country
            ## cardinality = 0..1
            election_type = enum[election_type]
            ## cardinality = 0..1
            election_term_years = int
            ### actual election term = election_term_years +/- election_term_variance
            ## cardinality = 0..1
            election_term_variance = int
            ## cardinality = 0..1
            can_have_emergency_elections = bool
            ### -1 == no limit
            ## cardinality = 0..1
            max_election_candidates = int
            ### If there are multiple options, the one with the highest weight is picked. Scope: Country
            ## replace_scopes = { this = country root = country }
            ## cardinality = 0..1
            weight = {
                alias_name[modifier_rule] = alias_match_left[modifier_rule]
            }
        }
    }
}

Would i be possible to instead somehow reference an existing configuration? Maybe allow specifying a cwt config path like copy_config = /authority or copy_config = /job/resources (just an idea)> Sadly not everything has an alias (plus it would be laborious to make for everything)

adriangaro commented 1 month ago

Mayhaps an alternative would also be to have something like

inline_scripts = {

    ## context_configs_type = multiple
    ant:governments/authorities/* = {
        ## cardinality = 0..inf
        advanced_authority_swap = cwt_config_path[authority/advanced_authority_swap]
    }
}
DragonKnightOfBreeze commented 1 month ago

Similar to #68 ?

adriangaro commented 1 month ago

Yes and no.

In #68, you inherit the context/config of the invocation place. (useful for conditional inlines) In this, you want to inherit/copy the context/config of an existing cwt declaration. (useful for when the above is not useful/impossible to infer)