Story ending in diversions
This commit is contained in:
parent
a5a534a41e
commit
3cf2ae3ac4
4 changed files with 77 additions and 48 deletions
|
@ -117,7 +117,11 @@ class CentralCommand(object):
|
|||
handler = telegram_handler.TelegramHandler(
|
||||
token=self.config['telegram']['token'],
|
||||
level=logging.CRITICAL,
|
||||
chat_id=chat_id
|
||||
chat_id=chat_id,
|
||||
proxies={
|
||||
'http': 'socks5h://localhost:9090',
|
||||
'https': 'socks5h://localhost:9090'
|
||||
}
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logging.getLogger('hugvey').addHandler(handler)
|
||||
|
|
|
@ -82,6 +82,8 @@ class Message(object):
|
|||
|
||||
# Used by diversions, autogenerated directions should link to next chapter mark instead of the given msgTo
|
||||
self.generatedDirectionsJumpToChapter = False
|
||||
# Used by diversions, no return directions should be autogenerated, so this message becomes an ending
|
||||
self.dontGenerateDirections = False
|
||||
|
||||
def __getstate__(self):
|
||||
# Copy the object's state from self.__dict__ which contains
|
||||
|
@ -120,6 +122,7 @@ class Message(object):
|
|||
msg.params['vol'] = .8
|
||||
msg.lightChange = data['light'] if 'light' in data else None
|
||||
msg.generatedDirectionsJumpToChapter = bool(data['generatedDirectionsJumpToChapter']) if 'generatedDirectionsJumpToChapter' in data else False
|
||||
msg.dontGenerateDirections = bool(data['dontGenerateDirections']) if 'dontGenerateDirections' in data else False
|
||||
|
||||
msg.params['vol'] = float(msg.params['vol'])
|
||||
|
||||
|
@ -843,6 +846,10 @@ class Diversion(object):
|
|||
if not msg:
|
||||
continue
|
||||
|
||||
if msg.dontGenerateDirections:
|
||||
story.logger.info(f"Diversion ending {msg.id} is story ending. Don't generate return direction.")
|
||||
continue
|
||||
|
||||
usedReturnMessage = returnMsg
|
||||
if msg.generatedDirectionsJumpToChapter:
|
||||
usedReturnMessage = story.getNextChapterForMsg(returnMsg, canIncludeSelf=True)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#N canvas 1163 253 676 571 10;
|
||||
#N canvas 1208 380 676 571 10;
|
||||
#X obj 178 276 dac~;
|
||||
#X obj 178 226 readsf~;
|
||||
#X obj 256 208 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
|
||||
|
@ -32,14 +32,14 @@
|
|||
#X text 393 384 Connection to Max/MSP with light;
|
||||
#X text 104 375 Connection to local python server commanding the Hugveys
|
||||
;
|
||||
#X msg 179 169 open /mnt/stash/hugvey/sound/score40_lessbass.wav \,
|
||||
1;
|
||||
#X msg 399 422 connect 192.168.1.175 7400;
|
||||
#X msg 179 169 open /mnt/stash/hugvey/sound/score41_loop_plus40s.wav
|
||||
\, 1;
|
||||
#X connect 1 0 0 0;
|
||||
#X connect 1 0 0 1;
|
||||
#X connect 1 1 2 0;
|
||||
#X connect 2 0 12 0;
|
||||
#X connect 2 0 26 0;
|
||||
#X connect 2 0 27 0;
|
||||
#X connect 4 0 5 0;
|
||||
#X connect 6 0 4 0;
|
||||
#X connect 6 0 21 0;
|
||||
|
@ -47,7 +47,7 @@
|
|||
#X connect 8 0 4 0;
|
||||
#X connect 8 0 21 0;
|
||||
#X connect 9 0 1 0;
|
||||
#X connect 10 0 27 0;
|
||||
#X connect 10 0 26 0;
|
||||
#X connect 10 0 2 0;
|
||||
#X connect 10 0 18 0;
|
||||
#X connect 10 0 23 0;
|
||||
|
@ -60,5 +60,5 @@
|
|||
#X connect 20 0 7 0;
|
||||
#X connect 21 0 22 0;
|
||||
#X connect 23 0 21 0;
|
||||
#X connect 26 0 1 0;
|
||||
#X connect 27 0 4 0;
|
||||
#X connect 26 0 4 0;
|
||||
#X connect 27 0 1 0;
|
||||
|
|
|
@ -1080,7 +1080,7 @@ class Graph {
|
|||
},
|
||||
'value': this.configuration.hasOwnProperty('volume') ? this.configuration.volume : 1
|
||||
})
|
||||
),
|
||||
),crel('br'),
|
||||
crel(
|
||||
'label',
|
||||
"Text replacement when no variable is set: ",
|
||||
|
@ -1093,7 +1093,7 @@ class Graph {
|
|||
},
|
||||
'value': this.configuration.hasOwnProperty('nothing_text') ? this.configuration.nothing_text : "nothing"
|
||||
})
|
||||
),
|
||||
),crel('br'),
|
||||
crel(
|
||||
'label',
|
||||
"Condition timing factor: (< 1 is faster, >1 is slower)",
|
||||
|
@ -1107,10 +1107,10 @@ class Graph {
|
|||
'value': this.configuration.hasOwnProperty('time_factor') ? this.configuration.time_factor : 1,
|
||||
'step': 0.01
|
||||
})
|
||||
),
|
||||
),crel('br'),
|
||||
crel(
|
||||
'label',
|
||||
"Playback tempo factor: (< 1 is faster, >1 is slower)",
|
||||
"Playback tempo factor: (< 1 is slower, >1 is faster)",
|
||||
crel('input', {
|
||||
'type': 'number',
|
||||
'on': {
|
||||
|
@ -1121,7 +1121,7 @@ class Graph {
|
|||
'value': this.configuration.hasOwnProperty('tempo_factor') ? this.configuration.tempo_factor : 1,
|
||||
'step': 0.01
|
||||
})
|
||||
),
|
||||
),crel('br'),
|
||||
crel(
|
||||
'label',
|
||||
"Playback pitch modifier: (< 0 is lower, >0 is higher)",
|
||||
|
@ -1424,6 +1424,18 @@ class Graph {
|
|||
generatedDirectionsJumpToChapterAttributes['checked'] = 'checked';
|
||||
}
|
||||
|
||||
let dontGenerateDirectionsAttributes = {
|
||||
'name': msg['@id'] + '-dontGenerateDirections',
|
||||
// 'readonly': 'readonly',
|
||||
'type': 'checkbox',
|
||||
'on': {
|
||||
'change': this.getEditEventListener()
|
||||
}
|
||||
}
|
||||
if ( msg.hasOwnProperty('dontGenerateDirections') && msg['dontGenerateDirections'] == true ) {
|
||||
dontGenerateDirectionsAttributes['checked'] = 'checked';
|
||||
}
|
||||
|
||||
let params = {};
|
||||
if(msg.hasOwnProperty('params')) {
|
||||
params = msg['params'];
|
||||
|
@ -1655,6 +1667,12 @@ class Graph {
|
|||
},'Generated directions jump to next chapter' ),
|
||||
crel( 'input', generatedDirectionsJumpToChapterAttributes )
|
||||
),
|
||||
crel( 'label',
|
||||
crel( 'span', {
|
||||
'title': "Only for diversions: when this message is the final message of a diversion, it ends the story instead of generating a return direction"
|
||||
},'Is story ending (when diversion)' ),
|
||||
crel( 'input', dontGenerateDirectionsAttributes )
|
||||
),
|
||||
);
|
||||
msgEl.appendChild( msgInfoEl );
|
||||
|
||||
|
|
Loading…
Reference in a new issue