store listener ids in module hash, so that other modules can remove them:
removelistener(screen.listener["pilot"]); # try in the Nasal console
This commit is contained in:
parent
bd03e147d2
commit
db731ee480
1 changed files with 13 additions and 6 deletions
|
@ -198,6 +198,7 @@ msg_repeat = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listener = {};
|
||||||
|
|
||||||
settimer(func {
|
settimer(func {
|
||||||
# set /sim/screen/nomap=true to prevent default message mapping
|
# set /sim/screen/nomap=true to prevent default message mapping
|
||||||
|
@ -212,13 +213,19 @@ settimer(func {
|
||||||
}
|
}
|
||||||
|
|
||||||
var m = "/sim/messages/";
|
var m = "/sim/messages/";
|
||||||
setlistener(m ~ "atc", func { map("atc", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
listener["atc"] = setlistener(m ~ "atc",
|
||||||
setlistener(m ~ "approach", func { map("approach", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
func { map("atc", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
||||||
setlistener(m ~ "ground", func { map("ground", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
listener["approach"] = setlistener(m ~ "approach",
|
||||||
|
func { map("approach", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
||||||
|
listener["ground"] = setlistener(m ~ "ground",
|
||||||
|
func { map("ground", cmdarg().getValue(), 0.7, 1.0, 0.7) });
|
||||||
|
|
||||||
setlistener(m ~ "pilot", func { map("pilot", cmdarg().getValue(), 1.0, 0.8, 0.0) });
|
listener["pilot"] = setlistener(m ~ "pilot",
|
||||||
setlistener(m ~ "copilot", func { map("copilot", cmdarg().getValue(), 1.0, 1.0, 1.0) });
|
func { map("pilot", cmdarg().getValue(), 1.0, 0.8, 0.0) });
|
||||||
setlistener(m ~ "ai-plane", func { map("ai-plane", cmdarg().getValue(), 0.9, 0.4, 0.2) });
|
listener["copilot"] = setlistener(m ~ "copilot",
|
||||||
|
func { map("copilot", cmdarg().getValue(), 1.0, 1.0, 1.0) });
|
||||||
|
listener["ai-plane"] = setlistener(m ~ "ai-plane",
|
||||||
|
func { map("ai-plane", cmdarg().getValue(), 0.9, 0.4, 0.2) });
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue