diff --git a/Cargo.lock b/Cargo.lock index 03567f02..5f95d0e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -380,7 +380,7 @@ checksum = "0edba455601861b8e8b76128ae5d46dd968114edde60f0ac3d2c21535a947548" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -526,7 +526,7 @@ source = "git+https://github.com/Alainx277/bevy?branch=ssnt#d5bdf5c8245de0868344 dependencies = [ "bevy_macro_utils", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -747,7 +747,7 @@ source = "git+https://github.com/Alainx277/bevy?branch=ssnt#d5bdf5c8245de0868344 dependencies = [ "quote", "rustc-hash", - "syn 2.0.38", + "syn 2.0.49", "toml_edit", ] @@ -817,7 +817,7 @@ dependencies = [ "bevy_reflect_derive", "bevy_utils", "downcast-rs", - "erased-serde", + "erased-serde 0.3.31", "glam 0.24.2", "once_cell", "parking_lot", @@ -836,7 +836,7 @@ dependencies = [ "bit-set", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", "uuid", ] @@ -897,7 +897,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1067,7 +1067,7 @@ source = "git+https://github.com/Alainx277/bevy?branch=ssnt#d5bdf5c8245de0868344 dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1134,7 +1134,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1226,7 +1226,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1706,6 +1706,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "dyn-clone" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" + [[package]] name = "ecolor" version = "0.22.0" @@ -1770,7 +1776,7 @@ checksum = "3fe2568f851fd6144a45fa91cfed8fe5ca8fc0b56ba6797bfc1ed2771b90e37c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1799,7 +1805,7 @@ checksum = "04d0b288e3bb1d861c4403c1774a6f7a798781dfc519b3647df2a3dd4ae95f25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -1833,6 +1839,15 @@ dependencies = [ "serde", ] +[[package]] +name = "erased-serde" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55d05712b2d8d88102bc9868020c9e5c7a1f5527c452b9b97450a1d006140ba7" +dependencies = [ + "serde", +] + [[package]] name = "error-code" version = "2.3.1" @@ -2006,7 +2021,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -2161,7 +2176,7 @@ dependencies = [ "inflections", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -2516,6 +2531,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "inventory" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" + [[package]] name = "io-kit-sys" version = "0.3.0" @@ -3154,7 +3175,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -3421,7 +3442,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -3517,9 +3538,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -3532,9 +3553,9 @@ checksum = "f89dff0959d98c9758c88826cc002e2c3d0b9dfac4139711d1f30de442f1139b" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3841,6 +3862,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sayit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e563ce1f720e5d69a89e96e1f278d265939093de984878c77f879f08fd98b9e2" +dependencies = [ + "dyn-clone", + "fastrand 2.0.1", + "log", + "regex-automata 0.4.1", + "serde", + "typetag", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -3859,22 +3894,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -4002,6 +4037,17 @@ dependencies = [ "smallvec", ] +[[package]] +name = "speech" +version = "0.1.0" +dependencies = [ + "bevy", + "bevy_common_assets", + "ron", + "sayit", + "serde", +] + [[package]] name = "spin" version = "0.5.2" @@ -4060,6 +4106,7 @@ dependencies = [ "reqwest", "serde", "smallvec", + "speech", "tokio", "toml", "utils", @@ -4108,9 +4155,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -4216,7 +4263,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -4346,7 +4393,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", ] [[package]] @@ -4427,6 +4474,30 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "typetag" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43148481c7b66502c48f35b8eef38b6ccdc7a9f04bd4cc294226d901ccc9bc7" +dependencies = [ + "erased-serde 0.4.2", + "inventory", + "once_cell", + "serde", + "typetag-impl", +] + +[[package]] +name = "typetag-impl" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291db8a81af4840c10d636e047cac67664e343be44e24dfdbd1492df9a5d3390" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -4574,7 +4645,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -4608,7 +4679,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 08c951f2..bf51a4ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,36 +10,39 @@ members = ["crates/*"] [workspace.dependencies] bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_pbr", "bevy_gltf", "bevy_sprite", "bevy_text", "bevy_render", "bevy_core_pipeline", "bevy_ui", "multi-threaded", "png", "hdr", "ktx2", "zstd", "filesystem_watcher", "bevy_gizmos", "tonemapping_luts", "default_font", "webgl2"] } +bevy_common_assets = { version = "0.7.0", features = ["ron"] } bevy_rapier3d = "0.22.0" +serde = { version = "*", features = ["derive"] } [features] default = ["client"] client = ["bevy/animation", "bevy/bevy_audio", "bevy/bevy_gilrs", "bevy/bevy_winit", "bevy/x11", "bevy/vorbis"] [dependencies] -byond = { path = "crates/byond" } -maps = { path = "crates/maps" } -networking = { path = "crates/networking" } -physics = { path = "crates/physics" } -utils = { path = "crates/utils" } +async-compat = "0.2.1" +base64 = "0.13.0" bevy = { workspace = true } +bevy_common_assets = { workspace = true } bevy_egui = "0.21.0" bevy-inspector-egui = "0.19.0" bevy_rapier3d = { workspace = true, features = ["simd-stable"] } -bevy_common_assets = { version = "0.7.0", features = ["ron"] } +byond = { path = "crates/byond" } cfg-if = "1.0.0" +clap = { version = "3.0.13", features = ["derive"] } futures-lite = "1.4.0" -log = "0.4.8" glam = "0.20.2" -serde = { version = "*", features = ["derive"] } -clap = { version = "3.0.13", features = ["derive"] } -toml = "0.5.9" +log = "0.4.8" +maps = { path = "crates/maps" } +networking = { path = "crates/networking" } +physics = { path = "crates/physics" } reqwest = { version = "0.11.12", default-features = false, features = ["json", "rustls-tls"] } -async-compat = "0.2.1" -tokio = { version = "1.21.2", features = ["time"] } # Remove when https://github.com/bevyengine/bevy/pull/6578 is merged +serde = { workspace = true } smallvec = "*" -base64 = "0.13.0" +speech = { path = "crates/speech" } +tokio = { version = "1.21.2", features = ["time"] } +toml = "0.5.9" +utils = { path = "crates/utils" } [patch.crates-io] bevy = { git = "https://github.com/Alainx277/bevy", branch = "ssnt" } diff --git a/assets/accents/french.accent.ron b/assets/accents/french.accent.ron new file mode 100644 index 00000000..d11daee6 --- /dev/null +++ b/assets/accents/french.accent.ron @@ -0,0 +1,111 @@ +( + name: "French", + description: "French accent", + body: ( + accent: { + // virgin SS14 french by default: + // https://github.com/space-wizards/space-station-14/blob/786ecd961a5af4865281f6e3ae32d13fe26f028c/Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs + "main": ( + rules: { + "th": {"Literal": "'z"}, + r"\", + rules: { + "a": {"Any": [ + {"Literal": "un"}, + {"Literal": "une"}, + ]}, + "am": {"Literal": "suis"}, + "and": {"Literal": "et"}, + "the": {"Any": [ + {"Literal": "les"}, + {"Literal": "la"}, + {"Literal": "le"}, + ]}, + "for": {"Literal": "pour"}, + "of": {"Literal": "de"}, + "my": {"Any": [ + {"Literal": "mon"}, + {"Literal": "ma"}, + ]}, + "very": {"Literal": "très"}, + "want": {"Literal": "vouloir"}, + "with": {"Literal": "avec"}, + "i'?m": {"Literal": "je suis"}, + "i": {"Literal": "je"}, + "good": {"Literal": "bon"}, + "bad": {"Literal": "mal"}, + "spicy": {"Any": [ + {"Literal": "épicé"}, + {"Literal": "épicée"}, + ]}, + "yes": {"Literal": "oui"}, + "no": {"Literal": "non"}, + "why": {"Literal": "pourquoi"}, + "what'?s": {"Literal": "quel est"}, + "who'?s": {"Literal": "qui est"}, + "hello": {"Any": [ + {"Literal": "'allô"}, + {"Literal": "bonjour"}, + {"Literal": "salut"}, + ]}, + "bye": {"Any": [ + {"Literal": "bon voyage"}, + {"Literal": "adieu"}, + {"Literal": "au revoir"}, + ]}, + "thanks": {"Literal": "merci"}, + "assistant": {"Literal": "ravageur"}, + "assistants": {"Literal": "ravageurs"}, + "captain": {"Literal": "capitaine"}, + "cook": {"Any": [ + {"Literal": "cuisinier"}, + {"Literal": "cuisinière"}, + ]}, + "enemy": {"Any": [ + {"Literal": "silly english dog"}, + {"Literal": "ennemi"}, + {"Literal": "ennemie"}, + ]}, + "friend": {"Literal": "ami"}, + "friends": {"Literal": "amis"}, + "greytider?": {"Literal": "gitans"}, + "changeling": {"Literal": "changeur"}, + "wizard": {"Literal": "sorcier"}, + "(?:op|operative)": {"Literal": "boche"}, + "(?:op|operative)s": {"Literal": "boches"}, + "cheese": {"Any": [ + {"Literal": "brie"}, + {"Literal": "roquefort"}, + {"Literal": "camembert"}, + ]}, + "bread": {"Literal": "baguette"}, + "tomato": {"Literal": "tomate"}, + "wine": {"Literal": "vin"}, + "traitor": {"Literal": "traitre"}, + "maint": {"Literal": "banlieues"}, + "nuke": {"Any": [ + {"Literal": "grand bombe"}, + {"Literal": "la baguette ultime"}, + ]}, + "shit": {"Literal": "merde"}, + "urity": {"Literal": "urite"}, + "security": {"Literal": "securite"}, + "shitsec": {"Any": [ + {"Literal": "gendarmerie"}, + {"Literal": "keufs"}, + ]}, + }, + ), + }), + }, + ), +) diff --git a/assets/accents/scotsman.accent.ron b/assets/accents/scotsman.accent.ron new file mode 100644 index 00000000..c036a430 --- /dev/null +++ b/assets/accents/scotsman.accent.ron @@ -0,0 +1,692 @@ +( + name: "Scotsman", + description: "Scotland accent", + body: ( + accent: { + "words": ( + // using non-unicode word boundaries results in false positives: + // "яall" -> "яaw" + // howerver these should basically never happen and it gives 15% better performance + format: r"(?-u)\<{}\>", + rules: { + "above": {"Literal": "`boon"}, + "across": {"Literal": "o`er"}, + "after": {"Literal": "efter"}, + "agree": {"Literal": "gree"}, + "all": {"Literal": "aw"}, + "almost": {"Literal": "a`maist"}, + "along": {"Literal": "alang"}, + "already": {"Literal": "awready"}, + "also": {"Literal": "an` a`"}, + "and": {"Literal": "`n`"}, + "another": {"Literal": "anither"}, + "any": {"Literal": "ony"}, + "anyone": {"Literal": "a`body"}, + "anybody": {"Literal": "a`body"}, + "anything": {"Literal": "anythin`"}, + "arrested": {"Literal": "liftit"}, + "arrest": {"Literal": "lift"}, + "arrests": {"Literal": "lifts"}, + "argues": {"Literal": "argies"}, + "argued": {"Literal": "argied"}, + "argue": {"Literal": "argie"}, + "available": {"Literal": "free"}, + "avoiding": {"Literal": "jookin"}, + "avoided": {"Literal": "jooked"}, + "avoid": {"Literal": "jook"}, + "ask": {"Literal": "spir"}, + "assistant": {"Literal": "servand"}, + "assistants": {"Literal": "servands"}, + "asking": {"Literal": "spirin"}, + "asked": {"Literal": "spire'd"}, + "away": {"Literal": "awa`"}, + "babies": {"Literal": "bairns"}, + "baby": {"Literal": "bairn"}, + "bad": {"Literal": "ill"}, + "balls": {"Literal": "baws"}, + "ball": {"Literal": "baw"}, + "bars": {"Literal": "boozers"}, + "bar": {"Literal": "boozer"}, + "been": {"Literal": "buin"}, + "beautiful": {"Literal": "bonny"}, + "because": {"Literal": "fur"}, + "breakdown": {"Literal": "breakdoon"}, + "nap": {"Literal": "kip"}, + "napping": {"Literal": "kipin'"}, + "before": {"Literal": "afore"}, + "believes": {"Literal": "hawps"}, + "believing": {"Literal": "hawpin"}, + "believe": {"Literal": "hawp"}, + "between": {"Literal": "atween"}, + "boards": {"Literal": "boords"}, + "board": {"Literal": "boord"}, + "both": {"Literal": "baith"}, + "boxes": {"Literal": "kists"}, + "box": {"Literal": "kist"}, + "boy": {"Literal": "laddie"}, + "brother": {"Literal": "brither"}, + "brothers": {"Literal": "brithers"}, + "but": {"Literal": "bit"}, + "bitch": {"Literal": "cunt"}, + "captain": {"Literal": "caiptain"}, + "cap": {"Literal": "caip"}, + "calling": {"Literal": "ca`ing"}, + "called": {"Literal": "cawed"}, + "call": {"Literal": "caw"}, + "cars": {"Literal": "motors"}, + "car": {"Literal": "motor"}, + "cared": {"Literal": "car'd"}, + "cards": {"Literal": "cairds"}, + "card": {"Literal": "caird"}, + "careers": {"Literal": "joabs"}, + "career": {"Literal": "joab"}, + "cargo": {"Literal": "cargae"}, + "century": {"Literal": "hunner years"}, + "changed": {"Literal": "chaynged"}, + "change": {"Literal": "chaynge"}, + "chaplain": {"Literal": "priestheid"}, + "chief": {"Literal": "heid"}, + "child": {"Literal": "wee'un"}, + "childeren": {"Literal": "wee'uns"}, + "choosing": {"Literal": "walin"}, + "choose": {"Literal": "wale"}, + "churches": {"Literal": "kirks"}, + "church": {"Literal": "kirk"}, + "city": {"Literal": "toon"}, + "cities": {"Literal": "toons"}, + "closer": {"Literal": "claiser"}, + "closest": {"Literal": "claisest"}, + "close": {"Literal": "claise"}, + "coats": {"Literal": "coaties"}, + "coat": {"Literal": "coatie"}, + "coldest": {"Literal": "cauldest"}, + "colder": {"Literal": "caulder"}, + "cold": {"Literal": "cauld"}, + "cooks": {"Literal": "keuks"}, + "cook": {"Literal": "keuk"}, + "consumer": {"Literal": "punter"}, + "consumers": {"Literal": "punters"}, + "could": {"Literal": "cuid"}, + "countries": {"Literal": "lands"}, + "country": {"Literal": "land"}, + "cultures": {"Literal": "culchurs"}, + "culture": {"Literal": "culchur"}, + "customer": {"Literal": "punter"}, + "customers": {"Literal": "punters"}, + "daddy": {"Literal": "daddie"}, + "dark": {"Literal": "mirk"}, + "dad": {"Literal": "da"}, + "dead": {"Literal": "deid"}, + "deaf": {"Literal": "deav"}, + "deafen": {"Literal": "deave"}, + "deafened": {"Literal": "deaved"}, + "debate": {"Literal": "argie"}, + "debating": {"Literal": "argiein"}, + "debates": {"Literal": "argies"}, + "degrees": {"Literal": "grees"}, + "degree": {"Literal": "gree"}, + "detectives": {"Literal": "snoots"}, + "detective": {"Literal": "snoot"}, + "difficult": {"Literal": "pernicketie"}, + "dinner": {"Literal": "tea"}, + "directors": {"Literal": "guiders"}, + "director": {"Literal": "guider"}, + "did": {"Literal": "daed"}, + "do": {"Literal": "dae"}, + "dogs": {"Literal": "dugs"}, + "dog": {"Literal": "dug"}, + "down": {"Literal": "doon"}, + "downricht": {"Literal": "doun"}, + "droped": {"Literal": "draped"}, + "drops": {"Literal": "draps"}, + "drop": {"Literal": "drap"}, + "drink": {"Literal": "drappie"}, + "drinking": {"Literal": "swillin'"}, + "drank": {"Literal": "swilled"}, + "drunk": {"Literal": "fou"}, + "during": {"Literal": "while"}, + "dying": {"Literal": "deein'"}, + "each": {"Literal": "ilk"}, + "early": {"Literal": "earlie"}, + "eating": {"Literal": "slochin"}, + "ate": {"Literal": "sloched"}, + "eat": {"Literal": "sloch"}, + "edges": {"Literal": "lips"}, + "edge": {"Literal": "lip"}, + "enjoys": {"Literal": "gilravages"}, + "enjoy": {"Literal": "gilravage"}, + "engineer": {"Literal": "navvy"}, + "engineering": {"Literal": "ingineerin"}, + "engineers": {"Literal": "Navvies"}, + "evenings": {"Literal": "forenichts"}, + "evening": {"Literal": "forenicht"}, + "every": {"Literal": "ilka"}, + "everybody": {"Literal": "a`body"}, + "everyone": {"Literal": "a`body"}, + "eye": {"Literal": "ee"}, + "eyes": {"Literal": "e'ens"}, + "face": {"Literal": "physog"}, + "famililies": {"Literal": "fowks"}, + "family": {"Literal": "fowk"}, + "fast": {"Literal": "fleet"}, + "fathers": {"Literal": "faithers"}, + "father": {"Literal": "faither"}, + "fight": {"Literal": "rammy"}, + "fighting": {"Literal": "ramming"}, + "fights": {"Literal": "rammies"}, + "films": {"Literal": "pictures"}, + "film": {"Literal": "picture"}, + "finding": {"Literal": "fin`ing"}, + "found": {"Literal": "fund"}, + "fine": {"Literal": "braw"}, + "floors": {"Literal": "flairs"}, + "floor": {"Literal": "flair"}, + "foods": {"Literal": "fairns"}, + "food": {"Literal": "fairn"}, + "for": {"Literal": "fer"}, + "forget": {"Literal": "forgoat"}, + "friends": {"Literal": "mukkers"}, + "friend": {"Literal": "pal"}, + "from": {"Literal": "fae"}, + "full": {"Literal": "stowed oot"}, + "games": {"Literal": "gams"}, + "game": {"Literal": "gam"}, + "gardens": {"Literal": "back greens"}, + "garden": {"Literal": "back green"}, + "get": {"Literal": "git"}, + "girl": {"Literal": "lassie"}, + "give": {"Literal": "gie"}, + "glasses": {"Literal": "glesses"}, + "glass": {"Literal": "gless"}, + "go": {"Literal": "gae"}, + "good": {"Literal": "guid"}, + "great": {"Literal": "stoatin"}, + "growing": {"Literal": "grawing"}, + "grown": {"Literal": "grawn"}, + "grow": {"Literal": "graw"}, + "glared": {"Literal": "glower'd"}, + "glaring": {"Literal": "glowrin'"}, + "guess": {"Literal": "jalouse"}, + "had": {"Literal": "haed"}, + "has": {"Literal": "haes"}, + "hadnt": {"Literal": "haedna"}, + "hadn't": {"Literal": "haedna"}, + "hairs": {"Literal": "locks"}, + "hair": {"Literal": "locks"}, + "halfs": {"Literal": "haufs"}, + "half": {"Literal": "hauf"}, + "hands": {"Literal": "hauns"}, + "hand": {"Literal": "haun"}, + "hangs": {"Literal": "hings"}, + "hanging": {"Literal": "hinging"}, + "hang": {"Literal": "hing"}, + "have": {"Literal": "hae"}, + "heads": {"Literal": "heids"}, + "head": {"Literal": "heid"}, + "hearts": {"Literal": "herts"}, + "heart": {"Literal": "hert"}, + "help": {"Literal": "hulp"}, + "here": {"Literal": "`ere"}, + "high": {"Literal": "heich"}, + "himself": {"Literal": "his-sel"}, + "holding": {"Literal": "hauding"}, + "hold": {"Literal": "haud"}, + "homes": {"Literal": "hames"}, + "home": {"Literal": "hame"}, + "hopes": {"Literal": "hawps"}, + "hope": {"Literal": "hawp"}, + "hoter": {"Literal": "heter"}, + "hotest": {"Literal": "hetest"}, + "hot": {"Literal": "het"}, + "hotels": {"Literal": "change-hooses"}, + "hotel": {"Literal": "change-hoose"}, + "husband": {"Literal": "guidman"}, + "images": {"Literal": "photies"}, + "image": {"Literal": "photie"}, + "imagine": {"Literal": "jalouse"}, + "including": {"Literal": "anaw"}, + "indicates": {"Literal": "shows"}, + "indicate": {"Literal": "show"}, + "informations": {"Literal": "speirins"}, + "information": {"Literal": "speirins"}, + "into": {"Literal": "intae"}, + "its": {"Literal": "tis"}, + "isn't": {"Literal": "isna"}, + "isnt": {"Literal": "isna"}, + "janitors": {"Literal": "jannies"}, + "janitor": {"Literal": "jannie"}, + "jobs": {"Literal": "jabs"}, + "joined": {"Literal": "jyneed"}, + "joins": {"Literal": "jynes"}, + "join": {"Literal": "jyne"}, + "just": {"Literal": "juist"}, + "kids": {"Literal": "bairns"}, + "kid": {"Literal": "bairn"}, + "kills": {"Literal": "murdurrs"}, + "killer": {"Literal": "murdurrur"}, + "killed": {"Literal": "murdurred"}, + "kill": {"Literal": "murdurr"}, + "kitchens": {"Literal": "sculleries"}, + "kitchen": {"Literal": "scullery"}, + "knows": {"Literal": "kens"}, + "know": {"Literal": "ken"}, + "known": {"Literal": "kent"}, + "languages": {"Literal": "leids"}, + "language": {"Literal": "leid"}, + "larger": {"Literal": "lairger"}, + "largest": {"Literal": "lairgest"}, + "large": {"Literal": "lairge"}, + "last": {"Literal": "lest"}, + "later": {"Literal": "efter"}, + "laughing": {"Literal": "roarin"}, + "laugh": {"Literal": "roar"}, + "lawyers": {"Literal": "advocates"}, + "lawyer": {"Literal": "advocate"}, + "lead": {"Literal": "leid"}, + "leading": {"Literal": "leidin"}, + "leaving": {"Literal": "leaing"}, + "leave": {"Literal": "lea"}, + "let": {"Literal": "loot"}, + "legs": {"Literal": "shanks"}, + "leg": {"Literal": "shank"}, + "devil": {"Literal": "deuce"}, + "devils": {"Literal": "deuces"}, + "lying": {"Literal": "liein"}, + "like": {"Literal": "lik`"}, + "likely": {"Literal": "likelie"}, + "little": {"Literal": "wee"}, + "longer": {"Literal": "langer"}, + "longest": {"Literal": "langest"}, + "long": {"Literal": "lang"}, + "looking": {"Literal": "keeking"}, + "looked": {"Literal": "keeked"}, + "look": {"Literal": "keek"}, + "loved": {"Literal": "loued"}, + "loving": {"Literal": "louing"}, + "love": {"Literal": "loue"}, + "makes": {"Literal": "mak`s"}, + "make": {"Literal": "mak`"}, + "men": {"Literal": "jimmies"}, + "manage": {"Literal": "guide"}, + "managers": {"Literal": "high heid yins"}, + "manager": {"Literal": "high heid yin"}, + "many": {"Literal": "mony"}, + "may": {"Literal": "mey"}, + "markets": {"Literal": "merkats"}, + "market": {"Literal": "merkat"}, + "marriages": {"Literal": "mairriages"}, + "marriage": {"Literal": "mairriage"}, + "matters": {"Literal": "maiters"}, + "matter": {"Literal": "maiter"}, + "maybe": {"Literal": "mibbie"}, + "meetings": {"Literal": "meetins"}, + "meeting": {"Literal": "meetin"}, + "methods": {"Literal": "ways"}, + "method": {"Literal": "way"}, + "might": {"Literal": "micht"}, + "mind": {"Literal": "mynd"}, + "miner": {"Literal": "pickman"}, + "miners": {"Literal": "pickmen"}, + "money": {"Literal": "dosh"}, + "months": {"Literal": "munths"}, + "month": {"Literal": "munth"}, + "more": {"Literal": "mair"}, + "mornings": {"Literal": "mornin`s"}, + "morning": {"Literal": "mornin`"}, + "most": {"Literal": "maist"}, + "mothers": {"Literal": "mithers"}, + "mother": {"Literal": "mither"}, + "mouths": {"Literal": "geggies"}, + "mouth": {"Literal": "geggy"}, + "moves": {"Literal": "shifts"}, + "move": {"Literal": "shift"}, + "much": {"Literal": "muckle"}, + "must": {"Literal": "mist"}, + "my": {"Literal": "ma"}, + "myself": {"Literal": "masell"}, + "nasty": {"Literal": "mingin"}, + "networks": {"Literal": "netwurks"}, + "network": {"Literal": "netwurk"}, + "never": {"Literal": "ne`er"}, + "new": {"Literal": "freish"}, + "news": {"Literal": "speirins"}, + "next": {"Literal": "neist"}, + "nice": {"Literal": "crakin`"}, + "nights": {"Literal": "nichts"}, + "night": {"Literal": "nicht"}, + "false": {"Any": [ + {"Literal": "na"}, + {"Literal": "aff"}, + ]}, + "not": {"Literal": "nae"}, + "nothing": {"Literal": "neithin'"}, + "numbers": {"Literal": "nummers"}, + "number": {"Literal": "nummer"}, + "of": {"Literal": "o`"}, + "offices": {"Literal": "affices"}, + "office": {"Literal": "affice"}, + "officers": {"Literal": "boabies"}, + "officer": {"Literal": "boaby"}, + "often": {"Literal": "aften"}, + "oh": {"Literal": "och"}, + "ok": {"Literal": "a`richt"}, + "old": {"Literal": "auld"}, + "oil": {"Literal": "ile"}, + "once": {"Literal": "wance"}, + "one": {"Literal": "wan"}, + "only": {"Literal": "ainlie"}, + "other": {"Literal": "ither"}, + "others": {"Literal": "ithers"}, + "outside": {"Literal": "ootdoors"}, + "over": {"Literal": "ower"}, + "owns": {"Literal": "ains"}, + "own": {"Literal": "ain"}, + "owners": {"Literal": "gaffers"}, + "owner": {"Literal": "gaffer"}, + "paintings": {"Literal": "pentins"}, + "painting": {"Literal": "pentin"}, + "parts": {"Literal": "pairts"}, + "part": {"Literal": "pairt"}, + "partners": {"Literal": "bidies"}, + "partner": {"Literal": "bidie"}, + "party": {"Literal": "pairtie"}, + "pass": {"Literal": "bygae"}, + "past": {"Literal": "bygane"}, + "peoples": {"Literal": "fowks"}, + "people": {"Literal": "fowk"}, + "perhaps": {"Literal": "mibbie"}, + "person": {"Literal": "body"}, + "phones": {"Literal": "phanes"}, + "phone": {"Literal": "phane"}, + "places": {"Literal": "steids"}, + "place": {"Literal": "steid"}, + "plays": {"Literal": "speils"}, + "play": {"Literal": "speil"}, + "police": {"Literal": "polis"}, + "poor": {"Literal": "brassic"}, + "popular": {"Literal": "weel-kent"}, + "problems": {"Literal": "kinches"}, + "problem": {"Literal": "kinch"}, + "professionals": {"Literal": "perfaissionals"}, + "professional": {"Literal": "perfaissional"}, + "programs": {"Literal": "progrums"}, + "program": {"Literal": "progrum"}, + "provides": {"Literal": "gies"}, + "provide": {"Literal": "gie"}, + "prison": {"Literal": "preeson"}, + "Imprisonment": {"Literal": "impreesonment"}, + "prisoner": {"Literal": "preesoner"}, + "put": {"Literal": "pat"}, + "questions": {"Literal": "quaistions"}, + "question": {"Literal": "quaistion"}, + "quite": {"Literal": "ferr"}, + "radios": {"Literal": "trannies"}, + "radio": {"Literal": "tranny"}, + "rather": {"Literal": "ower"}, + "ready": {"Literal": "duin"}, + "really": {"Literal": "pure"}, + "red": {"Literal": "rid"}, + "relationships": {"Literal": "kinships"}, + "relationship": {"Literal": "kinship"}, + "remember": {"Literal": "mind"}, + "remembered": {"Literal": "minded"}, + "rights": {"Literal": "richts"}, + "right": {"Literal": "richt"}, + "roles": {"Literal": "parts"}, + "role": {"Literal": "part"}, + "round": {"Literal": "ruund"}, + "same": {"Literal": "identical"}, + "schools": {"Literal": "schuils"}, + "school": {"Literal": "schuil"}, + "scores": {"Literal": "hampden roars"}, + "score": {"Literal": "hampden roar"}, + "scuffed": {"Literal": "scotched"}, + "seasons": {"Literal": "seezins"}, + "season": {"Literal": "seezin"}, + "security": {"Literal": "polis"}, + "seconds": {"Literal": "seiconts"}, + "second": {"Literal": "seicont"}, + "several": {"Literal": "loads"}, + "shaked": {"Literal": "shoogled"}, + "shakes": {"Literal": "shoogles"}, + "shake": {"Literal": "shoogle"}, + "should": {"Literal": "shuid"}, + "shows": {"Literal": "shaws"}, + "showed": {"Literal": "shawed"}, + "show": {"Literal": "shaw"}, + "since": {"Literal": "sin"}, + "small": {"Literal": "wee"}, + "spoke": {"Literal": "spak"}, + "so": {"Literal": "sae"}, + "soldiers": {"Literal": "fighters"}, + "soldier": {"Literal": "fighter"}, + "sometimes": {"Literal": "whiles"}, + "somewhat": {"Literal": "somewhit"}, + "sore": {"Literal": "sair"}, + "stands": {"Literal": "stauns"}, + "stand": {"Literal": "staun"}, + "stars": {"Literal": "starns"}, + "star": {"Literal": "starn"}, + "starts": {"Literal": "stairts"}, + "start": {"Literal": "stairt"}, + "stays": {"Literal": "bides"}, + "stay": {"Literal": "bade"}, + "stops": {"Literal": "stoaps"}, + "stop": {"Literal": "stoap"}, + "stores": {"Literal": "hains"}, + "store": {"Literal": "hain"}, + "struck": {"Literal": "strak"}, + "streets": {"Literal": "wynds"}, + "street": {"Literal": "wynd"}, + "strong": {"Literal": "pure tough"}, + "styles": {"Literal": "pure classes"}, + "style": {"Literal": "pure class"}, + "such": {"Literal": "sic"}, + "table": {"Literal": "buird"}, + "tables": {"Literal": "buirds"}, + "takes": {"Literal": "tak`s"}, + "take": {"Literal": "tak`"}, + "talks": {"Literal": "blethers"}, + "talk": {"Literal": "blether"}, + "tasks": {"Literal": "hings"}, + "task": {"Literal": "hing"}, + "teams": {"Literal": "gangs"}, + "team": {"Literal": "gang"}, + "televisions": {"Literal": "tellyboxes"}, + "television": {"Literal": "tellybox"}, + "terminal": {"Literal": "terminus"}, + "the": {"Literal": "th`"}, + "their": {"Literal": "thair"}, + "them": {"Literal": "thaim"}, + "there": {"Literal": "thare"}, + "these": {"Literal": "thae"}, + "they": {"Literal": "thay"}, + "things": {"Literal": "hings"}, + "thing": {"Literal": "hing"}, + "those": {"Literal": "they"}, + "through": {"Literal": "thro`"}, + "throughout": {"Literal": "throo`oot"}, + "to": {"Literal": "tae"}, + "today": {"Literal": "th`day"}, + "together": {"Literal": "th`gither"}, + "tonight": {"Literal": "th`nicht"}, + "too": {"Literal": "tae"}, + "told": {"Literal": "telt"}, + "tops": {"Literal": "taps"}, + "top": {"Literal": "tap"}, + "total": {"Literal": "tot"}, + "tough": {"Literal": "hard"}, + "traitors": {"Literal": "quislings"}, + "traitor": {"Any": [ + {"Literal": "quisling"}, + {"Literal": "traitor"}, + ]}, + "troubles": {"Literal": "trauchles"}, + "trouble": {"Literal": "trauchle"}, + "turds": {"Literal": "jobbies"}, + "turd": {"Literal": "jobbie"}, + "turn": {"Literal": "caw"}, + "tvs": {"Literal": "tellies"}, + "tv": {"Literal": "telly"}, + "two": {"Literal": "twa"}, + "understand": {"Literal": "ken"}, + "until": {"Literal": "`til"}, + "uses": {"Literal": "uises"}, + "use": {"Literal": "uise"}, + "usually": {"Literal": "forordinar"}, + "very": {"Literal": "gey"}, + "victims": {"Literal": "sittin` ducks"}, + "victim": {"Literal": "sittin` duck"}, + "views": {"Literal": "sichts"}, + "view": {"Literal": "sicht"}, + "was": {"Literal": "wis"}, + "wasn't": {"Literal": "wisna"}, + "wasnt": {"Literal": "wisna"}, + "walks": {"Literal": "daunders"}, + "walk": {"Literal": "daunder"}, + "walked": {"Literal": "daundered"}, + "walking": {"Literal": "daunderin"}, + "wall": {"Literal": "dyke"}, + "want": {"Literal": "waant"}, + "water": {"Literal": "watter"}, + "way": {"Literal": "wey"}, + "warden": {"Literal": "screw"}, + "well": {"Literal": "weel"}, + "were": {"Literal": "war"}, + "west": {"Literal": "wast"}, + "what": {"Literal": "whit"}, + "whatever": {"Literal": "whitevur"}, + "when": {"Literal": "whin"}, + "where": {"Literal": "whaur"}, + "whether": {"Literal": "whither"}, + "which": {"Literal": "whilk"}, + "who": {"Literal": "wha"}, + "whole": {"Literal": "hail"}, + "whom": {"Literal": "wham"}, + "whose": {"Literal": "wha`s"}, + "wife": {"Literal": "guidwife"}, + "wives": {"Literal": "guidwives"}, + "wind": {"Literal": "win`"}, + "window": {"Literal": "windae"}, + "windows": {"Literal": "windaes"}, + "with": {"Literal": "wi`"}, + "within": {"Literal": "wi`in"}, + "without": {"Literal": "wi`oot"}, + "woman": {"Literal": "wifie"}, + "women": {"Literal": "wummin"}, + "work": {"Literal": "wirk"}, + "words": {"Literal": "wurds"}, + "world": {"Literal": "warl"}, + "worldly": {"Literal": "war'ly"}, + "working": {"Literal": "wirkin"}, + "would": {"Literal": "wid"}, + "worse": {"Literal": "waur"}, + "ruined": {"Literal": "clapped"}, + "wrong": {"Literal": "wrang"}, + "yard": {"Literal": "yaird"}, + "yeah": {"Literal": "aye"}, + "True": {"Any": [ + {"Literal": "aye"}, + {"Literal": "oan"}, + ]}, + "yet": {"Literal": "yit"}, + "you": {"Literal": "ye"}, + "your": {"Literal": "yer"}, + "youre": {"Literal": "yer'r"}, + "yourself": {"Literal": "yersel`"}, + "quiet": {"Literal": "cannie"}, + "i": {"Literal": "a"}, + "ive": {"Literal": "a've"}, + "im": {"Literal": "a'm"}, + "it": {"Literal": "et"}, + "shit": {"Literal": "shite"}, + "shitsec": {"Literal": "shitesec"}, + "alright": {"Literal": "awricht"}, + "crazy": {"Literal": "doolally"}, + "idiot": {"Any": [ + {"Literal": "eejit"}, + {"Literal": "numpty"}, + {"Literal": "mongo"}, + {"Literal": "neep"}, + ]}, + "idiots": {"Any": [ + {"Literal": "eejits"}, + {"Literal": "numptys"}, + {"Literal": "mongos"}, + {"Literal": "neeps"}, + ]}, + "ugly": {"Literal": "hackit"}, + "tired": {"Literal": "knackert"}, + "gay": {"Literal": "bufty"}, + "testing": {"Literal": "testin`"}, + "fucking": {"Any": [ + {"Literal": "fookin`"}, + {"Literal": "feckin"}, + ]}, + "fuck": {"Literal": "fook"}, + "mom": {"Any": [ + {"Literal": "maw"}, + {"Literal": "mam"}, + ]}, + "moms": {"Any": [ + {"Literal": "maws"}, + {"Literal": "mams"}, + ]}, + "throw": {"Literal": "chuck"}, + "throwing": {"Any": [ + {"Literal": "chuckin"}, + {"Literal": "chuckin'"}, + ]}, + "threw": {"Literal": "chucked"}, + "fucked": {"Any": [ + {"Literal": "fooked"}, + {"Literal": "shagged"}, + ]}, + "ass": {"Literal": "arse"}, + "asses": {"Literal": "arses"}, + "bothered": {"Literal": "arsed"}, + "dick": {"Literal": "boaby"}, + "dicks": {"Literal": "boabys"}, + "something": {"Literal": "suhin"}, + "somethings": {"Literal": "suhins"}, + "boys": {"Any": [ + {"Literal": "lads"}, + {"Literal": "laddies"}, + ]}, + "girls": {"Any": [ + {"Literal": "lasses"}, + {"Literal": "lassies"}, + {"Literal": "burds"}, + ]}, + }, + ), + "ending": ( + rules: { + "$": {"Weights": { + 2: {"Literal": " ye daft cunt"}, + 8: {"Original": ()}, + }}, + }, + ), + }, + intensities: { + 1: Extend({ + "ending": ( + rules: { + "$": {"Weights": { + 1: {"Literal": " ye daft cunt"}, + 1: {"Original": ()}, + }}, + }, + ), + }), + 2: Extend({ + "ending": ( + rules: { + "$": {"Literal": " ye daft cunt"}, + }, + ), + }), + } + ) +) diff --git a/assets/accents/spurdo.accent.ron b/assets/accents/spurdo.accent.ron new file mode 100644 index 00000000..05e78583 --- /dev/null +++ b/assets/accents/spurdo.accent.ron @@ -0,0 +1,88 @@ +( + name: "Spurdo", + description: "Finnish accent", + body: ( + accent: { + "main": ( + rules: { + r"\bepic\b": {"Literal": "ebin"}, + r"\b:?\)\b": {"Any": [ + {"Literal": ":D"}, + {"Literal": ":DD"}, + {"Literal": ":DDD"}, + ]}, + r"\Bng\b": {"Literal": "gn"}, + "xc": {"Literal": "gg"}, + "c": {"Literal": "g"}, + "k": {"Literal": "g"}, + "t": {"Literal": "d"}, + "p": {"Literal": "b"}, + "x": {"Literal": "gs"}, + }, + ), + "ending": ( + rules: { + "$": {"Weights": { + 1: {"Original": ()}, + 1: {"Any": [ + {"Literal": " :D"}, + {"Literal": " :DD"}, + {"Literal": " :DDD"}, + {"Literal": " :DDDD"}, + {"Literal": " :DDDDD"}, + ]}, + }}, + }, + ), + }, + intensities: { + 1: Extend({ + "main": ( + rules: { + r"\b:?\)\b": {"Any": [ + {"Literal": ":DD"}, + {"Literal": ":DDD"}, + {"Literal": ":DDDD"}, + ]}, + }, + ), + "ending": ( + rules: { + "$": {"Weights": { + 1: {"Original": ()}, + 2: {"Any": [ + {"Literal": " :DD"}, + {"Literal": " :DDD"}, + {"Literal": " :DDDD"}, + {"Literal": " :DDDDD"}, + {"Literal": " :DDDDDD"}, + ]}, + }}, + }, + ), + }), + 2: Extend({ + "main": ( + rules: { + r"\b:?\)\b": {"Any": [ + {"Literal": ":DDDD"}, + {"Literal": ":DDDDD"}, + {"Literal": ":DDDDDD"}, + ]}, + }, + ), + "ending": ( + rules: { + "$": {"Any": [ + {"Literal": " :DDDD"}, + {"Literal": " :DDDDD"}, + {"Literal": " :DDDDDD"}, + {"Literal": " :DDDDDDD"}, + {"Literal": " :DDDDDDDD"}, + ]}, + }, + ), + }), + }, + ), +) diff --git a/crates/maps/Cargo.toml b/crates/maps/Cargo.toml index 27668b62..06617454 100644 --- a/crates/maps/Cargo.toml +++ b/crates/maps/Cargo.toml @@ -9,6 +9,6 @@ edition = "2021" networking = { path = "../networking" } bevy = { workspace = true } bevy_rapier3d = { workspace = true } -serde = { version = "*", features = ["derive"] } +serde = { workspace = true } enum-map = "2.4.1" arrayvec = "0.7.2" diff --git a/crates/networking/Cargo.toml b/crates/networking/Cargo.toml index 5c7f0c3a..e4dd6746 100644 --- a/crates/networking/Cargo.toml +++ b/crates/networking/Cargo.toml @@ -11,7 +11,7 @@ physics = { path = "../physics" } bevy = { workspace = true } bevy_renet = "0.0.9" bytes = { version = "1.4.0", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +serde = { workspace = true } bincode = "1.3.3" bevy_rapier3d = { workspace = true } flume = "0.10.14" diff --git a/crates/physics/Cargo.toml b/crates/physics/Cargo.toml index 5ce552ce..880f046c 100644 --- a/crates/physics/Cargo.toml +++ b/crates/physics/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" [dependencies] bevy = { workspace = true } bevy_rapier3d = { workspace = true } -serde = { version = "*", features = ["derive"] } +serde = { workspace = true } diff --git a/crates/speech/Cargo.toml b/crates/speech/Cargo.toml new file mode 100644 index 00000000..c116e7e3 --- /dev/null +++ b/crates/speech/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "speech" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +bevy = { workspace = true } +bevy_common_assets = { workspace = true } +serde = { workspace = true } +ron = "0.8.1" +sayit = "0.3.0" diff --git a/crates/speech/accents b/crates/speech/accents new file mode 120000 index 00000000..814122d2 --- /dev/null +++ b/crates/speech/accents @@ -0,0 +1 @@ +../../assets/accents \ No newline at end of file diff --git a/crates/speech/src/lib.rs b/crates/speech/src/lib.rs new file mode 100644 index 00000000..458a7b3d --- /dev/null +++ b/crates/speech/src/lib.rs @@ -0,0 +1,76 @@ +use bevy::{ + prelude::*, + reflect::{TypePath, TypeUuid}, +}; +use bevy_common_assets::ron::RonAssetPlugin; + +use serde::Deserialize; + +pub struct SpeechPlugin; + +impl Plugin for SpeechPlugin { + fn build(&self, app: &mut App) { + app.add_plugins(RonAssetPlugin::::new(&["accent.ron"])) + .add_systems(Startup, load_assets); + } +} + +#[derive(Deserialize, TypeUuid, TypePath)] +#[uuid = "8cdd90cc-96bb-4f7d-97e9-06dccad18d7b"] +pub struct AccentDefinition { + pub name: String, + pub description: String, + + // serde(flatten) is currently broken and is likely unsolvable until this is resolved: + // https://github.com/serde-rs/serde/issues/1183 + // #[serde(flatten)] + pub body: sayit::Accent, +} + +#[derive(Resource)] +pub struct AccentAssets { + // Used to keep definitions loaded + #[allow(dead_code)] + definitions: Vec>, +} + +fn load_assets(mut commands: Commands, server: ResMut) { + let assets = AccentAssets { + definitions: server + .load_folder("accents") + .expect("assets/accents is missing") + .into_iter() + .map(HandleUntyped::typed) + .collect(), + }; + commands.insert_resource(assets); +} + +#[cfg(test)] +mod tests { + use std::fs; + + use crate::AccentDefinition; + + #[test] + fn included_accents_can_be_parsed() { + for file in std::fs::read_dir("accents").expect("read symlinked accents folder") { + let path = file.unwrap().path(); + + if !path.is_file() { + continue; + } + + if !path.extension().is_some_and(|ext| ext == "ron") { + continue; + } + + println!("parsing {}", path.display()); + + assert!(ron::from_str::( + &fs::read_to_string(path).expect("reading file") + ) + .is_ok()); + } + } +} diff --git a/src/communication.rs b/src/communication.rs index 767751ac..82ed96f8 100644 --- a/src/communication.rs +++ b/src/communication.rs @@ -1,6 +1,10 @@ -use std::ops::Range; +use std::{borrow::Cow, ops::Range}; -use bevy::{prelude::*, utils::HashMap}; +use bevy::{ + asset::{AssetPathId, HandleId}, + prelude::*, + utils::HashMap, +}; use bevy_egui::{egui, EguiContexts}; use networking::{ identity::{NetworkIdentities, NetworkIdentity}, @@ -10,6 +14,7 @@ use networking::{ Players, }; use serde::{Deserialize, Serialize}; +use speech::AccentDefinition; use crate::{camera::MainCamera, ui::has_window, GameState}; @@ -181,6 +186,8 @@ pub struct SpeechName(pub String); struct SpeakMessage { text: String, kind: ChatKind, + // these are manually selected by user for now + selected_accents: Vec<(AssetPathId, u64)>, } /// Server message when someone said something @@ -196,6 +203,7 @@ fn handle_speech( controlled: Res, identities: Res, names: Query>, + accent_data: Res>, mut sender: MessageSender, ) { for event in messages.iter() { @@ -214,7 +222,22 @@ fn handle_speech( _ => "Unknown".to_owned(), }; - let text = event.message.text.as_str(); + let text = event + .message + .selected_accents + .iter() + .filter_map(|(handle_id, intensity)| { + accent_data + .get(&accent_data.get_handle(*handle_id)) + .map(|accent| (accent, intensity)) + }) + .fold( + Cow::Borrowed(&event.message.text), + |acc, (accent, intensity)| { + Cow::Owned(accent.body.say_it(&acc, *intensity).into_owned()) + }, + ); + let text = text.as_ref(); // TODO: Use chat kind (ex. OOC) @@ -252,6 +275,8 @@ struct ClientChat { history: egui::text::LayoutJob, bubbles: HashMap, bubble_id: usize, + // these are manually selected by user for now + selected_accents: Vec, } struct SpeechBubble { @@ -265,6 +290,7 @@ fn client_chat_box( mut data: ResMut, mut keyboard: ResMut>, mut sender: MessageSender, + accent_data: Res>, ) { egui::Window::new("Chat") .anchor(egui::Align2::RIGHT_BOTTOM, egui::Vec2::ZERO) @@ -276,6 +302,30 @@ fn client_chat_box( ui.label(data.history.clone()); }); + // accent list + ui.separator(); + ui.horizontal_wrapped(|ui| { + for (handle_id, accent) in accent_data.iter() { + let has_accent = data.selected_accents.contains(&handle_id); + let mut button_active = has_accent; + + let mut response = ui.toggle_value(&mut button_active, &accent.name); + if response.clicked() { + if has_accent { + if let Some(index) = + data.selected_accents.iter().position(|i| *i == handle_id) + { + data.selected_accents.remove(index); + } + } else { + data.selected_accents.push(handle_id); + } + response.mark_changed(); + } + } + }); + ui.separator(); + let response = egui::TextEdit::singleline(&mut data.input_chat) .hint_text("Talk") .id_source("chat_input") @@ -295,6 +345,15 @@ fn client_chat_box( sender.send_to_server(&SpeakMessage { text: std::mem::take(&mut data.input_chat), kind: ChatKind::Local, + selected_accents: data + .selected_accents + .iter() + .map(|handle| match handle { + HandleId::Id(_, _) => panic!("Accent must be asset"), + // accent intensity is hardcoded to 0 for now + HandleId::AssetPathId(id) => (id.to_owned(), 0), + }) + .collect(), }); } data.input_chat.clear(); diff --git a/src/main.rs b/src/main.rs index 4cdbe22e..04324e7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -163,6 +163,7 @@ fn main() { body::BodyPlugin, round::RoundPlugin, job::JobPlugin, + speech::SpeechPlugin, interaction::InteractionPlugin, construction::ConstructionPlugin, combat::CombatPlugin,