Skip to content

Commit

Permalink
rm replaces dbox field
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Aug 17, 2024
1 parent 46b2799 commit 90d9212
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
2 changes: 0 additions & 2 deletions pets-gd/quests/intro1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ func room_id():

func _ready():
pcb().move_to_relative(0.0, -200.0)
print("moving")
await pcb().motion_done
print("done")

dbox().start_ix("Intro #1")
pcb().teleported.connect(on_teleported)
Expand Down
8 changes: 1 addition & 7 deletions pets-lib/src/dialogue/dbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub struct DialogBox {

// state for the current interaction
active: bool,
replaces: Vec<(String, String)>,

#[init(node = "VBox/Choices/ChoiceAgent")]
choice_agent: OnReady<Gd<ChoiceAgent>>,
Expand Down Expand Up @@ -111,19 +110,14 @@ impl DialogBox {
use Speaker::*;

match &self.speaker {
Named(v) => {
let name = replace_str_all(v, &self.replaces);
tr(placeholders::process_placeholders(&name))
}

Named(name) => tr(placeholders::process_placeholders(&name)),
Narrator => "".into(),
Unknown => tr("DG_SPK_UNKNOWN"),
}
}

fn translated_message(&self) -> GString {
let content = self.page_content.clone();
let content = replace_str_all(&content, &self.replaces);
let content = tr(content).to_string();

placeholders::process_placeholders(&content).into()
Expand Down
6 changes: 0 additions & 6 deletions pets-lib/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ macro_rules! normalized {
}};
}

pub fn replace_str_all(text: &str, replaces: &[(String, String)]) -> String {
replaces
.into_iter()
.fold(text.to_owned(), |text, (from, to)| text.replace(from, to))
}

pub fn tr(text: impl Into<StringName>) -> GString {
Engine::singleton().tr(text.into())
}
Expand Down

0 comments on commit 90d9212

Please sign in to comment.