implement a second optional chat script parameter
This commit is contained in:
parent
36b6e3696c
commit
bfa6a463d3
|
@ -84,6 +84,7 @@ pub struct ChatBranch {
|
|||
pub choice: String,
|
||||
pub script: String,
|
||||
pub script_parameter: String,
|
||||
pub script_parameter2: String,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
|
|
|
@ -256,6 +256,7 @@ struct ParserState {
|
|||
stores_item: bool,
|
||||
script: String,
|
||||
script_parameter: String,
|
||||
script_parameter2: String,
|
||||
}
|
||||
impl Default for ParserState {
|
||||
fn default() -> Self {
|
||||
|
@ -290,6 +291,7 @@ impl Default for ParserState {
|
|||
stores_item: false,
|
||||
script: "".to_string(),
|
||||
script_parameter: "".to_string(),
|
||||
script_parameter2: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -324,6 +326,7 @@ impl ParserState {
|
|||
goto: self.goto.clone(),
|
||||
script: self.script.clone(),
|
||||
script_parameter: self.script_parameter.clone(),
|
||||
script_parameter2: self.script_parameter2.clone(),
|
||||
}
|
||||
}
|
||||
fn spawn_chat(&mut self, commands: &mut Commands) {
|
||||
|
@ -615,6 +618,12 @@ pub fn load_defs(
|
|||
["script", scriptname, parameter] => {
|
||||
state.script = scriptname.to_string();
|
||||
state.script_parameter = parameter.to_string();
|
||||
state.script_parameter2 = "".to_string();
|
||||
}
|
||||
["script", scriptname, parameter, parameter2] => {
|
||||
state.script = scriptname.to_string();
|
||||
state.script_parameter = parameter.to_string();
|
||||
state.script_parameter2 = parameter2.to_string();
|
||||
}
|
||||
_ => {
|
||||
error!("No match for [{}]", parts.join(","));
|
||||
|
|
Loading…
Reference in a new issue