cwtools-vscode
cwtools-vscode copied to clipboard
Blank Scope Context information inside on_actions (HOI4)
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.
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
.
I have no idea what is really going on behind my "fix".