Updated DualControl: Improved initialization to avoid extra listeners on reset.
This commit is contained in:
parent
60305380be
commit
1855d0f9d1
2 changed files with 18 additions and 12 deletions
|
@ -1,9 +1,8 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## $Id$
|
|
||||||
##
|
##
|
||||||
## Nasal for copilot for dual control over the multiplayer network.
|
## Nasal for copilot for dual control over the multiplayer network.
|
||||||
##
|
##
|
||||||
## Copyright (C) 2007 - 2011 Anders Gidenstam (anders(at)gidenstam.org)
|
## Copyright (C) 2007 - 2012 Anders Gidenstam (anders(at)gidenstam.org)
|
||||||
## This file is licensed under the GPL license version 2 or later.
|
## This file is licensed under the GPL license version 2 or later.
|
||||||
##
|
##
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -169,12 +168,16 @@ var disconnect = func {
|
||||||
######################################################################
|
######################################################################
|
||||||
# Main loop singleton class.
|
# Main loop singleton class.
|
||||||
var main = {
|
var main = {
|
||||||
|
_initialized : 0,
|
||||||
init : func {
|
init : func {
|
||||||
me.loopid = 0;
|
if (!me._initialized) {
|
||||||
|
me.loopid = 0;
|
||||||
|
setlistener("/ai/models/model-added", func {
|
||||||
|
settimer(func { me.activate(); }, 2);
|
||||||
|
});
|
||||||
|
me._initialized = 1;
|
||||||
|
}
|
||||||
me.active = 0;
|
me.active = 0;
|
||||||
setlistener("/ai/models/model-added", func {
|
|
||||||
settimer(func { me.activate(); }, 2);
|
|
||||||
});
|
|
||||||
print("Copilot dual control ... initialized");
|
print("Copilot dual control ... initialized");
|
||||||
settimer(func { me.activate(); }, 5);
|
settimer(func { me.activate(); }, 5);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## $Id$
|
|
||||||
##
|
##
|
||||||
## Nasal for main pilot for dual control over the multiplayer network.
|
## Nasal for main pilot for dual control over the multiplayer network.
|
||||||
##
|
##
|
||||||
## Copyright (C) 2007 - 2011 Anders Gidenstam (anders(at)gidenstam.org)
|
## Copyright (C) 2007 - 2012 Anders Gidenstam (anders(at)gidenstam.org)
|
||||||
## This file is licensed under the GPL license version 2 or later.
|
## This file is licensed under the GPL license version 2 or later.
|
||||||
##
|
##
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -37,12 +36,16 @@ var connect = func (copilot) {
|
||||||
######################################################################
|
######################################################################
|
||||||
# Main loop singleton class.
|
# Main loop singleton class.
|
||||||
var main = {
|
var main = {
|
||||||
|
_initialized : 0,
|
||||||
init : func {
|
init : func {
|
||||||
me.loopid = 0;
|
if (!me._initialized) {
|
||||||
|
me.loopid = 0;
|
||||||
|
setlistener("/ai/models/model-added", func {
|
||||||
|
settimer(func { me.activate(); }, 2);
|
||||||
|
});
|
||||||
|
me._initialized = 1;
|
||||||
|
}
|
||||||
me.active = 0;
|
me.active = 0;
|
||||||
setlistener("/ai/models/model-added", func {
|
|
||||||
settimer(func { me.activate(); }, 2);
|
|
||||||
});
|
|
||||||
settimer(func { me.activate(); }, 5);
|
settimer(func { me.activate(); }, 5);
|
||||||
print("Pilot dual control ... initialized");
|
print("Pilot dual control ... initialized");
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue