diff --git a/.helix/ignore b/.helix/ignore index 10f3355..25da40d 100644 --- a/.helix/ignore +++ b/.helix/ignore @@ -1,2 +1 @@ jong-db -bevy_spacetimedb diff --git a/Cargo.lock b/Cargo.lock index f3d8fff..08176cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,9 +249,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" [[package]] name = "anymap" @@ -312,7 +312,7 @@ checksum = "f548ad2c4031f2902e3edc1f29c29e835829437de49562d8eb5dc5584d3a1043" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -447,9 +447,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bevy" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec689b5a79452b6f777b889bbff22d3216b82a8d2ab7814d4a0eb571e9938d97" +checksum = "76d3ee8652fe0577fd8a99054e147740850140d530be8e044a9be4e23a3e8a24" dependencies = [ "bevy_dylib", "bevy_internal", @@ -457,9 +457,9 @@ dependencies = [ [[package]] name = "bevy_a11y" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef69b6d2dec07cbf407c63f6987e1746e4b735a9beea51f4bfc25ad49e344f75" +checksum = "6702a82db1b383641fc7c503451847cdafb57076c203cd3bfe549d3eeef474c3" dependencies = [ "accesskit", "bevy_app", @@ -470,18 +470,18 @@ dependencies = [ [[package]] name = "bevy_android" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008133458cfe0d43a8870bfc4c5a729467cc5d9246611462add38bcf45ed896f" +checksum = "42b2d9435e9fe8d7107bb795a6140277872ad5b992cb3934f8d28cfd11040f6f" dependencies = [ "android-activity", ] [[package]] name = "bevy_animation" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c852457843456c695ed22562969c83c3823454c3c40d359f92415371208ee7" +checksum = "bfaf3ea6d435f4736b3deb60958270443501f5795c7964b1b504abd3be970b4f" dependencies = [ "bevy_animation_macros", "bevy_app", @@ -500,7 +500,7 @@ dependencies = [ "derive_more 2.1.1", "downcast-rs 2.0.2", "either", - "petgraph 0.8.3", + "petgraph", "ron", "serde", "smallvec", @@ -512,20 +512,20 @@ dependencies = [ [[package]] name = "bevy_animation_macros" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac120bfd5a74e05f96013817d28318dc716afaa68864af069c7ffc3ccaf9d153" +checksum = "d577eae7246a1cda461df1b63188619fc6a3c619adba2a8e5a79e9aa51f64671" dependencies = [ "bevy_macro_utils", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_anti_alias" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418087f7c36a62c9886b55be6278e7b3d21c9943b107953aa2068000956a736" +checksum = "15820535cc88bc280f55635eb3ea58df2703a434a0cc2343472eaa7e607fb27b" dependencies = [ "bevy_app", "bevy_asset", @@ -545,9 +545,9 @@ dependencies = [ [[package]] name = "bevy_app" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2271a0123a7cc355c3fe98754360c75aa84b29f2a6b1a9f8c00aac427570d174" +checksum = "8e4fc5dfe9d1d9b8233e1878353b5e66a3f5910c2131d3abf68f9a4116b2d433" dependencies = [ "bevy_derive", "bevy_ecs", @@ -568,19 +568,17 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f7361669d1426a3359cb92f890ef9c62bd6e6b67f0190d2c5279d25ce24168" +checksum = "357787dbfaba3f73fd185e15d6df70605bddaa774f2ebbcab1aaa031f21fb6c2" dependencies = [ "async-broadcast", - "async-channel", "async-fs", "async-lock", "atomicow", "bevy_android", "bevy_app", "bevy_asset_macros", - "bevy_diagnostic", "bevy_ecs", "bevy_platform", "bevy_reflect", @@ -595,8 +593,8 @@ dependencies = [ "either", "futures-io", "futures-lite", - "futures-util", "js-sys", + "parking_lot", "ron", "serde", "stackfuture", @@ -610,21 +608,21 @@ dependencies = [ [[package]] name = "bevy_asset_macros" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "288e1edf17069afe2e02a0c0e7e5936b3d22a67c7d2dc9201a27e4451875f909" +checksum = "afa09271d4ca0bf31fda3a9ad57273775d448a05c4046d9367f71d29968d85b4" dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_audio" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3cbecfc6c5d3860f224f56d3152b14aa313168d35c16e847f5a0202a992c3af" +checksum = "d79e56e072001524100b00e38cfdea302d9fdabbff48109fc67b528b27a237bb" dependencies = [ "bevy_app", "bevy_asset", @@ -640,9 +638,9 @@ dependencies = [ [[package]] name = "bevy_camera" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c7e1f2a5da1755cd58e45c762f4ea2d72cef6c480f9c8ddbadbd2a4380c616" +checksum = "8af1d5a57fde6e577e7b1db58996afb381618294be75a37b3070a20d309678b0" dependencies = [ "bevy_app", "bevy_asset", @@ -666,9 +664,9 @@ dependencies = [ [[package]] name = "bevy_color" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74727302424d7ffc23528a974dbb44a34708662926e1a3bfc5040493f858886e" +checksum = "49504fac6b9897f03b4bdc0189c04ef1ba0a9b37926343aa520a71619e90e116" dependencies = [ "bevy_math", "bevy_reflect", @@ -682,16 +680,15 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e6bf0ba878bb5dd00ad4d70875b08eb11367829668c70d95785f5483ddb1cb" +checksum = "6af7e735685a652a8dba41b886f1330faeb57d4c61398917b7e49b09a7a1c3c1" dependencies = [ "bevy_app", "bevy_asset", "bevy_camera", "bevy_color", "bevy_derive", - "bevy_diagnostic", "bevy_ecs", "bevy_image", "bevy_math", @@ -712,49 +709,20 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b6a05c31f54c83d681f1b8699bbaf581f06b25a40c9a6bb815625f731f5ba9" +checksum = "f9396b256b366a43d7f61d1f230cdab0a512fb4712cbf7d688f3d6fce4c5ea8a" dependencies = [ "bevy_macro_utils", "quote", - "syn 2.0.117", -] - -[[package]] -name = "bevy_dev_tools" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3183daa165acce210c50c170c47433c90b1d55932ead9734ebca14b7cd242c4" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_camera", - "bevy_color", - "bevy_diagnostic", - "bevy_ecs", - "bevy_image", - "bevy_input", - "bevy_math", - "bevy_picking", - "bevy_reflect", - "bevy_render", - "bevy_shader", - "bevy_state", - "bevy_text", - "bevy_time", - "bevy_transform", - "bevy_ui", - "bevy_ui_render", - "bevy_window", - "tracing", + "syn 2.0.116", ] [[package]] name = "bevy_diagnostic" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aca4caa8a9014a435dca382b1bdebaee4363e9be69882c598fc4ff4d7cd56e6a" +checksum = "d1cdb0ed0c8423570fbbb7c4fc2719a203dd40928fefff45f76ef0889685a446" dependencies = [ "atomic-waker", "bevy_app", @@ -770,18 +738,18 @@ dependencies = [ [[package]] name = "bevy_dylib" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603d142e406440bf7508bb70188a5c8c48339151ccfa18aebf6f353d7a3e4134" +checksum = "d50a92aea6e896b6939ea51db6ced3a7e2dfd591016286e3eed9cb60d9e4f149" dependencies = [ "bevy_internal", ] [[package]] name = "bevy_ecs" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24637a7c8643cab493f4085cda6bde4895f0e0816699c59006f18819da2ca0b8" +checksum = "a7dd5229dd00d00e70ac6b2fc0a139961252f6ce07d3d268cfcac0da86d5bde4" dependencies = [ "arrayvec", "bevy_ecs_macros", @@ -807,21 +775,21 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb14c18ca71e11c69fbae873c2db129064efac6d52e48d0127d37bfba1acfa8" +checksum = "c4d83bdd2285af4867e76c691406e0a4b55611b583d0c45b6ac7bcec1b45fd48" dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_encase_derive" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f89146a8fcbfe47310fc929ee762dd3b08d4de3e3371c601529cfa8eeb861de" +checksum = "7179e985f3f1b99265cb87fe194db3b00aee8e2914888d621ff9826e1417ee19" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -829,9 +797,9 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c76417261ff3cd7ecda532b58514224aee06e76fbd87636c3a80695be7c8192" +checksum = "a39dd8fdfe93314d47355ab3c58da40b648908a368bc536872f75fad4e8f3755" dependencies = [ "bevy_app", "bevy_ecs", @@ -845,54 +813,27 @@ dependencies = [ [[package]] name = "bevy_gizmos" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc78a5699580c2dce078f4c099028d26525a5a38e8eb587a31854c660a3c5ff7" +checksum = "7ebb9e3ca4938b48e5111151ce4b08f0e6fc207b854db08fa2d8de15ecabe8f8" dependencies = [ "bevy_app", "bevy_asset", "bevy_camera", "bevy_color", - "bevy_ecs", - "bevy_gizmos_macros", - "bevy_light", - "bevy_math", - "bevy_reflect", - "bevy_time", - "bevy_transform", - "bevy_utils", -] - -[[package]] -name = "bevy_gizmos_macros" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60bb92e0ef80ff7c59429133244765515db3d313fae77ee67ffe94dab5b2725d" -dependencies = [ - "bevy_macro_utils", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "bevy_gizmos_render" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fde3172a31f81033b4f497dd9df84476f527fadb00936ede380fb646c402eb" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_camera", "bevy_core_pipeline", "bevy_ecs", - "bevy_gizmos", + "bevy_gizmos_macros", "bevy_image", + "bevy_light", "bevy_math", "bevy_mesh", "bevy_pbr", + "bevy_reflect", "bevy_render", "bevy_shader", "bevy_sprite_render", + "bevy_time", "bevy_transform", "bevy_utils", "bytemuck", @@ -900,12 +841,22 @@ dependencies = [ ] [[package]] -name = "bevy_gltf" -version = "0.18.0" +name = "bevy_gizmos_macros" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08372f222676dba313061fc71128209b82f9711e7c5cba222b5c34bf1c5c70fe" +checksum = "92c4b3c3aac86f0db85d4f708883ebdc735c3f88ac5b84c033874fcdd3540a9d" +dependencies = [ + "bevy_macro_utils", + "quote", + "syn 2.0.116", +] + +[[package]] +name = "bevy_gltf" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3479fbaf897320a3ee30c1626b4a1bee0be874ca27699c3b2f3494891d103d9b" dependencies = [ - "async-lock", "base64 0.22.1", "bevy_animation", "bevy_app", @@ -937,9 +888,9 @@ dependencies = [ [[package]] name = "bevy_image" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809101ebe678a76c4c5ba3ecad255cde9be3ae0af591cf0143ba2c157afb55e9" +checksum = "d546bbe2486bfa14971517e7ef427a9384749817c201d3afc60de0325cf52f11" dependencies = [ "bevy_app", "bevy_asset", @@ -966,9 +917,9 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2853993baf27b963a417d3603a73e02e39c5041913cd1ba7211b0a3037b191" +checksum = "8ca955b99f4dc2059e9c8574f8d95a5dd5002809fda80d062a94a553c571a467" dependencies = [ "bevy_app", "bevy_ecs", @@ -983,9 +934,9 @@ dependencies = [ [[package]] name = "bevy_input_focus" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05fc0fae5e4e081180f7f7bf8023a2b97dad13dcb5fa79eba50cda5bb95699a9" +checksum = "de4d1d0e833e31beba1f28a77152b35f946e8c45df364ec4969d58788ab9de7f" dependencies = [ "bevy_app", "bevy_ecs", @@ -1000,9 +951,9 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57463815630ea71221c0b8e7bff72d816a3071a89507c45f9e2686fbb5e1956b" +checksum = "8f5e645f9e1a24c9667c768b6233beaf4e241739d8ca4fbba59435cc27aabad5" dependencies = [ "bevy_a11y", "bevy_android", @@ -1015,12 +966,10 @@ dependencies = [ "bevy_color", "bevy_core_pipeline", "bevy_derive", - "bevy_dev_tools", "bevy_diagnostic", "bevy_ecs", "bevy_gilrs", "bevy_gizmos", - "bevy_gizmos_render", "bevy_gltf", "bevy_image", "bevy_input", @@ -1054,9 +1003,9 @@ dependencies = [ [[package]] name = "bevy_light" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9968b8f8a6a766a88b66144474c39d1415edc277d042fec1526eae85e1f8b4" +checksum = "47093733280976ebd595f6e25f76603d5067ca4eb7544e59ecb0dd2fc5147810" dependencies = [ "bevy_app", "bevy_asset", @@ -1075,9 +1024,9 @@ dependencies = [ [[package]] name = "bevy_log" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406304a9b867a2de98c3edf0cc9e5a608fad1a1ddc567e15e72c186a8273ef51" +checksum = "b1a2d4ea086ac4663ab9dfb056c7b85eee39e18f7e3e9a4ae6e39897eaa155c5" dependencies = [ "android_log-sys", "bevy_app", @@ -1093,24 +1042,24 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7272fca0bf30d8ca2571a803598856104b63e5c596d52850f811ed37c5e1e3" +checksum = "62d984f9f8bd0f0d9fb020492a955e641e30e7a425f3588bf346cb3e61fec3c3" dependencies = [ + "parking_lot", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "toml_edit", ] [[package]] name = "bevy_math" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a815c514b8a6f7b11508cdc8b3a4bf0761e96a14227af40aa93cb1160989ce0" +checksum = "5fa74ae5d968749cc073da991757d3c7e3504ac6dbaac5f8c2a54b9d19b0b7ed" dependencies = [ "approx 0.5.1", - "arrayvec", "bevy_reflect", "derive_more 2.1.1", "glam", @@ -1119,15 +1068,16 @@ dependencies = [ "rand 0.9.2", "rand_distr", "serde", + "smallvec", "thiserror 2.0.18", "variadics_please", ] [[package]] name = "bevy_mesh" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aacf09d0ffd1a15baf8d201c4a34b918912a506395c2817aa55ab3d3776c09f2" +checksum = "cd9a0ea86abbd17655bc6f9f8d94461dfcd0322431f752fc03748df8b335eff2" dependencies = [ "bevy_app", "bevy_asset", @@ -1156,9 +1106,9 @@ checksum = "7ef8e4b7e61dfe7719bb03c884dc270cd46a82efb40f93e9933b990c5c190c59" [[package]] name = "bevy_pbr" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cc361c65035f7e531b592d99bce95b6ab3f643cae2abe97dfa7681363159a6" +checksum = "4c514b950cda849aa64e9b076a235913577370275125a34a478758505a19d776" dependencies = [ "bevy_app", "bevy_asset", @@ -1170,7 +1120,6 @@ dependencies = [ "bevy_ecs", "bevy_image", "bevy_light", - "bevy_log", "bevy_math", "bevy_mesh", "bevy_platform", @@ -1193,9 +1142,9 @@ dependencies = [ [[package]] name = "bevy_picking" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4d10bb2a776087e1d8a9b87e8deb091d25bcedbe6160c613df2dc5fe069c3c5" +checksum = "b371779713b40dea83b24cdb95054fe999fe8372351a317c4fb768859ac5f010" dependencies = [ "bevy_app", "bevy_asset", @@ -1217,13 +1166,14 @@ dependencies = [ [[package]] name = "bevy_platform" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b29ea749a8e85f98186ab662f607b885b97c804bb14cdb0cdf838164496d474" +checksum = "4691af6d7cfd1b5deb2fc926a43a180a546cdc3fe1e5a013fcee60db9bb2c81f" dependencies = [ "critical-section", "foldhash 0.2.0", "futures-channel", + "getrandom 0.3.4", "hashbrown 0.16.1", "js-sys", "portable-atomic", @@ -1237,9 +1187,9 @@ dependencies = [ [[package]] name = "bevy_post_process" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e1116cbc35637f267a29c7d2fe376e020f2b4402d6b525d328bae9c10460c7" +checksum = "6b857972f5d56b43b0dce2c843b75b64d5fbbd0f6177f6ecccd75e7e41f72deb" dependencies = [ "bevy_app", "bevy_asset", @@ -1267,15 +1217,13 @@ dependencies = [ [[package]] name = "bevy_ptr" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f98cbc6d34bbdb58240b72ed1731931b4991a893b3a3238bb7c42ae054aa676" +checksum = "17d24d7906c7de556033168b3485de36c59049fbaef0c2c44c715a23e0329b10" [[package]] name = "bevy_ratatui" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24368df4cff95c92448a33c46f7db4ff51016a3024d27bd2daa49d0e3ce03f4" +version = "0.10.0" dependencies = [ "bevy", "bitflags 2.11.0", @@ -1286,9 +1234,9 @@ dependencies = [ [[package]] name = "bevy_reflect" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2a977e2b8dba65b6e9c11039c5f9ef108be428f036b3d1cac13ad86ec59f9c" +checksum = "b5472b91928c0f3e4e3988c0d036b00719f19520f53a0c3f8c2af72f00e693c5" dependencies = [ "assert_type_match", "bevy_platform", @@ -1301,9 +1249,8 @@ dependencies = [ "erased-serde", "foldhash 0.2.0", "glam", - "indexmap 2.13.0", "inventory", - "petgraph 0.8.3", + "petgraph", "serde", "smallvec", "smol_str", @@ -1315,23 +1262,23 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "067af30072b1611fda1a577f1cb678b8ea2c9226133068be808dd49aac30cef0" +checksum = "083784255162fa39960aa3cf3c23af0e515db2daa7f2e796ae34df993f4d3f6c" dependencies = [ "bevy_macro_utils", "indexmap 2.13.0", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "uuid", ] [[package]] name = "bevy_render" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b2c9a276646bde8ba58a7e15711b459fb4a5cdf46c47059b7a310f97a70d9c" +checksum = "44117cbc9448b5a3118eb9c65bd9ec4c574be996148793be2443257daae6eb05" dependencies = [ "async-channel", "bevy_app", @@ -1360,7 +1307,6 @@ dependencies = [ "downcast-rs 2.0.2", "encase", "fixedbitset 0.5.7", - "glam", "image", "indexmap 2.13.0", "js-sys", @@ -1379,21 +1325,21 @@ dependencies = [ [[package]] name = "bevy_render_macros" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e16b8cac95b87021399ed19f6ab79c0b1e03101a448e3a0240934f78f66a56" +checksum = "f9557b7b6b06b1b70c147581f4f410c2de73b6f6f0e82915887020f953bacb5a" dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_scene" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046bb071ee358619f2fa9409ccced47375502b098b4107ec3385f3a1acf6600" +checksum = "7fcf6efd31fdd1e05724c95900bb1055716c8e3633b05fa731ee75db4241c17d" dependencies = [ "bevy_app", "bevy_asset", @@ -1405,7 +1351,6 @@ dependencies = [ "bevy_transform", "bevy_utils", "derive_more 2.1.1", - "ron", "serde", "thiserror 2.0.18", "uuid", @@ -1413,9 +1358,9 @@ dependencies = [ [[package]] name = "bevy_shader" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a14cb0991b2482a66b94728cbcf7482d1b74364be017197396435d3d542b8d3" +checksum = "a655de9f64e113a6e37be76401fb0d6cb84ed7cc4f891e70af4e39d26e9080c3" dependencies = [ "bevy_asset", "bevy_platform", @@ -1431,6 +1376,8 @@ dependencies = [ [[package]] name = "bevy_spacetimedb" version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aee7e9cf362911e4b4ed28f25a16bdc1ada1178375302385c8f5595e35f4d1f" dependencies = [ "bevy", "bevy_spacetimedb_macros", @@ -1445,14 +1392,14 @@ checksum = "0d280e7e01308ef9b2629d888d71845f65c3f790f3dfedecc537182175527118" dependencies = [ "heck 0.5.0", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_sprite" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3921ce1a8ce801c29d9552cbc204548bfeb16b9b829045c9e82b5917d99cc" +checksum = "52b9a80aadf102ef0b012ceba5326253638c891994c303479e9973092e4e1c8b" dependencies = [ "bevy_app", "bevy_asset", @@ -1475,9 +1422,9 @@ dependencies = [ [[package]] name = "bevy_sprite_render" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed40642fa0e1330df65b6a1bf0b14aa32fcd9d7f3306e08e0784c10362bd6265" +checksum = "5eec49a2a9185526f9828559a40b6f66d4c2dbae2df8ea2936d88ba449a5e86a" dependencies = [ "bevy_app", "bevy_asset", @@ -1507,9 +1454,9 @@ dependencies = [ [[package]] name = "bevy_state" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9453325ca0c185a043f4515158daa15a8ab19139a60fd1edaf87fbe896cb7f83" +checksum = "05e8556a55d548844fc067fac6657b62f8073c94bd7e13c86aa7573f4c2a67b3" dependencies = [ "bevy_app", "bevy_ecs", @@ -1523,20 +1470,20 @@ dependencies = [ [[package]] name = "bevy_state_macros" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d733081e57e49b3c43bdf3766d1de74c7df32e0f4db20c20437c85b1d18908de" +checksum = "bcda45913b1d6470c6b751656e72fb3f25ca6b5b7b2ee055b294aaed1eb7e5ba" dependencies = [ "bevy_macro_utils", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "bevy_tasks" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990ffedd374dd2c4fe8f0fd4bcefd5617d1ee59164b6c3fcc356a69b48e26e8e" +checksum = "bcbbfa5a58a16c4228434d3018c23fde3d78dcd76ec5f5b2b482a21f4b158dd3" dependencies = [ "async-channel", "async-executor", @@ -1553,9 +1500,9 @@ dependencies = [ [[package]] name = "bevy_text" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbb6eeaa9a63d1f8aae8c0d79f8d5e14c584a962a4ef9f69115fd7d10941101" +checksum = "fc144cc6a30ed44a88e342c22d9e3a66a0993a74f792ae07ba79318efb41a86d" dependencies = [ "bevy_app", "bevy_asset", @@ -1579,9 +1526,9 @@ dependencies = [ [[package]] name = "bevy_time" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c68b78e7ca1cc10c811cd1ded8350f53f2be11eb46946879a74c684026bff7" +checksum = "32835c3dbe082fbbe7d4f2f37f655073421f2882d4320ac2d59f922474260de4" dependencies = [ "bevy_app", "bevy_ecs", @@ -1594,9 +1541,9 @@ dependencies = [ [[package]] name = "bevy_transform" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30e3957de42c2f7d88dfe8428e739b74deab8932d2a8bbb9d4eefbd64b6aa34" +checksum = "b41fabfeaa53f51ff5ccf4d87e66836293159d50d21f6d3e16c93efb7c30f969" dependencies = [ "bevy_app", "bevy_ecs", @@ -1612,9 +1559,9 @@ dependencies = [ [[package]] name = "bevy_ui" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "889c6892e9c5c308ab225a1322d07fb2358ccf39493526cda4d5f083d717773d" +checksum = "aa0fe27b8c641c2537480774dfd9198d56779371b04dd76618db39da4e7c7483" dependencies = [ "accesskit", "bevy_a11y", @@ -1626,7 +1573,6 @@ dependencies = [ "bevy_ecs", "bevy_image", "bevy_input", - "bevy_input_focus", "bevy_math", "bevy_picking", "bevy_platform", @@ -1646,9 +1592,9 @@ dependencies = [ [[package]] name = "bevy_ui_render" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b649395e32a4761d4f17aeff37170a4421c94a14c505645397b8ee8510eb19e9" +checksum = "d1d2e783bb5f0b748e6360a0055421d5c934b43830b205a84996a75e54330cd7" dependencies = [ "bevy_app", "bevy_asset", @@ -1677,9 +1623,9 @@ dependencies = [ [[package]] name = "bevy_utils" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e258c44d869f9c41ac0f88a16815c67f2569eb9fff4716828a40273d127b6f84" +checksum = "789d04f88c764877a4552e07745b402dbc45f5d0545e6d102558f2f1752a1d89" dependencies = [ "bevy_platform", "disqualified", @@ -1688,9 +1634,9 @@ dependencies = [ [[package]] name = "bevy_window" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869a56f1da2544641734018e1f1caa660299cd6e3af794f3fa0df72293d8eed2" +checksum = "8ae54ec7a0fc344278592a688a01b57b32182abc3ca7d47040773c4cbc2e15e0" dependencies = [ "bevy_app", "bevy_asset", @@ -1707,9 +1653,9 @@ dependencies = [ [[package]] name = "bevy_winit" -version = "0.18.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8142a3749fc491eeae481c30bb3830cf5a71d2fa3dba4d450a42792f6d39eb2d" +checksum = "feeaa46d3c4480323e690de8a4ca7f914c074af1f5f70ee3246392992dbf4a0c" dependencies = [ "accesskit", "accesskit_winit", @@ -1754,7 +1700,7 @@ dependencies = [ "regex", "rustc-hash 2.1.1", "shlex", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -1886,9 +1832,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.20.2" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytemuck" @@ -1907,7 +1853,7 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2037,9 +1983,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.60" +version = "4.5.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806" dependencies = [ "clap_builder", "clap_derive", @@ -2047,9 +1993,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.60" +version = "4.5.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2" dependencies = [ "anstream", "anstyle", @@ -2066,7 +2012,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2153,18 +2099,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "console" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "windows-sys 0.59.0", -] - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -2287,15 +2221,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core_maths" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" -dependencies = [ - "libm", -] - [[package]] name = "coreaudio-rs" version = "0.11.3" @@ -2318,22 +2243,21 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.16.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cadaea21e24c49c0c82116f2b465ae6a49d63c90e428b0f8d9ae1f638ac91f" +checksum = "da46a9d5a8905cc538a4a5bceb6a4510de7a51049c5588c0114efce102bcbbe8" dependencies = [ "bitflags 2.11.0", "fontdb", - "harfrust", - "linebender_resource_handle", "log", "rangemap", "rustc-hash 1.1.0", + "rustybuzz", "self_cell", - "skrifa 0.39.0", "smol_str", "swash", "sys-locale", + "ttf-parser 0.21.1", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -2531,7 +2455,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2544,7 +2468,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2555,7 +2479,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2566,7 +2490,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core 0.23.0", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2599,9 +2523,9 @@ checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4" [[package]] name = "deranged" -version = "0.5.8" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4" dependencies = [ "powerfmt", "serde_core", @@ -2632,7 +2556,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2654,7 +2578,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.117", + "syn 2.0.116", "unicode-xid", ] @@ -2694,7 +2618,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -2745,12 +2669,6 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" -[[package]] -name = "ecow" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78e4f79b296fbaab6ce2e22d52cb4c7f010fe0ebe7a32e34fa25885fd797bd02" - [[package]] name = "either" version = "1.15.0" @@ -2759,41 +2677,36 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "encase" -version = "0.12.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3e0ff2ee0b7aa97428308dd9e1e42369cb22f5fb8dc1c55546637443a60f1e" +checksum = "02ba239319a4f60905966390f5e52799d868103a533bb7e27822792332504ddd" dependencies = [ "const_panic", "encase_derive", + "glam", "thiserror 2.0.18", ] [[package]] name = "encase_derive" -version = "0.12.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4d90c5d7d527c6cb8a3b114efd26a6304d9ab772656e73d8f4e32b1f3d601a2" +checksum = "5223d6c647f09870553224f6e37261fe5567bc5a4f4cf13ed337476e79990f2f" dependencies = [ "encase_derive_impl", ] [[package]] name = "encase_derive_impl" -version = "0.12.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8bad72d8308f7a382de2391ec978ddd736e0103846b965d7e2a63a75768af30" +checksum = "1796db3d892515842ca2dfb11124c4bb4a9e58d9f2c5c1072e5bca1b2334507b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - [[package]] name = "enum-as-inner" version = "0.6.1" @@ -2803,27 +2716,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.117", -] - -[[package]] -name = "enum-map" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" -dependencies = [ - "enum-map-derive", -] - -[[package]] -name = "enum-map-derive" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -3020,16 +2913,16 @@ dependencies = [ [[package]] name = "fontdb" -version = "0.23.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" +checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3" dependencies = [ "fontconfig-parser", "log", "memmap2", "slotmap", "tinyvec", - "ttf-parser", + "ttf-parser 0.20.0", ] [[package]] @@ -3059,7 +2952,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -3152,7 +3045,7 @@ checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -3222,9 +3115,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasip2", + "wasm-bindgen", ] [[package]] @@ -3298,7 +3193,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19fc433e8437a212d1b6f1e68c7824af3aed907da60afa994e7f542d18d12aa9" dependencies = [ "bytemuck", - "encase", "libm", "rand 0.9.2", "serde_core", @@ -3343,7 +3237,7 @@ dependencies = [ "inflections", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -3420,9 +3314,9 @@ dependencies = [ [[package]] name = "grid" -version = "1.0.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e2d4c0a8296178d8802098410ca05d86b17a10bb5ab559b3fb404c1f948220" +checksum = "36119f3a540b086b4e436bb2b588cf98a68863470e0e880f4d0842f112a3183a" [[package]] name = "guillotiere" @@ -3446,19 +3340,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "harfrust" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0caaee032384c10dd597af4579c67dee16650d862a9ccbe1233ff1a379abc07" -dependencies = [ - "bitflags 2.11.0", - "bytemuck", - "core_maths", - "read-fonts 0.36.0", - "smallvec", -] - [[package]] name = "hash32" version = "0.3.1" @@ -3499,9 +3380,9 @@ dependencies = [ [[package]] name = "heapless" -version = "0.9.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ "hash32", "portable-atomic", @@ -3795,22 +3676,6 @@ dependencies = [ "libc", ] -[[package]] -name = "insta" -version = "1.46.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4" -dependencies = [ - "console", - "once_cell", - "regex", - "serde", - "similar", - "tempfile", - "toml_edit", - "toml_writer", -] - [[package]] name = "instability" version = "0.3.11" @@ -3821,14 +3686,14 @@ dependencies = [ "indoc", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "inventory" -version = "0.3.22" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" dependencies = [ "rustversion", ] @@ -3954,9 +3819,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.88" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e709f3e3d22866f9c25b3aff01af289b18422cc8b4262fb19103ee80fe513d" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -4089,12 +3954,6 @@ dependencies = [ "bitflags 2.11.0", ] -[[package]] -name = "linebender_resource_handle" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" - [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -4265,9 +4124,9 @@ dependencies = [ [[package]] name = "naga" -version = "27.0.3" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" +checksum = "916cbc7cb27db60be930a4e2da243cf4bc39569195f22fd8ee419cd31d5b662c" dependencies = [ "arrayvec", "bit-set 0.8.0", @@ -4276,7 +4135,7 @@ dependencies = [ "cfg_aliases", "codespan-reporting", "half", - "hashbrown 0.16.1", + "hashbrown 0.15.5", "hexf-parse", "indexmap 2.13.0", "libm", @@ -4292,9 +4151,9 @@ dependencies = [ [[package]] name = "naga_oil" -version = "0.20.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310c347db1b30e69581f3b84dc9a5c311ed583f67851b39b77953cb7a066c97f" +checksum = "1b586d3cf5c9b7e13fe2af6e114406ff70773fd80881960378933b63e76f37dd" dependencies = [ "codespan-reporting", "data-encoding", @@ -4309,9 +4168,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.18" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +checksum = "9d5d26952a508f321b4d3d2e80e78fc2603eaefcdf0c30783867f19586518bdc" dependencies = [ "libc", "log", @@ -4468,7 +4327,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -4500,7 +4359,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -4839,7 +4698,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -4879,13 +4738,22 @@ dependencies = [ "num-traits", ] +[[package]] +name = "ordered-float" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2c1f9f56e534ac6a9b8a4600bdf0f530fb393b5f393e7b4d03489c3cf0c3f01" +dependencies = [ + "num-traits", +] + [[package]] name = "owned_ttf_parser" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" dependencies = [ - "ttf-parser", + "ttf-parser 0.25.1", ] [[package]] @@ -4965,7 +4833,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -4978,16 +4846,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "petgraph" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" -dependencies = [ - "fixedbitset 0.4.2", - "indexmap 2.13.0", -] - [[package]] name = "petgraph" version = "0.8.3" @@ -5041,7 +4899,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5070,7 +4928,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5184,7 +5042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5473,17 +5331,6 @@ dependencies = [ "font-types", ] -[[package]] -name = "read-fonts" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eaa2941a4c05443ee3a7b26ab076a553c343ad5995230cc2b1d3e993bdc6345" -dependencies = [ - "bytemuck", - "core_maths", - "font-types", -] - [[package]] name = "rectangle-pack" version = "0.4.2" @@ -5534,7 +5381,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5584,15 +5431,14 @@ dependencies = [ [[package]] name = "ron" -version = "0.12.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd490c5b18261893f14449cbd28cb9c0b637aebf161cd77900bfdedaff21ec32" +checksum = "beceb6f7bf81c73e73aeef6dd1356d9a1b2b4909e1f0fc3e59b034f9572d7b7f" dependencies = [ + "base64 0.22.1", "bitflags 2.11.0", - "once_cell", "serde", "serde_derive", - "typeid", "unicode-ident", ] @@ -5661,6 +5507,23 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "rustybuzz" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfb9cf8877777222e4a3bc7eb247e398b56baba500c38c1c46842431adc8b55c" +dependencies = [ + "bitflags 2.11.0", + "bytemuck", + "libm", + "smallvec", + "ttf-parser 0.21.1", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + [[package]] name = "ruzstd" version = "0.8.2" @@ -5751,9 +5614,9 @@ checksum = "4904c83c6e51f1b9b08bfa5a86f35a51798e8307186e6f5513852210a219c0bb" [[package]] name = "security-framework" -version = "3.7.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +checksum = "d17b898a6d6948c3a8ee4372c17cb384f90d2e6e912ef00895b14fd7ab54ec38" dependencies = [ "bitflags 2.11.0", "core-foundation 0.10.1", @@ -5764,9 +5627,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.17.0" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +checksum = "321c8673b092a9a42605034a9879d73cb79101ed5fd117bc9a597b89b4e9e61a" dependencies = [ "core-foundation-sys", "libc", @@ -5817,7 +5680,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5833,15 +5696,6 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_spanned" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" -dependencies = [ - "serde_core", -] - [[package]] name = "serde_with" version = "3.16.1" @@ -5870,7 +5724,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -5957,12 +5811,6 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" -[[package]] -name = "similar" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" - [[package]] name = "siphasher" version = "1.0.2" @@ -5976,17 +5824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c31071dedf532758ecf3fed987cdb4bd9509f900e026ab684b4ecb81ea49841" dependencies = [ "bytemuck", - "read-fonts 0.35.0", -] - -[[package]] -name = "skrifa" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9eb0b904a04d09bd68c65d946617b8ff733009999050f3b851c32fb3cfb60e" -dependencies = [ - "bytemuck", - "read-fonts 0.36.0", + "read-fonts", ] [[package]] @@ -6056,9 +5894,9 @@ dependencies = [ [[package]] name = "spacetimedb" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "503ac8c991a76998d4ba699ef9b7f0085d3d7c363d1fcce4219314f909746bca" +checksum = "83af98280374b59796296f512f7855fd19e19240a358bb7706a54f1c4e4e7dff" dependencies = [ "anyhow", "bytemuck", @@ -6074,37 +5912,36 @@ dependencies = [ "spacetimedb-bindings-sys", "spacetimedb-lib", "spacetimedb-primitives", - "spacetimedb-query-builder", ] [[package]] name = "spacetimedb-bindings-macro" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1214628a7c29ee58255d511b7c4dbaaa463bc5022dba9401f264c1c85b5a891c" +checksum = "4d8dbedaa26e2e59d886a19bd2b784356d8d008274046f735c9185f9943bd912" dependencies = [ "heck 0.4.1", "humantime", "proc-macro2", "quote", "spacetimedb-primitives", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] name = "spacetimedb-bindings-sys" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4777d90692bade6601887a21a074b71c157b34a92a5cfc8d5ecb46a0c571094" +checksum = "5a0d30e1655731b1564b7094a6213ef6c354ea920e3c04424e55ad377a1bc3e2" dependencies = [ "spacetimedb-primitives", ] [[package]] name = "spacetimedb-client-api-messages" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745d7ab0f81e3f6333d3ee353ce314b73841fbfe06adad69ab43efa791301da3" +checksum = "93dac13fc3dbd43698823c287c3839a3c13391dd9b33414a724c85335d1aa966" dependencies = [ "bytes", "bytestring", @@ -6124,13 +5961,12 @@ dependencies = [ [[package]] name = "spacetimedb-data-structures" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5d85162537b1eeb6eac39383e34ca27aafcbf26987753172ca3de1de1e3a838" +checksum = "43d5d42998701abb5fd4878e0ceac31bf208caccc453491620f0ff59e2e75de9" dependencies = [ "ahash", "crossbeam-queue", - "either", "hashbrown 0.16.1", "nohash-hasher", "smallvec", @@ -6139,9 +5975,9 @@ dependencies = [ [[package]] name = "spacetimedb-lib" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5e91c66b10dc38cce01928d3f77313276e34c635504e54afdec6f186a2fc9c" +checksum = "6f7284d48bcfddc7c091756c6d5d3cc9a847b95778c636fdd03b9538d74a57c7" dependencies = [ "anyhow", "bitflags 2.11.0", @@ -6149,7 +5985,6 @@ dependencies = [ "chrono", "derive_more 0.99.20", "enum-as-inner", - "enum-map", "hex", "itertools 0.12.1", "log", @@ -6161,21 +5996,11 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "spacetimedb-memory-usage" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9c081d3ffafa9c2fa11194b4ea3329773d979e342944b0128282bcbf5d3343" -dependencies = [ - "decorum", - "ethnum", -] - [[package]] name = "spacetimedb-metrics" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985858969f693529c8624ce195cb747a34f7c84f3097418f595f795c0559fbd1" +checksum = "9a759e05414bd0f41a1bd498173c3cc2aa94d83b37e564dd0f597aa5c026f3ad" dependencies = [ "arrayvec", "itertools 0.12.1", @@ -6185,32 +6010,22 @@ dependencies = [ [[package]] name = "spacetimedb-primitives" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0321a161fa39f0937aceb436b47115cd811212799ddaf7996a8ecac3476d8d" +checksum = "ff2dc124963dd166ecde2b4d8f0e5ed4cfd27a20d7f6bb9e84d7eff46cc520b5" dependencies = [ "bitflags 2.11.0", "either", "enum-as-inner", "itertools 0.12.1", "nohash-hasher", - "spacetimedb-memory-usage", -] - -[[package]] -name = "spacetimedb-query-builder" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df8137b6dc2739d4efbc6218c5fb106f1e105a1345819a74053b677bd38c429" -dependencies = [ - "spacetimedb-lib", ] [[package]] name = "spacetimedb-sats" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e07b1bc933156b0cbe6b6c759e57381ce95df52c4522d9c3d71df59c01cf20" +checksum = "df06586ffc862efd795425854cc2469c561aca5b95f5df2212aa29ef14a56f8a" dependencies = [ "anyhow", "arrayvec", @@ -6231,48 +6046,17 @@ dependencies = [ "sha3", "smallvec", "spacetimedb-bindings-macro", - "spacetimedb-memory-usage", "spacetimedb-metrics", "spacetimedb-primitives", "thiserror 1.0.69", "uuid", ] -[[package]] -name = "spacetimedb-schema" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2763b4769028f111032f00b35635f6cbb0562f54a59d05775f5ea66d7b8f8d2" -dependencies = [ - "anyhow", - "derive_more 0.99.20", - "ecow", - "enum-as-inner", - "enum-map", - "indexmap 2.13.0", - "insta", - "itertools 0.12.1", - "lazy_static", - "petgraph 0.6.5", - "serde_json", - "smallvec", - "spacetimedb-data-structures", - "spacetimedb-lib", - "spacetimedb-memory-usage", - "spacetimedb-primitives", - "spacetimedb-sats", - "spacetimedb-sql-parser", - "termcolor", - "thiserror 1.0.69", - "unicode-ident", - "unicode-normalization", -] - [[package]] name = "spacetimedb-sdk" -version = "1.12.0" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243f7b433aa0ba1d665aeb9db397b9bd40698d80817840d8fa8d8bfe74e99f00" +checksum = "b12876a6ebba7685ad52bcd1b540cd4d220bd4cf37746b3a776cb140ebc52483" dependencies = [ "anymap", "base64 0.21.7", @@ -6291,26 +6075,12 @@ dependencies = [ "spacetimedb-data-structures", "spacetimedb-lib", "spacetimedb-metrics", - "spacetimedb-query-builder", "spacetimedb-sats", - "spacetimedb-schema", "thiserror 1.0.69", "tokio", "tokio-tungstenite", ] -[[package]] -name = "spacetimedb-sql-parser" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cd63f69d4d6b074771830d8f8d12ce52c253179940c1bd02a50adeba7a9485" -dependencies = [ - "derive_more 0.99.20", - "spacetimedb-lib", - "sqlparser", - "thiserror 1.0.69", -] - [[package]] name = "spin" version = "0.10.0" @@ -6329,15 +6099,6 @@ dependencies = [ "bitflags 2.11.0", ] -[[package]] -name = "sqlparser" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0272b7bb0a225320170c99901b4b5fb3a4384e255a7f2cc228f61e2ba3893e75" -dependencies = [ - "log", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -6399,7 +6160,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6411,7 +6172,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6426,7 +6187,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47846491253e976bdd07d0f9cc24b7daf24720d11309302ccbbc6e6b6e53550a" dependencies = [ - "skrifa 0.37.0", + "skrifa", "yazi", "zeno", ] @@ -6444,9 +6205,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.117" +version = "2.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb" dependencies = [ "proc-macro2", "quote", @@ -6461,7 +6222,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6489,9 +6250,9 @@ dependencies = [ [[package]] name = "taffy" -version = "0.9.2" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ba83ebaf2954d31d05d67340fd46cebe99da2b7133b0dd68d70c65473a437b" +checksum = "ab4f4d046dd956a47a7e1a2947083d7ac3e6aa3cfaaead36173ceaa5ab11878c" dependencies = [ "arrayvec", "grid", @@ -6563,7 +6324,7 @@ dependencies = [ "nix 0.29.0", "num-derive", "num-traits", - "ordered-float", + "ordered-float 4.6.0", "pest", "pest_derive", "phf", @@ -6610,7 +6371,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6621,7 +6382,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6741,7 +6502,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6784,29 +6545,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap 2.13.0", - "serde_core", - "serde_spanned", "toml_datetime", "toml_parser", - "toml_writer", "winnow", ] [[package]] name = "toml_parser" -version = "1.0.9+spec-1.1.0" +version = "1.0.8+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" +checksum = "0742ff5ff03ea7e67c8ae6c93cac239e0d9784833362da3f9a9c1da8dfefcbdc" dependencies = [ "winnow", ] -[[package]] -name = "toml_writer" -version = "1.0.6+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" - [[package]] name = "tracing" version = "0.1.44" @@ -6826,7 +6578,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -6901,14 +6653,23 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ttf-parser" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" + +[[package]] +name = "ttf-parser" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" + [[package]] name = "ttf-parser" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" -dependencies = [ - "core_maths", -] [[package]] name = "tui-logger" @@ -6982,6 +6743,18 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" +[[package]] +name = "unicode-bidi-mirroring" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" + +[[package]] +name = "unicode-ccc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -6995,13 +6768,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] -name = "unicode-normalization" -version = "0.1.25" +name = "unicode-properties" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" -dependencies = [ - "tinyvec", -] +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-script" @@ -7095,7 +6865,7 @@ checksum = "41b6d82be61465f97d42bd1d15bf20f3b0a3a0905018f38f9d6f6962055b0b5c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -7161,9 +6931,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.111" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1adf1535672f5b7824f817792b1afd731d7e843d2d04ec8f27e8cb51edd8ac" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", @@ -7174,9 +6944,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.61" +version = "0.4.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe88540d1c934c4ec8e6db0afa536876c5441289d7f9f9123d4f065ac1250a6b" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" dependencies = [ "cfg-if", "futures-util", @@ -7188,9 +6958,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.111" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e638317c08b21663aed4d2b9a2091450548954695ff4efa75bff5fa546b3b1" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7198,22 +6968,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.111" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c64760850114d03d5f65457e96fc988f11f01d38fbaa51b254e4ab5809102af" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.111" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60eecd4fe26177cfa3339eb00b4a36445889ba3ad37080c2429879718e20ca41" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] @@ -7362,9 +7132,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.88" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6bb20ed2d9572df8584f6dc81d68a41a625cadc6f15999d649a70ce7e3597a" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -7422,7 +7192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac" dependencies = [ "log", - "ordered-float", + "ordered-float 4.6.0", "strsim", "thiserror 1.0.69", "wezterm-dynamic-derive", @@ -7454,16 +7224,16 @@ dependencies = [ [[package]] name = "wgpu" -version = "27.0.1" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" +checksum = "70b6ff82bbf6e9206828e1a3178e851f8c20f1c9028e74dd3a8090741ccd5798" dependencies = [ "arrayvec", "bitflags 2.11.0", "cfg-if", "cfg_aliases", "document-features", - "hashbrown 0.16.1", + "hashbrown 0.15.5", "js-sys", "log", "naga", @@ -7481,18 +7251,17 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "27.0.3" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" +checksum = "d5f62f1053bd28c2268f42916f31588f81f64796e2ff91b81293515017ca8bd9" dependencies = [ "arrayvec", "bit-set 0.8.0", "bit-vec 0.8.0", "bitflags 2.11.0", - "bytemuck", "cfg_aliases", "document-features", - "hashbrown 0.16.1", + "hashbrown 0.15.5", "indexmap 2.13.0", "log", "naga", @@ -7513,36 +7282,36 @@ dependencies = [ [[package]] name = "wgpu-core-deps-apple" -version = "27.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" +checksum = "18ae5fbde6a4cbebae38358aa73fcd6e0f15c6144b67ef5dc91ded0db125dbdf" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-core-deps-wasm" -version = "27.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1027dcf3b027a877e44819df7ceb0e2e98578830f8cd34cd6c3c7c2a7a50b7" +checksum = "c03b9f9e1a50686d315fc6debe4980cc45cd37b0e919351917df494e8fdc8885" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-core-deps-windows-linux-android" -version = "27.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" +checksum = "720a5cb9d12b3d337c15ff0e24d3e97ed11490ff3f7506e7f3d98c68fa5d6f14" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-hal" -version = "27.0.4" +version = "26.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" +checksum = "a8d0e67224cc7305b3b4eb2cc57ca4c4c3afc665c1d1bee162ea806e19c47bdd" dependencies = [ "android_system_properties", "arrayvec", @@ -7559,7 +7328,7 @@ dependencies = [ "gpu-alloc", "gpu-allocator", "gpu-descriptor", - "hashbrown 0.16.1", + "hashbrown 0.15.5", "js-sys", "khronos-egl", "libc", @@ -7569,8 +7338,7 @@ dependencies = [ "naga", "ndk-sys 0.6.0+11769913", "objc", - "once_cell", - "ordered-float", + "ordered-float 5.0.0", "parking_lot", "portable-atomic", "portable-atomic-util", @@ -7589,9 +7357,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "27.0.1" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" +checksum = "eca7a8d8af57c18f57d393601a1fb159ace8b2328f1b6b5f80893f7d672c9ae2" dependencies = [ "bitflags 2.11.0", "bytemuck", @@ -7775,7 +7543,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -7786,7 +7554,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -7797,7 +7565,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -7808,7 +7576,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -8247,7 +8015,7 @@ dependencies = [ "heck 0.5.0", "indexmap 2.13.0", "prettyplease", - "syn 2.0.117", + "syn 2.0.116", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -8263,7 +8031,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -8399,7 +8167,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "synstructure", ] @@ -8426,7 +8194,7 @@ checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] @@ -8446,7 +8214,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", "synstructure", ] @@ -8480,7 +8248,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.116", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 1c9bb29..03b5cd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,16 +6,16 @@ members = ["jong", "jong-types", "jong-line", "jong-db"] jong = { version = "0.1.0", path = "jong" } jong-types = { version = "0.1.0", path = "jong-types" } -bevy.version = "0.18" +bevy.version = "0.17.3" bevy.default-features = false -bevy_ratatui = "0.11.1" +bevy_ratatui = "0.10.0" bevy_spacetimedb = "0.7" -spacetimedb.version = "1.12.*" +spacetimedb.version = "1.11.*" spacetimedb.features = ["unstable"] -spacetimedb-sdk = "1.12.*" +spacetimedb-sdk = "1.11.*" strum.version = "0.27.2" strum.features = ["derive"] @@ -35,4 +35,5 @@ opt-level = 1 opt-level = 3 [patch.crates-io] -bevy_spacetimedb = { path = "bevy_spacetimedb/bevy_spacetimedb" } +bevy_ratatui = { path = "/home/tao/clones/bevy_ratatui" } +# bevy_spacetimedb = { path = "/home/tao/clones/bevy_spacetimedb/bevy_spacetimedb" } diff --git a/devenv.lock b/devenv.lock index 08cedca..4ccffe2 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1771672827, + "lastModified": 1771157881, "owner": "cachix", "repo": "devenv", - "rev": "6757a742f6393c7070f159eed9a59cbe20690aa3", + "rev": "b0b3dfa70ec90fa49f672e579f186faf4f61bd4b", "type": "github" }, "original": { @@ -125,10 +125,10 @@ ] }, "locked": { - "lastModified": 1771729765, + "lastModified": 1771211437, "owner": "oxalica", "repo": "rust-overlay", - "rev": "be926cb1a76e8450ab2b92121b2e88d09fa4d41c", + "rev": "c62195b3d6e1bb11e0c2fb2a494117d3b55d410f", "type": "github" }, "original": { diff --git a/devenv.nix b/devenv.nix index 9899754..af52a59 100644 --- a/devenv.nix +++ b/devenv.nix @@ -18,13 +18,13 @@ # https://devenv.sh/packages/ packages = with pkgs; [ - lspmux + # lspmux pkg-config # spacetimedb openssl binaryen - # spacetimedb + spacetimedb # bevy Linux # Audio (Linux only) diff --git a/jong-db/src/db/advance_game_reducer.rs b/jong-db/src/db/advance_game_reducer.rs deleted file mode 100644 index a35faad..0000000 --- a/jong-db/src/db/advance_game_reducer.rs +++ /dev/null @@ -1,107 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -use super::game_timer_type::GameTimer; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub(super) struct AdvanceGameArgs { - pub game_timer: GameTimer, -} - -impl From for super::Reducer { - fn from(args: AdvanceGameArgs) -> Self { - Self::AdvanceGame { - game_timer: args.game_timer, - } - } -} - -impl __sdk::InModule for AdvanceGameArgs { - type Module = super::RemoteModule; -} - -pub struct AdvanceGameCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `advance_game`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait advance_game { - /// Request that the remote module invoke the reducer `advance_game` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_advance_game`] callbacks. - fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `advance_game`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`AdvanceGameCallbackId`] can be passed to [`Self::remove_on_advance_game`] - /// to cancel the callback. - fn on_advance_game( - &self, - callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static, - ) -> AdvanceGameCallbackId; - /// Cancel a callback previously registered by [`Self::on_advance_game`], - /// causing it not to run in the future. - fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId); -} - -impl advance_game for super::RemoteReducers { - fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()> { - self.imp - .call_reducer("advance_game", AdvanceGameArgs { game_timer }) - } - fn on_advance_game( - &self, - mut callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static, - ) -> AdvanceGameCallbackId { - AdvanceGameCallbackId(self.imp.on_reducer( - "advance_game", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: - __sdk::ReducerEvent { - reducer: super::Reducer::AdvanceGame { game_timer }, - .. - }, - .. - } = ctx - else { - unreachable!() - }; - callback(ctx, game_timer) - }), - )) - } - fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId) { - self.imp.remove_on_reducer("advance_game", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `advance_game`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_advance_game { - /// Set the call-reducer flags for the reducer `advance_game` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn advance_game(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_advance_game for super::SetReducerFlags { - fn advance_game(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("advance_game", flags); - } -} diff --git a/jong-db/src/db/advance_state_timer_table.rs b/jong-db/src/db/advance_state_timer_table.rs new file mode 100644 index 0000000..a6096e0 --- /dev/null +++ b/jong-db/src/db/advance_state_timer_table.rs @@ -0,0 +1,144 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +#![allow(unused, clippy::all)] +use super::advance_state_timer_type::AdvanceStateTimer; +use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; + +/// Table handle for the table `advance_state_timer`. +/// +/// Obtain a handle from the [`AdvanceStateTimerTableAccess::advance_state_timer`] method on [`super::RemoteTables`], +/// like `ctx.db.advance_state_timer()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.advance_state_timer().on_insert(...)`. +pub struct AdvanceStateTimerTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `advance_state_timer`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AdvanceStateTimerTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AdvanceStateTimerTableHandle`], which mediates access to the table `advance_state_timer`. + fn advance_state_timer(&self) -> AdvanceStateTimerTableHandle<'_>; +} + +impl AdvanceStateTimerTableAccess for super::RemoteTables { + fn advance_state_timer(&self) -> AdvanceStateTimerTableHandle<'_> { + AdvanceStateTimerTableHandle { + imp: self + .imp + .get_table::("advance_state_timer"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AdvanceStateTimerInsertCallbackId(__sdk::CallbackId); +pub struct AdvanceStateTimerDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AdvanceStateTimerTableHandle<'ctx> { + type Row = AdvanceStateTimer; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { + self.imp.count() + } + fn iter(&self) -> impl Iterator + '_ { + self.imp.iter() + } + + type InsertCallbackId = AdvanceStateTimerInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AdvanceStateTimerInsertCallbackId { + AdvanceStateTimerInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AdvanceStateTimerInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AdvanceStateTimerDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AdvanceStateTimerDeleteCallbackId { + AdvanceStateTimerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AdvanceStateTimerDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + let _table = client_cache.get_or_make_table::("advance_state_timer"); + _table.add_unique_constraint::("scheduled_id", |row| &row.scheduled_id); +} +pub struct AdvanceStateTimerUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AdvanceStateTimerTableHandle<'ctx> { + type UpdateCallbackId = AdvanceStateTimerUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AdvanceStateTimerUpdateCallbackId { + AdvanceStateTimerUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AdvanceStateTimerUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, +) -> __sdk::Result<__sdk::TableUpdate> { + __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { + __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") + .with_cause(e) + .into() + }) +} + +/// Access to the `scheduled_id` unique index on the table `advance_state_timer`, +/// which allows point queries on the field of the same name +/// via the [`AdvanceStateTimerScheduledIdUnique::find`] method. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.advance_state_timer().scheduled_id().find(...)`. +pub struct AdvanceStateTimerScheduledIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +impl<'ctx> AdvanceStateTimerTableHandle<'ctx> { + /// Get a handle on the `scheduled_id` unique index on the table `advance_state_timer`. + pub fn scheduled_id(&self) -> AdvanceStateTimerScheduledIdUnique<'ctx> { + AdvanceStateTimerScheduledIdUnique { + imp: self.imp.get_unique_constraint::("scheduled_id"), + phantom: std::marker::PhantomData, + } + } +} + +impl<'ctx> AdvanceStateTimerScheduledIdUnique<'ctx> { + /// Find the subscribed row whose `scheduled_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &u64) -> Option { + self.imp.find(col_val) + } +} diff --git a/jong-db/src/db/advance_state_timer_type.rs b/jong-db/src/db/advance_state_timer_type.rs new file mode 100644 index 0000000..8411902 --- /dev/null +++ b/jong-db/src/db/advance_state_timer_type.rs @@ -0,0 +1,17 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] +pub struct AdvanceStateTimer { + pub scheduled_id: u64, + pub scheduled_at: __sdk::ScheduleAt, + pub lobby_id: u32, +} + +impl __sdk::InModule for AdvanceStateTimer { + type Module = super::RemoteModule; +} diff --git a/jong-db/src/db/bot_table.rs b/jong-db/src/db/bot_table.rs index d062239..7c9d250 100644 --- a/jong-db/src/db/bot_table.rs +++ b/jong-db/src/db/bot_table.rs @@ -4,7 +4,6 @@ #![allow(unused, clippy::all)] use super::bot_type::Bot; use super::db_tile_type::DbTile; -use super::turn_state_type::TurnState; use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; /// Table handle for the table `bot`. @@ -142,19 +141,3 @@ impl<'ctx> BotIdUnique<'ctx> { self.imp.find(col_val) } } - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `Bot`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait botQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `Bot`. - fn bot(&self) -> __sdk::__query_builder::Table; -} - -impl botQueryTableAccess for __sdk::QueryTableAccessor { - fn bot(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("bot") - } -} diff --git a/jong-db/src/db/bot_type.rs b/jong-db/src/db/bot_type.rs index 58acb75..23ef7d9 100644 --- a/jong-db/src/db/bot_type.rs +++ b/jong-db/src/db/bot_type.rs @@ -5,63 +5,17 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; use super::db_tile_type::DbTile; -use super::turn_state_type::TurnState; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Bot { pub id: u32, pub lobby_id: u32, - pub turn_state: TurnState, pub hand: Vec, pub pond: Vec, - pub working_tile: Option, + pub drawn_tile: Option, } impl __sdk::InModule for Bot { type Module = super::RemoteModule; } - -/// Column accessor struct for the table `Bot`. -/// -/// Provides typed access to columns for query building. -pub struct BotCols { - pub id: __sdk::__query_builder::Col, - pub lobby_id: __sdk::__query_builder::Col, - pub turn_state: __sdk::__query_builder::Col, - pub hand: __sdk::__query_builder::Col>, - pub pond: __sdk::__query_builder::Col>, - pub working_tile: __sdk::__query_builder::Col>, -} - -impl __sdk::__query_builder::HasCols for Bot { - type Cols = BotCols; - fn cols(table_name: &'static str) -> Self::Cols { - BotCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"), - turn_state: __sdk::__query_builder::Col::new(table_name, "turn_state"), - hand: __sdk::__query_builder::Col::new(table_name, "hand"), - pond: __sdk::__query_builder::Col::new(table_name, "pond"), - working_tile: __sdk::__query_builder::Col::new(table_name, "working_tile"), - } - } -} - -/// Indexed column accessor struct for the table `Bot`. -/// -/// Provides typed access to indexed columns for query building. -pub struct BotIxCols { - pub id: __sdk::__query_builder::IxCol, - pub lobby_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for Bot { - type IxCols = BotIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - BotIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"), - } - } -} diff --git a/jong-db/src/db/db_tile_type.rs b/jong-db/src/db/db_tile_type.rs index 9bd4f8e..cf5c736 100644 --- a/jong-db/src/db/db_tile_type.rs +++ b/jong-db/src/db/db_tile_type.rs @@ -16,37 +16,3 @@ pub struct DbTile { impl __sdk::InModule for DbTile { type Module = super::RemoteModule; } - -/// Column accessor struct for the table `DbTile`. -/// -/// Provides typed access to columns for query building. -pub struct DbTileCols { - pub id: __sdk::__query_builder::Col, - pub tile: __sdk::__query_builder::Col, -} - -impl __sdk::__query_builder::HasCols for DbTile { - type Cols = DbTileCols; - fn cols(table_name: &'static str) -> Self::Cols { - DbTileCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - tile: __sdk::__query_builder::Col::new(table_name, "tile"), - } - } -} - -/// Indexed column accessor struct for the table `DbTile`. -/// -/// Provides typed access to indexed columns for query building. -pub struct DbTileIxCols { - pub id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for DbTile { - type IxCols = DbTileIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - DbTileIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - } - } -} diff --git a/jong-db/src/db/db_wall_type.rs b/jong-db/src/db/db_wall_type.rs index 47ec2cc..20688c7 100644 --- a/jong-db/src/db/db_wall_type.rs +++ b/jong-db/src/db/db_wall_type.rs @@ -16,37 +16,3 @@ pub struct DbWall { impl __sdk::InModule for DbWall { type Module = super::RemoteModule; } - -/// Column accessor struct for the table `DbWall`. -/// -/// Provides typed access to columns for query building. -pub struct DbWallCols { - pub lobby_id: __sdk::__query_builder::Col, - pub tiles: __sdk::__query_builder::Col>, -} - -impl __sdk::__query_builder::HasCols for DbWall { - type Cols = DbWallCols; - fn cols(table_name: &'static str) -> Self::Cols { - DbWallCols { - lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"), - tiles: __sdk::__query_builder::Col::new(table_name, "tiles"), - } - } -} - -/// Indexed column accessor struct for the table `DbWall`. -/// -/// Provides typed access to indexed columns for query building. -pub struct DbWallIxCols { - pub lobby_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for DbWall { - type IxCols = DbWallIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - DbWallIxCols { - lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"), - } - } -} diff --git a/jong-db/src/db/connect_reducer.rs b/jong-db/src/db/draw_tile_reducer.rs similarity index 55% rename from jong-db/src/db/connect_reducer.rs rename to jong-db/src/db/draw_tile_reducer.rs index a59a446..daed29a 100644 --- a/jong-db/src/db/connect_reducer.rs +++ b/jong-db/src/db/draw_tile_reducer.rs @@ -6,63 +6,63 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub(super) struct ConnectArgs {} +pub(super) struct DrawTileArgs {} -impl From for super::Reducer { - fn from(args: ConnectArgs) -> Self { - Self::Connect +impl From for super::Reducer { + fn from(args: DrawTileArgs) -> Self { + Self::DrawTile } } -impl __sdk::InModule for ConnectArgs { +impl __sdk::InModule for DrawTileArgs { type Module = super::RemoteModule; } -pub struct ConnectCallbackId(__sdk::CallbackId); +pub struct DrawTileCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `connect`. +/// Extension trait for access to the reducer `draw_tile`. /// /// Implemented for [`super::RemoteReducers`]. -pub trait connect { - /// Request that the remote module invoke the reducer `connect` to run as soon as possible. +pub trait draw_tile { + /// Request that the remote module invoke the reducer `draw_tile` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_connect`] callbacks. - fn connect(&self) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `connect`. + /// and its status can be observed by listening for [`Self::on_draw_tile`] callbacks. + fn draw_tile(&self) -> __sdk::Result<()>; + /// Register a callback to run whenever we are notified of an invocation of the reducer `draw_tile`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// - /// The returned [`ConnectCallbackId`] can be passed to [`Self::remove_on_connect`] + /// The returned [`DrawTileCallbackId`] can be passed to [`Self::remove_on_draw_tile`] /// to cancel the callback. - fn on_connect( + fn on_draw_tile( &self, callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> ConnectCallbackId; - /// Cancel a callback previously registered by [`Self::on_connect`], + ) -> DrawTileCallbackId; + /// Cancel a callback previously registered by [`Self::on_draw_tile`], /// causing it not to run in the future. - fn remove_on_connect(&self, callback: ConnectCallbackId); + fn remove_on_draw_tile(&self, callback: DrawTileCallbackId); } -impl connect for super::RemoteReducers { - fn connect(&self) -> __sdk::Result<()> { - self.imp.call_reducer("connect", ConnectArgs {}) +impl draw_tile for super::RemoteReducers { + fn draw_tile(&self) -> __sdk::Result<()> { + self.imp.call_reducer("draw_tile", DrawTileArgs {}) } - fn on_connect( + fn on_draw_tile( &self, mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> ConnectCallbackId { - ConnectCallbackId(self.imp.on_reducer( - "connect", + ) -> DrawTileCallbackId { + DrawTileCallbackId(self.imp.on_reducer( + "draw_tile", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { - reducer: super::Reducer::Connect {}, + reducer: super::Reducer::DrawTile {}, .. }, .. @@ -74,27 +74,27 @@ impl connect for super::RemoteReducers { }), )) } - fn remove_on_connect(&self, callback: ConnectCallbackId) { - self.imp.remove_on_reducer("connect", callback.0) + fn remove_on_draw_tile(&self, callback: DrawTileCallbackId) { + self.imp.remove_on_reducer("draw_tile", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `connect`. +/// Extension trait for setting the call-flags for the reducer `draw_tile`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_connect { - /// Set the call-reducer flags for the reducer `connect` to `flags`. +pub trait set_flags_for_draw_tile { + /// Set the call-reducer flags for the reducer `draw_tile` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. - fn connect(&self, flags: __ws::CallReducerFlags); + fn draw_tile(&self, flags: __ws::CallReducerFlags); } -impl set_flags_for_connect for super::SetReducerFlags { - fn connect(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("connect", flags); +impl set_flags_for_draw_tile for super::SetReducerFlags { + fn draw_tile(&self, flags: __ws::CallReducerFlags) { + self.imp.set_call_reducer_flags("draw_tile", flags); } } diff --git a/jong-db/src/db/game_timer_table.rs b/jong-db/src/db/game_timer_table.rs deleted file mode 100644 index 9d29ade..0000000 --- a/jong-db/src/db/game_timer_table.rs +++ /dev/null @@ -1,189 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::game_timer_type::GameTimer; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `game_timer`. -/// -/// Obtain a handle from the [`GameTimerTableAccess::game_timer`] method on [`super::RemoteTables`], -/// like `ctx.db.game_timer()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.game_timer().on_insert(...)`. -pub struct GameTimerTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `game_timer`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait GameTimerTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`GameTimerTableHandle`], which mediates access to the table `game_timer`. - fn game_timer(&self) -> GameTimerTableHandle<'_>; -} - -impl GameTimerTableAccess for super::RemoteTables { - fn game_timer(&self) -> GameTimerTableHandle<'_> { - GameTimerTableHandle { - imp: self.imp.get_table::("game_timer"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct GameTimerInsertCallbackId(__sdk::CallbackId); -pub struct GameTimerDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> { - type Row = GameTimer; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = GameTimerInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> GameTimerInsertCallbackId { - GameTimerInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: GameTimerInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = GameTimerDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> GameTimerDeleteCallbackId { - GameTimerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: GameTimerDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("game_timer"); - _table.add_unique_constraint::("id", |row| &row.id); - _table.add_unique_constraint::("lobby_id", |row| &row.lobby_id); -} -pub struct GameTimerUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for GameTimerTableHandle<'ctx> { - type UpdateCallbackId = GameTimerUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> GameTimerUpdateCallbackId { - GameTimerUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: GameTimerUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} - -/// Access to the `id` unique index on the table `game_timer`, -/// which allows point queries on the field of the same name -/// via the [`GameTimerIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.game_timer().id().find(...)`. -pub struct GameTimerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> GameTimerTableHandle<'ctx> { - /// Get a handle on the `id` unique index on the table `game_timer`. - pub fn id(&self) -> GameTimerIdUnique<'ctx> { - GameTimerIdUnique { - imp: self.imp.get_unique_constraint::("id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> GameTimerIdUnique<'ctx> { - /// Find the subscribed row whose `id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u64) -> Option { - self.imp.find(col_val) - } -} - -/// Access to the `lobby_id` unique index on the table `game_timer`, -/// which allows point queries on the field of the same name -/// via the [`GameTimerLobbyIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.game_timer().lobby_id().find(...)`. -pub struct GameTimerLobbyIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> GameTimerTableHandle<'ctx> { - /// Get a handle on the `lobby_id` unique index on the table `game_timer`. - pub fn lobby_id(&self) -> GameTimerLobbyIdUnique<'ctx> { - GameTimerLobbyIdUnique { - imp: self.imp.get_unique_constraint::("lobby_id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> GameTimerLobbyIdUnique<'ctx> { - /// Find the subscribed row whose `lobby_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `GameTimer`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait game_timerQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `GameTimer`. - fn game_timer(&self) -> __sdk::__query_builder::Table; -} - -impl game_timerQueryTableAccess for __sdk::QueryTableAccessor { - fn game_timer(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("game_timer") - } -} diff --git a/jong-db/src/db/game_timer_type.rs b/jong-db/src/db/game_timer_type.rs deleted file mode 100644 index 80b8a73..0000000 --- a/jong-db/src/db/game_timer_type.rs +++ /dev/null @@ -1,55 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct GameTimer { - pub id: u64, - pub lobby_id: u32, - pub scheduled_at: __sdk::ScheduleAt, -} - -impl __sdk::InModule for GameTimer { - type Module = super::RemoteModule; -} - -/// Column accessor struct for the table `GameTimer`. -/// -/// Provides typed access to columns for query building. -pub struct GameTimerCols { - pub id: __sdk::__query_builder::Col, - pub lobby_id: __sdk::__query_builder::Col, - pub scheduled_at: __sdk::__query_builder::Col, -} - -impl __sdk::__query_builder::HasCols for GameTimer { - type Cols = GameTimerCols; - fn cols(table_name: &'static str) -> Self::Cols { - GameTimerCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"), - scheduled_at: __sdk::__query_builder::Col::new(table_name, "scheduled_at"), - } - } -} - -/// Indexed column accessor struct for the table `GameTimer`. -/// -/// Provides typed access to indexed columns for query building. -pub struct GameTimerIxCols { - pub id: __sdk::__query_builder::IxCol, - pub lobby_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for GameTimer { - type IxCols = GameTimerIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - GameTimerIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"), - } - } -} diff --git a/jong-db/src/db/lobby_table.rs b/jong-db/src/db/lobby_table.rs index 8d7f499..98b9f62 100644 --- a/jong-db/src/db/lobby_table.rs +++ b/jong-db/src/db/lobby_table.rs @@ -5,6 +5,7 @@ use super::game_state_type::GameState; use super::lobby_type::Lobby; use super::player_or_bot_type::PlayerOrBot; +use super::turn_state_type::TurnState; use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; /// Table handle for the table `lobby`. @@ -84,6 +85,7 @@ impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> { pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("lobby"); _table.add_unique_constraint::("id", |row| &row.id); + _table.add_unique_constraint::("host_player_id", |row| &row.host_player_id); } pub struct LobbyUpdateCallbackId(__sdk::CallbackId); @@ -143,18 +145,32 @@ impl<'ctx> LobbyIdUnique<'ctx> { } } -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `Lobby`. +/// Access to the `host_player_id` unique index on the table `lobby`, +/// which allows point queries on the field of the same name +/// via the [`LobbyHostPlayerIdUnique::find`] method. /// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait lobbyQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `Lobby`. - fn lobby(&self) -> __sdk::__query_builder::Table; +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.lobby().host_player_id().find(...)`. +pub struct LobbyHostPlayerIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } -impl lobbyQueryTableAccess for __sdk::QueryTableAccessor { - fn lobby(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("lobby") +impl<'ctx> LobbyTableHandle<'ctx> { + /// Get a handle on the `host_player_id` unique index on the table `lobby`. + pub fn host_player_id(&self) -> LobbyHostPlayerIdUnique<'ctx> { + LobbyHostPlayerIdUnique { + imp: self.imp.get_unique_constraint::("host_player_id"), + phantom: std::marker::PhantomData, + } + } +} + +impl<'ctx> LobbyHostPlayerIdUnique<'ctx> { + /// Find the subscribed row whose `host_player_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &u32) -> Option { + self.imp.find(col_val) } } diff --git a/jong-db/src/db/lobby_type.rs b/jong-db/src/db/lobby_type.rs index af8dda7..a295a91 100644 --- a/jong-db/src/db/lobby_type.rs +++ b/jong-db/src/db/lobby_type.rs @@ -6,57 +6,20 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; use super::game_state_type::GameState; use super::player_or_bot_type::PlayerOrBot; +use super::turn_state_type::TurnState; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Lobby { pub id: u32, + pub host_player_id: u32, pub players: Vec, pub dealer_idx: u8, pub current_idx: u8, pub game_state: GameState, + pub turn_state: TurnState, } impl __sdk::InModule for Lobby { type Module = super::RemoteModule; } - -/// Column accessor struct for the table `Lobby`. -/// -/// Provides typed access to columns for query building. -pub struct LobbyCols { - pub id: __sdk::__query_builder::Col, - pub players: __sdk::__query_builder::Col>, - pub dealer_idx: __sdk::__query_builder::Col, - pub current_idx: __sdk::__query_builder::Col, - pub game_state: __sdk::__query_builder::Col, -} - -impl __sdk::__query_builder::HasCols for Lobby { - type Cols = LobbyCols; - fn cols(table_name: &'static str) -> Self::Cols { - LobbyCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - players: __sdk::__query_builder::Col::new(table_name, "players"), - dealer_idx: __sdk::__query_builder::Col::new(table_name, "dealer_idx"), - current_idx: __sdk::__query_builder::Col::new(table_name, "current_idx"), - game_state: __sdk::__query_builder::Col::new(table_name, "game_state"), - } - } -} - -/// Indexed column accessor struct for the table `Lobby`. -/// -/// Provides typed access to indexed columns for query building. -pub struct LobbyIxCols { - pub id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for Lobby { - type IxCols = LobbyIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - LobbyIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - } - } -} diff --git a/jong-db/src/db/logged_out_player_table.rs b/jong-db/src/db/logged_out_player_table.rs deleted file mode 100644 index 1de7240..0000000 --- a/jong-db/src/db/logged_out_player_table.rs +++ /dev/null @@ -1,191 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::player_type::Player; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `logged_out_player`. -/// -/// Obtain a handle from the [`LoggedOutPlayerTableAccess::logged_out_player`] method on [`super::RemoteTables`], -/// like `ctx.db.logged_out_player()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.logged_out_player().on_insert(...)`. -pub struct LoggedOutPlayerTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `logged_out_player`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait LoggedOutPlayerTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`LoggedOutPlayerTableHandle`], which mediates access to the table `logged_out_player`. - fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_>; -} - -impl LoggedOutPlayerTableAccess for super::RemoteTables { - fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_> { - LoggedOutPlayerTableHandle { - imp: self.imp.get_table::("logged_out_player"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct LoggedOutPlayerInsertCallbackId(__sdk::CallbackId); -pub struct LoggedOutPlayerDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> { - type Row = Player; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = LoggedOutPlayerInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> LoggedOutPlayerInsertCallbackId { - LoggedOutPlayerInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: LoggedOutPlayerInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = LoggedOutPlayerDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> LoggedOutPlayerDeleteCallbackId { - LoggedOutPlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: LoggedOutPlayerDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("logged_out_player"); - _table.add_unique_constraint::("id", |row| &row.id); - _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity); -} -pub struct LoggedOutPlayerUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for LoggedOutPlayerTableHandle<'ctx> { - type UpdateCallbackId = LoggedOutPlayerUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> LoggedOutPlayerUpdateCallbackId { - LoggedOutPlayerUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: LoggedOutPlayerUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} - -/// Access to the `id` unique index on the table `logged_out_player`, -/// which allows point queries on the field of the same name -/// via the [`LoggedOutPlayerIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.logged_out_player().id().find(...)`. -pub struct LoggedOutPlayerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> LoggedOutPlayerTableHandle<'ctx> { - /// Get a handle on the `id` unique index on the table `logged_out_player`. - pub fn id(&self) -> LoggedOutPlayerIdUnique<'ctx> { - LoggedOutPlayerIdUnique { - imp: self.imp.get_unique_constraint::("id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> LoggedOutPlayerIdUnique<'ctx> { - /// Find the subscribed row whose `id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -/// Access to the `identity` unique index on the table `logged_out_player`, -/// which allows point queries on the field of the same name -/// via the [`LoggedOutPlayerIdentityUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.logged_out_player().identity().find(...)`. -pub struct LoggedOutPlayerIdentityUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> LoggedOutPlayerTableHandle<'ctx> { - /// Get a handle on the `identity` unique index on the table `logged_out_player`. - pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> { - LoggedOutPlayerIdentityUnique { - imp: self - .imp - .get_unique_constraint::<__sdk::Identity>("identity"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> { - /// Find the subscribed row whose `identity` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &__sdk::Identity) -> Option { - self.imp.find(col_val) - } -} - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `Player`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait logged_out_playerQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `Player`. - fn logged_out_player(&self) -> __sdk::__query_builder::Table; -} - -impl logged_out_playerQueryTableAccess for __sdk::QueryTableAccessor { - fn logged_out_player(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("logged_out_player") - } -} diff --git a/jong-db/src/db/login_or_add_player_reducer.rs b/jong-db/src/db/login_or_add_player_reducer.rs new file mode 100644 index 0000000..f94c20f --- /dev/null +++ b/jong-db/src/db/login_or_add_player_reducer.rs @@ -0,0 +1,103 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] +pub(super) struct LoginOrAddPlayerArgs {} + +impl From for super::Reducer { + fn from(args: LoginOrAddPlayerArgs) -> Self { + Self::LoginOrAddPlayer + } +} + +impl __sdk::InModule for LoginOrAddPlayerArgs { + type Module = super::RemoteModule; +} + +pub struct LoginOrAddPlayerCallbackId(__sdk::CallbackId); + +#[allow(non_camel_case_types)] +/// Extension trait for access to the reducer `login_or_add_player`. +/// +/// Implemented for [`super::RemoteReducers`]. +pub trait login_or_add_player { + /// Request that the remote module invoke the reducer `login_or_add_player` to run as soon as possible. + /// + /// This method returns immediately, and errors only if we are unable to send the request. + /// The reducer will run asynchronously in the future, + /// and its status can be observed by listening for [`Self::on_login_or_add_player`] callbacks. + fn login_or_add_player(&self) -> __sdk::Result<()>; + /// Register a callback to run whenever we are notified of an invocation of the reducer `login_or_add_player`. + /// + /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] + /// to determine the reducer's status. + /// + /// The returned [`LoginOrAddPlayerCallbackId`] can be passed to [`Self::remove_on_login_or_add_player`] + /// to cancel the callback. + fn on_login_or_add_player( + &self, + callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, + ) -> LoginOrAddPlayerCallbackId; + /// Cancel a callback previously registered by [`Self::on_login_or_add_player`], + /// causing it not to run in the future. + fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId); +} + +impl login_or_add_player for super::RemoteReducers { + fn login_or_add_player(&self) -> __sdk::Result<()> { + self.imp + .call_reducer("login_or_add_player", LoginOrAddPlayerArgs {}) + } + fn on_login_or_add_player( + &self, + mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, + ) -> LoginOrAddPlayerCallbackId { + LoginOrAddPlayerCallbackId(self.imp.on_reducer( + "login_or_add_player", + Box::new(move |ctx: &super::ReducerEventContext| { + #[allow(irrefutable_let_patterns)] + let super::ReducerEventContext { + event: + __sdk::ReducerEvent { + reducer: super::Reducer::LoginOrAddPlayer {}, + .. + }, + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), + )) + } + fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId) { + self.imp + .remove_on_reducer("login_or_add_player", callback.0) + } +} + +#[allow(non_camel_case_types)] +#[doc(hidden)] +/// Extension trait for setting the call-flags for the reducer `login_or_add_player`. +/// +/// Implemented for [`super::SetReducerFlags`]. +/// +/// This type is currently unstable and may be removed without a major version bump. +pub trait set_flags_for_login_or_add_player { + /// Set the call-reducer flags for the reducer `login_or_add_player` to `flags`. + /// + /// This type is currently unstable and may be removed without a major version bump. + fn login_or_add_player(&self, flags: __ws::CallReducerFlags); +} + +impl set_flags_for_login_or_add_player for super::SetReducerFlags { + fn login_or_add_player(&self, flags: __ws::CallReducerFlags) { + self.imp + .set_call_reducer_flags("login_or_add_player", flags); + } +} diff --git a/jong-db/src/db/mod.rs b/jong-db/src/db/mod.rs index b1eefc3..3eb7040 100644 --- a/jong-db/src/db/mod.rs +++ b/jong-db/src/db/mod.rs @@ -1,80 +1,74 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.12.0 (commit 4fdb8d923f39ed592931ad4c7e6391ed99b9fe3a). +// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094). #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; pub mod add_bot_reducer; -pub mod advance_game_reducer; +pub mod advance_state_timer_table; +pub mod advance_state_timer_type; pub mod bot_table; pub mod bot_type; pub mod clear_all_reducer; -pub mod connect_reducer; pub mod db_tile_type; pub mod db_wall_type; pub mod discard_tile_reducer; -pub mod disconnect_reducer; pub mod dragon_type; +pub mod draw_tile_reducer; pub mod game_state_type; -pub mod game_timer_table; -pub mod game_timer_type; pub mod join_or_create_lobby_reducer; pub mod lobby_table; pub mod lobby_type; -pub mod logged_out_player_table; -pub mod player_clock_table; -pub mod player_clock_type; -pub mod player_hand_table; -pub mod player_hand_type; +pub mod login_or_add_player_reducer; pub mod player_or_bot_type; pub mod player_table; pub mod player_type; pub mod rank_type; pub mod set_ready_reducer; +pub mod shuffle_deal_reducer; +pub mod skip_call_reducer; +pub mod start_game_reducer; pub mod suit_type; pub mod tile_table; pub mod tile_type; pub mod turn_state_type; -pub mod view_hand_table; pub mod wall_table; pub mod wind_type; pub use add_bot_reducer::{add_bot, set_flags_for_add_bot, AddBotCallbackId}; -pub use advance_game_reducer::{advance_game, set_flags_for_advance_game, AdvanceGameCallbackId}; +pub use advance_state_timer_table::*; +pub use advance_state_timer_type::AdvanceStateTimer; pub use bot_table::*; pub use bot_type::Bot; pub use clear_all_reducer::{clear_all, set_flags_for_clear_all, ClearAllCallbackId}; -pub use connect_reducer::{connect, set_flags_for_connect, ConnectCallbackId}; pub use db_tile_type::DbTile; pub use db_wall_type::DbWall; pub use discard_tile_reducer::{discard_tile, set_flags_for_discard_tile, DiscardTileCallbackId}; -pub use disconnect_reducer::{disconnect, set_flags_for_disconnect, DisconnectCallbackId}; pub use dragon_type::Dragon; +pub use draw_tile_reducer::{draw_tile, set_flags_for_draw_tile, DrawTileCallbackId}; pub use game_state_type::GameState; -pub use game_timer_table::*; -pub use game_timer_type::GameTimer; pub use join_or_create_lobby_reducer::{ join_or_create_lobby, set_flags_for_join_or_create_lobby, JoinOrCreateLobbyCallbackId, }; pub use lobby_table::*; pub use lobby_type::Lobby; -pub use logged_out_player_table::*; -pub use player_clock_table::*; -pub use player_clock_type::PlayerClock; -pub use player_hand_table::*; -pub use player_hand_type::PlayerHand; +pub use login_or_add_player_reducer::{ + login_or_add_player, set_flags_for_login_or_add_player, LoginOrAddPlayerCallbackId, +}; pub use player_or_bot_type::PlayerOrBot; pub use player_table::*; pub use player_type::Player; pub use rank_type::Rank; pub use set_ready_reducer::{set_flags_for_set_ready, set_ready, SetReadyCallbackId}; +pub use shuffle_deal_reducer::{set_flags_for_shuffle_deal, shuffle_deal, ShuffleDealCallbackId}; +pub use skip_call_reducer::{set_flags_for_skip_call, skip_call, SkipCallCallbackId}; +pub use start_game_reducer::{set_flags_for_start_game, start_game, StartGameCallbackId}; pub use suit_type::Suit; pub use tile_table::*; pub use tile_type::Tile; pub use turn_state_type::TurnState; -pub use view_hand_table::*; pub use wall_table::*; pub use wind_type::Wind; @@ -87,13 +81,15 @@ pub use wind_type::Wind; pub enum Reducer { AddBot { lobby_id: u32 }, - AdvanceGame { game_timer: GameTimer }, ClearAll, - Connect, DiscardTile { tile_id: u32 }, - Disconnect, + DrawTile, JoinOrCreateLobby { lobby_id: u32 }, + LoginOrAddPlayer, SetReady { ready: bool }, + ShuffleDeal { lobby_id: u32 }, + SkipCall, + StartGame, } impl __sdk::InModule for Reducer { @@ -104,13 +100,15 @@ impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { Reducer::AddBot { .. } => "add_bot", - Reducer::AdvanceGame { .. } => "advance_game", Reducer::ClearAll => "clear_all", - Reducer::Connect => "connect", Reducer::DiscardTile { .. } => "discard_tile", - Reducer::Disconnect => "disconnect", + Reducer::DrawTile => "draw_tile", Reducer::JoinOrCreateLobby { .. } => "join_or_create_lobby", + Reducer::LoginOrAddPlayer => "login_or_add_player", Reducer::SetReady { .. } => "set_ready", + Reducer::ShuffleDeal { .. } => "shuffle_deal", + Reducer::SkipCall => "skip_call", + Reducer::StartGame => "start_game", _ => unreachable!(), } } @@ -124,13 +122,6 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { &value.args, )? .into()), - "advance_game" => Ok( - __sdk::parse_reducer_args::( - "advance_game", - &value.args, - )? - .into(), - ), "clear_all" => Ok( __sdk::parse_reducer_args::( "clear_all", @@ -138,11 +129,6 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { )? .into(), ), - "connect" => Ok(__sdk::parse_reducer_args::( - "connect", - &value.args, - )? - .into()), "discard_tile" => Ok( __sdk::parse_reducer_args::( "discard_tile", @@ -150,9 +136,9 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { )? .into(), ), - "disconnect" => Ok( - __sdk::parse_reducer_args::( - "disconnect", + "draw_tile" => Ok( + __sdk::parse_reducer_args::( + "draw_tile", &value.args, )? .into(), @@ -161,6 +147,10 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { join_or_create_lobby_reducer::JoinOrCreateLobbyArgs, >("join_or_create_lobby", &value.args)? .into()), + "login_or_add_player" => Ok(__sdk::parse_reducer_args::< + login_or_add_player_reducer::LoginOrAddPlayerArgs, + >("login_or_add_player", &value.args)? + .into()), "set_ready" => Ok( __sdk::parse_reducer_args::( "set_ready", @@ -168,6 +158,27 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { )? .into(), ), + "shuffle_deal" => Ok( + __sdk::parse_reducer_args::( + "shuffle_deal", + &value.args, + )? + .into(), + ), + "skip_call" => Ok( + __sdk::parse_reducer_args::( + "skip_call", + &value.args, + )? + .into(), + ), + "start_game" => Ok( + __sdk::parse_reducer_args::( + "start_game", + &value.args, + )? + .into(), + ), unknown => { Err( __sdk::InternalError::unknown_name("reducer", unknown, "ReducerCallInfo") @@ -182,15 +193,11 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { #[allow(non_snake_case)] #[doc(hidden)] pub struct DbUpdate { + advance_state_timer: __sdk::TableUpdate, bot: __sdk::TableUpdate, - game_timer: __sdk::TableUpdate, lobby: __sdk::TableUpdate, - logged_out_player: __sdk::TableUpdate, player: __sdk::TableUpdate, - player_clock: __sdk::TableUpdate, - player_hand: __sdk::TableUpdate, tile: __sdk::TableUpdate, - view_hand: __sdk::TableUpdate, wall: __sdk::TableUpdate, } @@ -200,33 +207,21 @@ impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { let mut db_update = DbUpdate::default(); for table_update in raw.tables { match &table_update.table_name[..] { + "advance_state_timer" => db_update + .advance_state_timer + .append(advance_state_timer_table::parse_table_update(table_update)?), "bot" => db_update .bot .append(bot_table::parse_table_update(table_update)?), - "game_timer" => db_update - .game_timer - .append(game_timer_table::parse_table_update(table_update)?), "lobby" => db_update .lobby .append(lobby_table::parse_table_update(table_update)?), - "logged_out_player" => db_update - .logged_out_player - .append(logged_out_player_table::parse_table_update(table_update)?), "player" => db_update .player .append(player_table::parse_table_update(table_update)?), - "player_clock" => db_update - .player_clock - .append(player_clock_table::parse_table_update(table_update)?), - "player_hand" => db_update - .player_hand - .append(player_hand_table::parse_table_update(table_update)?), "tile" => db_update .tile .append(tile_table::parse_table_update(table_update)?), - "view_hand" => db_update - .view_hand - .append(view_hand_table::parse_table_update(table_update)?), "wall" => db_update .wall .append(wall_table::parse_table_update(table_update)?), @@ -256,34 +251,27 @@ impl __sdk::DbUpdate for DbUpdate { ) -> AppliedDiff<'_> { let mut diff = AppliedDiff::default(); + diff.advance_state_timer = cache + .apply_diff_to_table::( + "advance_state_timer", + &self.advance_state_timer, + ) + .with_updates_by_pk(|row| &row.scheduled_id); diff.bot = cache .apply_diff_to_table::("bot", &self.bot) .with_updates_by_pk(|row| &row.id); - diff.game_timer = cache - .apply_diff_to_table::("game_timer", &self.game_timer) - .with_updates_by_pk(|row| &row.id); diff.lobby = cache .apply_diff_to_table::("lobby", &self.lobby) .with_updates_by_pk(|row| &row.id); - diff.logged_out_player = cache - .apply_diff_to_table::("logged_out_player", &self.logged_out_player) - .with_updates_by_pk(|row| &row.identity); diff.player = cache .apply_diff_to_table::("player", &self.player) .with_updates_by_pk(|row| &row.identity); - diff.player_clock = cache - .apply_diff_to_table::("player_clock", &self.player_clock) - .with_updates_by_pk(|row| &row.id); - diff.player_hand = cache - .apply_diff_to_table::("player_hand", &self.player_hand) - .with_updates_by_pk(|row| &row.id); diff.tile = cache .apply_diff_to_table::("tile", &self.tile) .with_updates_by_pk(|row| &row.id); diff.wall = cache .apply_diff_to_table::("wall", &self.wall) .with_updates_by_pk(|row| &row.lobby_id); - diff.view_hand = cache.apply_diff_to_table::("view_hand", &self.view_hand); diff } @@ -293,15 +281,11 @@ impl __sdk::DbUpdate for DbUpdate { #[allow(non_snake_case)] #[doc(hidden)] pub struct AppliedDiff<'r> { + advance_state_timer: __sdk::TableAppliedDiff<'r, AdvanceStateTimer>, bot: __sdk::TableAppliedDiff<'r, Bot>, - game_timer: __sdk::TableAppliedDiff<'r, GameTimer>, lobby: __sdk::TableAppliedDiff<'r, Lobby>, - logged_out_player: __sdk::TableAppliedDiff<'r, Player>, player: __sdk::TableAppliedDiff<'r, Player>, - player_clock: __sdk::TableAppliedDiff<'r, PlayerClock>, - player_hand: __sdk::TableAppliedDiff<'r, PlayerHand>, tile: __sdk::TableAppliedDiff<'r, DbTile>, - view_hand: __sdk::TableAppliedDiff<'r, PlayerHand>, wall: __sdk::TableAppliedDiff<'r, DbWall>, __unused: std::marker::PhantomData<&'r ()>, } @@ -316,23 +300,15 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> { event: &EventContext, callbacks: &mut __sdk::DbCallbacks, ) { + callbacks.invoke_table_row_callbacks::( + "advance_state_timer", + &self.advance_state_timer, + event, + ); callbacks.invoke_table_row_callbacks::("bot", &self.bot, event); - callbacks.invoke_table_row_callbacks::("game_timer", &self.game_timer, event); callbacks.invoke_table_row_callbacks::("lobby", &self.lobby, event); - callbacks.invoke_table_row_callbacks::( - "logged_out_player", - &self.logged_out_player, - event, - ); callbacks.invoke_table_row_callbacks::("player", &self.player, event); - callbacks.invoke_table_row_callbacks::( - "player_clock", - &self.player_clock, - event, - ); - callbacks.invoke_table_row_callbacks::("player_hand", &self.player_hand, event); callbacks.invoke_table_row_callbacks::("tile", &self.tile, event); - callbacks.invoke_table_row_callbacks::("view_hand", &self.view_hand, event); callbacks.invoke_table_row_callbacks::("wall", &self.wall, event); } } @@ -1051,18 +1027,13 @@ impl __sdk::SpacetimeModule for RemoteModule { type DbUpdate = DbUpdate; type AppliedDiff<'r> = AppliedDiff<'r>; type SubscriptionHandle = SubscriptionHandle; - type QueryBuilder = __sdk::QueryBuilder; fn register_tables(client_cache: &mut __sdk::ClientCache) { + advance_state_timer_table::register_table(client_cache); bot_table::register_table(client_cache); - game_timer_table::register_table(client_cache); lobby_table::register_table(client_cache); - logged_out_player_table::register_table(client_cache); player_table::register_table(client_cache); - player_clock_table::register_table(client_cache); - player_hand_table::register_table(client_cache); tile_table::register_table(client_cache); - view_hand_table::register_table(client_cache); wall_table::register_table(client_cache); } } diff --git a/jong-db/src/db/player_clock_table.rs b/jong-db/src/db/player_clock_table.rs deleted file mode 100644 index 79a0eb0..0000000 --- a/jong-db/src/db/player_clock_table.rs +++ /dev/null @@ -1,189 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::player_clock_type::PlayerClock; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `player_clock`. -/// -/// Obtain a handle from the [`PlayerClockTableAccess::player_clock`] method on [`super::RemoteTables`], -/// like `ctx.db.player_clock()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_clock().on_insert(...)`. -pub struct PlayerClockTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `player_clock`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PlayerClockTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PlayerClockTableHandle`], which mediates access to the table `player_clock`. - fn player_clock(&self) -> PlayerClockTableHandle<'_>; -} - -impl PlayerClockTableAccess for super::RemoteTables { - fn player_clock(&self) -> PlayerClockTableHandle<'_> { - PlayerClockTableHandle { - imp: self.imp.get_table::("player_clock"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PlayerClockInsertCallbackId(__sdk::CallbackId); -pub struct PlayerClockDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PlayerClockTableHandle<'ctx> { - type Row = PlayerClock; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = PlayerClockInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerClockInsertCallbackId { - PlayerClockInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PlayerClockInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PlayerClockDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerClockDeleteCallbackId { - PlayerClockDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PlayerClockDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("player_clock"); - _table.add_unique_constraint::("id", |row| &row.id); - _table.add_unique_constraint::("player_id", |row| &row.player_id); -} -pub struct PlayerClockUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PlayerClockTableHandle<'ctx> { - type UpdateCallbackId = PlayerClockUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PlayerClockUpdateCallbackId { - PlayerClockUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PlayerClockUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} - -/// Access to the `id` unique index on the table `player_clock`, -/// which allows point queries on the field of the same name -/// via the [`PlayerClockIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_clock().id().find(...)`. -pub struct PlayerClockIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> PlayerClockTableHandle<'ctx> { - /// Get a handle on the `id` unique index on the table `player_clock`. - pub fn id(&self) -> PlayerClockIdUnique<'ctx> { - PlayerClockIdUnique { - imp: self.imp.get_unique_constraint::("id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> PlayerClockIdUnique<'ctx> { - /// Find the subscribed row whose `id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -/// Access to the `player_id` unique index on the table `player_clock`, -/// which allows point queries on the field of the same name -/// via the [`PlayerClockPlayerIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_clock().player_id().find(...)`. -pub struct PlayerClockPlayerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> PlayerClockTableHandle<'ctx> { - /// Get a handle on the `player_id` unique index on the table `player_clock`. - pub fn player_id(&self) -> PlayerClockPlayerIdUnique<'ctx> { - PlayerClockPlayerIdUnique { - imp: self.imp.get_unique_constraint::("player_id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> PlayerClockPlayerIdUnique<'ctx> { - /// Find the subscribed row whose `player_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `PlayerClock`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait player_clockQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PlayerClock`. - fn player_clock(&self) -> __sdk::__query_builder::Table; -} - -impl player_clockQueryTableAccess for __sdk::QueryTableAccessor { - fn player_clock(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("player_clock") - } -} diff --git a/jong-db/src/db/player_clock_type.rs b/jong-db/src/db/player_clock_type.rs deleted file mode 100644 index 6ae3212..0000000 --- a/jong-db/src/db/player_clock_type.rs +++ /dev/null @@ -1,58 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct PlayerClock { - pub id: u32, - pub player_id: u32, - pub renewable: u16, - pub total: u16, -} - -impl __sdk::InModule for PlayerClock { - type Module = super::RemoteModule; -} - -/// Column accessor struct for the table `PlayerClock`. -/// -/// Provides typed access to columns for query building. -pub struct PlayerClockCols { - pub id: __sdk::__query_builder::Col, - pub player_id: __sdk::__query_builder::Col, - pub renewable: __sdk::__query_builder::Col, - pub total: __sdk::__query_builder::Col, -} - -impl __sdk::__query_builder::HasCols for PlayerClock { - type Cols = PlayerClockCols; - fn cols(table_name: &'static str) -> Self::Cols { - PlayerClockCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - player_id: __sdk::__query_builder::Col::new(table_name, "player_id"), - renewable: __sdk::__query_builder::Col::new(table_name, "renewable"), - total: __sdk::__query_builder::Col::new(table_name, "total"), - } - } -} - -/// Indexed column accessor struct for the table `PlayerClock`. -/// -/// Provides typed access to indexed columns for query building. -pub struct PlayerClockIxCols { - pub id: __sdk::__query_builder::IxCol, - pub player_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for PlayerClock { - type IxCols = PlayerClockIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - PlayerClockIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - player_id: __sdk::__query_builder::IxCol::new(table_name, "player_id"), - } - } -} diff --git a/jong-db/src/db/player_hand_table.rs b/jong-db/src/db/player_hand_table.rs deleted file mode 100644 index 4b1af06..0000000 --- a/jong-db/src/db/player_hand_table.rs +++ /dev/null @@ -1,191 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::db_tile_type::DbTile; -use super::player_hand_type::PlayerHand; -use super::turn_state_type::TurnState; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `player_hand`. -/// -/// Obtain a handle from the [`PlayerHandTableAccess::player_hand`] method on [`super::RemoteTables`], -/// like `ctx.db.player_hand()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_hand().on_insert(...)`. -pub struct PlayerHandTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `player_hand`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PlayerHandTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PlayerHandTableHandle`], which mediates access to the table `player_hand`. - fn player_hand(&self) -> PlayerHandTableHandle<'_>; -} - -impl PlayerHandTableAccess for super::RemoteTables { - fn player_hand(&self) -> PlayerHandTableHandle<'_> { - PlayerHandTableHandle { - imp: self.imp.get_table::("player_hand"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PlayerHandInsertCallbackId(__sdk::CallbackId); -pub struct PlayerHandDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PlayerHandTableHandle<'ctx> { - type Row = PlayerHand; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = PlayerHandInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerHandInsertCallbackId { - PlayerHandInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PlayerHandInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PlayerHandDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerHandDeleteCallbackId { - PlayerHandDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PlayerHandDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("player_hand"); - _table.add_unique_constraint::("id", |row| &row.id); - _table.add_unique_constraint::("player_id", |row| &row.player_id); -} -pub struct PlayerHandUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PlayerHandTableHandle<'ctx> { - type UpdateCallbackId = PlayerHandUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PlayerHandUpdateCallbackId { - PlayerHandUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PlayerHandUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} - -/// Access to the `id` unique index on the table `player_hand`, -/// which allows point queries on the field of the same name -/// via the [`PlayerHandIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_hand().id().find(...)`. -pub struct PlayerHandIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> PlayerHandTableHandle<'ctx> { - /// Get a handle on the `id` unique index on the table `player_hand`. - pub fn id(&self) -> PlayerHandIdUnique<'ctx> { - PlayerHandIdUnique { - imp: self.imp.get_unique_constraint::("id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> PlayerHandIdUnique<'ctx> { - /// Find the subscribed row whose `id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -/// Access to the `player_id` unique index on the table `player_hand`, -/// which allows point queries on the field of the same name -/// via the [`PlayerHandPlayerIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_hand().player_id().find(...)`. -pub struct PlayerHandPlayerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> PlayerHandTableHandle<'ctx> { - /// Get a handle on the `player_id` unique index on the table `player_hand`. - pub fn player_id(&self) -> PlayerHandPlayerIdUnique<'ctx> { - PlayerHandPlayerIdUnique { - imp: self.imp.get_unique_constraint::("player_id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> PlayerHandPlayerIdUnique<'ctx> { - /// Find the subscribed row whose `player_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `PlayerHand`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait player_handQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PlayerHand`. - fn player_hand(&self) -> __sdk::__query_builder::Table; -} - -impl player_handQueryTableAccess for __sdk::QueryTableAccessor { - fn player_hand(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("player_hand") - } -} diff --git a/jong-db/src/db/player_hand_type.rs b/jong-db/src/db/player_hand_type.rs deleted file mode 100644 index dfa7dbf..0000000 --- a/jong-db/src/db/player_hand_type.rs +++ /dev/null @@ -1,67 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -use super::db_tile_type::DbTile; -use super::turn_state_type::TurnState; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct PlayerHand { - pub id: u32, - pub player_id: u32, - pub turn_state: TurnState, - pub pond: Vec, - pub hand: Vec, - pub working_tile: Option, -} - -impl __sdk::InModule for PlayerHand { - type Module = super::RemoteModule; -} - -/// Column accessor struct for the table `PlayerHand`. -/// -/// Provides typed access to columns for query building. -pub struct PlayerHandCols { - pub id: __sdk::__query_builder::Col, - pub player_id: __sdk::__query_builder::Col, - pub turn_state: __sdk::__query_builder::Col, - pub pond: __sdk::__query_builder::Col>, - pub hand: __sdk::__query_builder::Col>, - pub working_tile: __sdk::__query_builder::Col>, -} - -impl __sdk::__query_builder::HasCols for PlayerHand { - type Cols = PlayerHandCols; - fn cols(table_name: &'static str) -> Self::Cols { - PlayerHandCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - player_id: __sdk::__query_builder::Col::new(table_name, "player_id"), - turn_state: __sdk::__query_builder::Col::new(table_name, "turn_state"), - pond: __sdk::__query_builder::Col::new(table_name, "pond"), - hand: __sdk::__query_builder::Col::new(table_name, "hand"), - working_tile: __sdk::__query_builder::Col::new(table_name, "working_tile"), - } - } -} - -/// Indexed column accessor struct for the table `PlayerHand`. -/// -/// Provides typed access to indexed columns for query building. -pub struct PlayerHandIxCols { - pub id: __sdk::__query_builder::IxCol, - pub player_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for PlayerHand { - type IxCols = PlayerHandIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - PlayerHandIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - player_id: __sdk::__query_builder::IxCol::new(table_name, "player_id"), - } - } -} diff --git a/jong-db/src/db/player_table.rs b/jong-db/src/db/player_table.rs index 78db0f7..ee7b127 100644 --- a/jong-db/src/db/player_table.rs +++ b/jong-db/src/db/player_table.rs @@ -2,6 +2,7 @@ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. #![allow(unused, clippy::all)] +use super::db_tile_type::DbTile; use super::player_type::Player; use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; @@ -81,8 +82,8 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("player"); - _table.add_unique_constraint::("id", |row| &row.id); _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity); + _table.add_unique_constraint::("id", |row| &row.id); } pub struct PlayerUpdateCallbackId(__sdk::CallbackId); @@ -112,36 +113,6 @@ pub(super) fn parse_table_update( }) } -/// Access to the `id` unique index on the table `player`, -/// which allows point queries on the field of the same name -/// via the [`PlayerIdUnique::find`] method. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player().id().find(...)`. -pub struct PlayerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -impl<'ctx> PlayerTableHandle<'ctx> { - /// Get a handle on the `id` unique index on the table `player`. - pub fn id(&self) -> PlayerIdUnique<'ctx> { - PlayerIdUnique { - imp: self.imp.get_unique_constraint::("id"), - phantom: std::marker::PhantomData, - } - } -} - -impl<'ctx> PlayerIdUnique<'ctx> { - /// Find the subscribed row whose `id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &u32) -> Option { - self.imp.find(col_val) - } -} - /// Access to the `identity` unique index on the table `player`, /// which allows point queries on the field of the same name /// via the [`PlayerIdentityUnique::find`] method. @@ -174,18 +145,32 @@ impl<'ctx> PlayerIdentityUnique<'ctx> { } } -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `Player`. +/// Access to the `id` unique index on the table `player`, +/// which allows point queries on the field of the same name +/// via the [`PlayerIdUnique::find`] method. /// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait playerQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `Player`. - fn player(&self) -> __sdk::__query_builder::Table; +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.player().id().find(...)`. +pub struct PlayerIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } -impl playerQueryTableAccess for __sdk::QueryTableAccessor { - fn player(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("player") +impl<'ctx> PlayerTableHandle<'ctx> { + /// Get a handle on the `id` unique index on the table `player`. + pub fn id(&self) -> PlayerIdUnique<'ctx> { + PlayerIdUnique { + imp: self.imp.get_unique_constraint::("id"), + phantom: std::marker::PhantomData, + } + } +} + +impl<'ctx> PlayerIdUnique<'ctx> { + /// Find the subscribed row whose `id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &u32) -> Option { + self.imp.find(col_val) } } diff --git a/jong-db/src/db/player_type.rs b/jong-db/src/db/player_type.rs index be770b6..582ca86 100644 --- a/jong-db/src/db/player_type.rs +++ b/jong-db/src/db/player_type.rs @@ -4,63 +4,22 @@ #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; +use super::db_tile_type::DbTile; + #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Player { - pub id: u32, pub identity: __sdk::Identity, + pub id: u32, pub name: Option, pub lobby_id: u32, pub ready: bool, pub sort: bool, + pub hand: Vec, + pub pond: Vec, + pub drawn_tile: Option, } impl __sdk::InModule for Player { type Module = super::RemoteModule; } - -/// Column accessor struct for the table `Player`. -/// -/// Provides typed access to columns for query building. -pub struct PlayerCols { - pub id: __sdk::__query_builder::Col, - pub identity: __sdk::__query_builder::Col, - pub name: __sdk::__query_builder::Col>, - pub lobby_id: __sdk::__query_builder::Col, - pub ready: __sdk::__query_builder::Col, - pub sort: __sdk::__query_builder::Col, -} - -impl __sdk::__query_builder::HasCols for Player { - type Cols = PlayerCols; - fn cols(table_name: &'static str) -> Self::Cols { - PlayerCols { - id: __sdk::__query_builder::Col::new(table_name, "id"), - identity: __sdk::__query_builder::Col::new(table_name, "identity"), - name: __sdk::__query_builder::Col::new(table_name, "name"), - lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"), - ready: __sdk::__query_builder::Col::new(table_name, "ready"), - sort: __sdk::__query_builder::Col::new(table_name, "sort"), - } - } -} - -/// Indexed column accessor struct for the table `Player`. -/// -/// Provides typed access to indexed columns for query building. -pub struct PlayerIxCols { - pub id: __sdk::__query_builder::IxCol, - pub identity: __sdk::__query_builder::IxCol, - pub lobby_id: __sdk::__query_builder::IxCol, -} - -impl __sdk::__query_builder::HasIxCols for Player { - type IxCols = PlayerIxCols; - fn ix_cols(table_name: &'static str) -> Self::IxCols { - PlayerIxCols { - id: __sdk::__query_builder::IxCol::new(table_name, "id"), - identity: __sdk::__query_builder::IxCol::new(table_name, "identity"), - lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"), - } - } -} diff --git a/jong-db/src/db/shuffle_deal_reducer.rs b/jong-db/src/db/shuffle_deal_reducer.rs new file mode 100644 index 0000000..06b1b23 --- /dev/null +++ b/jong-db/src/db/shuffle_deal_reducer.rs @@ -0,0 +1,105 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] +pub(super) struct ShuffleDealArgs { + pub lobby_id: u32, +} + +impl From for super::Reducer { + fn from(args: ShuffleDealArgs) -> Self { + Self::ShuffleDeal { + lobby_id: args.lobby_id, + } + } +} + +impl __sdk::InModule for ShuffleDealArgs { + type Module = super::RemoteModule; +} + +pub struct ShuffleDealCallbackId(__sdk::CallbackId); + +#[allow(non_camel_case_types)] +/// Extension trait for access to the reducer `shuffle_deal`. +/// +/// Implemented for [`super::RemoteReducers`]. +pub trait shuffle_deal { + /// Request that the remote module invoke the reducer `shuffle_deal` to run as soon as possible. + /// + /// This method returns immediately, and errors only if we are unable to send the request. + /// The reducer will run asynchronously in the future, + /// and its status can be observed by listening for [`Self::on_shuffle_deal`] callbacks. + fn shuffle_deal(&self, lobby_id: u32) -> __sdk::Result<()>; + /// Register a callback to run whenever we are notified of an invocation of the reducer `shuffle_deal`. + /// + /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] + /// to determine the reducer's status. + /// + /// The returned [`ShuffleDealCallbackId`] can be passed to [`Self::remove_on_shuffle_deal`] + /// to cancel the callback. + fn on_shuffle_deal( + &self, + callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static, + ) -> ShuffleDealCallbackId; + /// Cancel a callback previously registered by [`Self::on_shuffle_deal`], + /// causing it not to run in the future. + fn remove_on_shuffle_deal(&self, callback: ShuffleDealCallbackId); +} + +impl shuffle_deal for super::RemoteReducers { + fn shuffle_deal(&self, lobby_id: u32) -> __sdk::Result<()> { + self.imp + .call_reducer("shuffle_deal", ShuffleDealArgs { lobby_id }) + } + fn on_shuffle_deal( + &self, + mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static, + ) -> ShuffleDealCallbackId { + ShuffleDealCallbackId(self.imp.on_reducer( + "shuffle_deal", + Box::new(move |ctx: &super::ReducerEventContext| { + #[allow(irrefutable_let_patterns)] + let super::ReducerEventContext { + event: + __sdk::ReducerEvent { + reducer: super::Reducer::ShuffleDeal { lobby_id }, + .. + }, + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, lobby_id) + }), + )) + } + fn remove_on_shuffle_deal(&self, callback: ShuffleDealCallbackId) { + self.imp.remove_on_reducer("shuffle_deal", callback.0) + } +} + +#[allow(non_camel_case_types)] +#[doc(hidden)] +/// Extension trait for setting the call-flags for the reducer `shuffle_deal`. +/// +/// Implemented for [`super::SetReducerFlags`]. +/// +/// This type is currently unstable and may be removed without a major version bump. +pub trait set_flags_for_shuffle_deal { + /// Set the call-reducer flags for the reducer `shuffle_deal` to `flags`. + /// + /// This type is currently unstable and may be removed without a major version bump. + fn shuffle_deal(&self, flags: __ws::CallReducerFlags); +} + +impl set_flags_for_shuffle_deal for super::SetReducerFlags { + fn shuffle_deal(&self, flags: __ws::CallReducerFlags) { + self.imp.set_call_reducer_flags("shuffle_deal", flags); + } +} diff --git a/jong-db/src/db/skip_call_reducer.rs b/jong-db/src/db/skip_call_reducer.rs new file mode 100644 index 0000000..a78c70a --- /dev/null +++ b/jong-db/src/db/skip_call_reducer.rs @@ -0,0 +1,100 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] +pub(super) struct SkipCallArgs {} + +impl From for super::Reducer { + fn from(args: SkipCallArgs) -> Self { + Self::SkipCall + } +} + +impl __sdk::InModule for SkipCallArgs { + type Module = super::RemoteModule; +} + +pub struct SkipCallCallbackId(__sdk::CallbackId); + +#[allow(non_camel_case_types)] +/// Extension trait for access to the reducer `skip_call`. +/// +/// Implemented for [`super::RemoteReducers`]. +pub trait skip_call { + /// Request that the remote module invoke the reducer `skip_call` to run as soon as possible. + /// + /// This method returns immediately, and errors only if we are unable to send the request. + /// The reducer will run asynchronously in the future, + /// and its status can be observed by listening for [`Self::on_skip_call`] callbacks. + fn skip_call(&self) -> __sdk::Result<()>; + /// Register a callback to run whenever we are notified of an invocation of the reducer `skip_call`. + /// + /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] + /// to determine the reducer's status. + /// + /// The returned [`SkipCallCallbackId`] can be passed to [`Self::remove_on_skip_call`] + /// to cancel the callback. + fn on_skip_call( + &self, + callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, + ) -> SkipCallCallbackId; + /// Cancel a callback previously registered by [`Self::on_skip_call`], + /// causing it not to run in the future. + fn remove_on_skip_call(&self, callback: SkipCallCallbackId); +} + +impl skip_call for super::RemoteReducers { + fn skip_call(&self) -> __sdk::Result<()> { + self.imp.call_reducer("skip_call", SkipCallArgs {}) + } + fn on_skip_call( + &self, + mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, + ) -> SkipCallCallbackId { + SkipCallCallbackId(self.imp.on_reducer( + "skip_call", + Box::new(move |ctx: &super::ReducerEventContext| { + #[allow(irrefutable_let_patterns)] + let super::ReducerEventContext { + event: + __sdk::ReducerEvent { + reducer: super::Reducer::SkipCall {}, + .. + }, + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), + )) + } + fn remove_on_skip_call(&self, callback: SkipCallCallbackId) { + self.imp.remove_on_reducer("skip_call", callback.0) + } +} + +#[allow(non_camel_case_types)] +#[doc(hidden)] +/// Extension trait for setting the call-flags for the reducer `skip_call`. +/// +/// Implemented for [`super::SetReducerFlags`]. +/// +/// This type is currently unstable and may be removed without a major version bump. +pub trait set_flags_for_skip_call { + /// Set the call-reducer flags for the reducer `skip_call` to `flags`. + /// + /// This type is currently unstable and may be removed without a major version bump. + fn skip_call(&self, flags: __ws::CallReducerFlags); +} + +impl set_flags_for_skip_call for super::SetReducerFlags { + fn skip_call(&self, flags: __ws::CallReducerFlags) { + self.imp.set_call_reducer_flags("skip_call", flags); + } +} diff --git a/jong-db/src/db/disconnect_reducer.rs b/jong-db/src/db/start_game_reducer.rs similarity index 55% rename from jong-db/src/db/disconnect_reducer.rs rename to jong-db/src/db/start_game_reducer.rs index 026d4b1..5eb59c1 100644 --- a/jong-db/src/db/disconnect_reducer.rs +++ b/jong-db/src/db/start_game_reducer.rs @@ -6,63 +6,63 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub(super) struct DisconnectArgs {} +pub(super) struct StartGameArgs {} -impl From for super::Reducer { - fn from(args: DisconnectArgs) -> Self { - Self::Disconnect +impl From for super::Reducer { + fn from(args: StartGameArgs) -> Self { + Self::StartGame } } -impl __sdk::InModule for DisconnectArgs { +impl __sdk::InModule for StartGameArgs { type Module = super::RemoteModule; } -pub struct DisconnectCallbackId(__sdk::CallbackId); +pub struct StartGameCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `disconnect`. +/// Extension trait for access to the reducer `start_game`. /// /// Implemented for [`super::RemoteReducers`]. -pub trait disconnect { - /// Request that the remote module invoke the reducer `disconnect` to run as soon as possible. +pub trait start_game { + /// Request that the remote module invoke the reducer `start_game` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_disconnect`] callbacks. - fn disconnect(&self) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `disconnect`. + /// and its status can be observed by listening for [`Self::on_start_game`] callbacks. + fn start_game(&self) -> __sdk::Result<()>; + /// Register a callback to run whenever we are notified of an invocation of the reducer `start_game`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// - /// The returned [`DisconnectCallbackId`] can be passed to [`Self::remove_on_disconnect`] + /// The returned [`StartGameCallbackId`] can be passed to [`Self::remove_on_start_game`] /// to cancel the callback. - fn on_disconnect( + fn on_start_game( &self, callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> DisconnectCallbackId; - /// Cancel a callback previously registered by [`Self::on_disconnect`], + ) -> StartGameCallbackId; + /// Cancel a callback previously registered by [`Self::on_start_game`], /// causing it not to run in the future. - fn remove_on_disconnect(&self, callback: DisconnectCallbackId); + fn remove_on_start_game(&self, callback: StartGameCallbackId); } -impl disconnect for super::RemoteReducers { - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.call_reducer("disconnect", DisconnectArgs {}) +impl start_game for super::RemoteReducers { + fn start_game(&self) -> __sdk::Result<()> { + self.imp.call_reducer("start_game", StartGameArgs {}) } - fn on_disconnect( + fn on_start_game( &self, mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> DisconnectCallbackId { - DisconnectCallbackId(self.imp.on_reducer( - "disconnect", + ) -> StartGameCallbackId { + StartGameCallbackId(self.imp.on_reducer( + "start_game", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { - reducer: super::Reducer::Disconnect {}, + reducer: super::Reducer::StartGame {}, .. }, .. @@ -74,27 +74,27 @@ impl disconnect for super::RemoteReducers { }), )) } - fn remove_on_disconnect(&self, callback: DisconnectCallbackId) { - self.imp.remove_on_reducer("disconnect", callback.0) + fn remove_on_start_game(&self, callback: StartGameCallbackId) { + self.imp.remove_on_reducer("start_game", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `disconnect`. +/// Extension trait for setting the call-flags for the reducer `start_game`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_disconnect { - /// Set the call-reducer flags for the reducer `disconnect` to `flags`. +pub trait set_flags_for_start_game { + /// Set the call-reducer flags for the reducer `start_game` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. - fn disconnect(&self, flags: __ws::CallReducerFlags); + fn start_game(&self, flags: __ws::CallReducerFlags); } -impl set_flags_for_disconnect for super::SetReducerFlags { - fn disconnect(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("disconnect", flags); +impl set_flags_for_start_game for super::SetReducerFlags { + fn start_game(&self, flags: __ws::CallReducerFlags) { + self.imp.set_call_reducer_flags("start_game", flags); } } diff --git a/jong-db/src/db/tile_table.rs b/jong-db/src/db/tile_table.rs index e23f10e..8d188eb 100644 --- a/jong-db/src/db/tile_table.rs +++ b/jong-db/src/db/tile_table.rs @@ -141,19 +141,3 @@ impl<'ctx> TileIdUnique<'ctx> { self.imp.find(col_val) } } - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `DbTile`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait tileQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `DbTile`. - fn tile(&self) -> __sdk::__query_builder::Table; -} - -impl tileQueryTableAccess for __sdk::QueryTableAccessor { - fn tile(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("tile") - } -} diff --git a/jong-db/src/db/view_hand_table.rs b/jong-db/src/db/view_hand_table.rs deleted file mode 100644 index 1a9adbf..0000000 --- a/jong-db/src/db/view_hand_table.rs +++ /dev/null @@ -1,113 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::db_tile_type::DbTile; -use super::player_hand_type::PlayerHand; -use super::turn_state_type::TurnState; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `view_hand`. -/// -/// Obtain a handle from the [`ViewHandTableAccess::view_hand`] method on [`super::RemoteTables`], -/// like `ctx.db.view_hand()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.view_hand().on_insert(...)`. -pub struct ViewHandTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `view_hand`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ViewHandTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ViewHandTableHandle`], which mediates access to the table `view_hand`. - fn view_hand(&self) -> ViewHandTableHandle<'_>; -} - -impl ViewHandTableAccess for super::RemoteTables { - fn view_hand(&self) -> ViewHandTableHandle<'_> { - ViewHandTableHandle { - imp: self.imp.get_table::("view_hand"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ViewHandInsertCallbackId(__sdk::CallbackId); -pub struct ViewHandDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ViewHandTableHandle<'ctx> { - type Row = PlayerHand; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = ViewHandInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ViewHandInsertCallbackId { - ViewHandInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ViewHandInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ViewHandDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ViewHandDeleteCallbackId { - ViewHandDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ViewHandDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("view_hand"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `PlayerHand`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait view_handQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PlayerHand`. - fn view_hand(&self) -> __sdk::__query_builder::Table; -} - -impl view_handQueryTableAccess for __sdk::QueryTableAccessor { - fn view_hand(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("view_hand") - } -} diff --git a/jong-db/src/db/wall_table.rs b/jong-db/src/db/wall_table.rs index 70c4010..1f920d6 100644 --- a/jong-db/src/db/wall_table.rs +++ b/jong-db/src/db/wall_table.rs @@ -141,19 +141,3 @@ impl<'ctx> WallLobbyIdUnique<'ctx> { self.imp.find(col_val) } } - -#[allow(non_camel_case_types)] -/// Extension trait for query builder access to the table `DbWall`. -/// -/// Implemented for [`__sdk::QueryTableAccessor`]. -pub trait wallQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `DbWall`. - fn wall(&self) -> __sdk::__query_builder::Table; -} - -impl wallQueryTableAccess for __sdk::QueryTableAccessor { - fn wall(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("wall") - } -} diff --git a/jong-db/src/lib.rs b/jong-db/src/lib.rs index 0d3befb..0d2a8d5 100644 --- a/jong-db/src/lib.rs +++ b/jong-db/src/lib.rs @@ -1,6 +1,4 @@ pub mod db; - -pub use conversions::*; pub use db::*; mod conversions { diff --git a/jong-line/src/lib.rs b/jong-line/src/lib.rs index adcca63..28bf92a 100644 --- a/jong-line/src/lib.rs +++ b/jong-line/src/lib.rs @@ -1,9 +1,15 @@ use log::debug; use spacetimedb::{ReducerContext, Table, reducer}; +use jong_types::TurnState; + use crate::tables::*; -mod reducers; +mod reducers { + mod deal; + mod hand; + mod lobby; +} mod tables; #[reducer] @@ -26,40 +32,27 @@ pub fn clear_all(ctx: &ReducerContext) { } #[reducer(client_connected)] -pub fn connect(ctx: &ReducerContext) -> Result<(), String> { - let player = if let Some(player) = ctx.db.logged_out_player().identity().find(ctx.sender) { - let player = ctx.db.player().insert(player); - ctx.db.logged_out_player().identity().delete(ctx.sender); - player +pub fn login_or_add_player(ctx: &ReducerContext) { + let identity = ctx.sender; + + // TODO remove player on disconnect + if let Ok(player) = ctx.db.player().try_insert(Player { + identity, + id: 0, + name: None, + lobby_id: 0, + ready: false, + sort: true, + hand: vec![], + pond: vec![], + drawn_tile: None, + turn_state: TurnState::None, + }) { + debug!("added player: {:?}", player); } else { - ctx.db.player().try_insert(Player { - identity: ctx.sender, - id: 0, - name: None, - lobby_id: 0, - ready: false, - sort: true, - })? - }; - - debug!("player connected: {:?}", player); - - Ok(()) -} - -#[reducer(client_disconnected)] -pub fn disconnect(ctx: &ReducerContext) -> Result<(), String> { - let player = ctx - .db - .player() - .identity() - .find(ctx.sender) - .ok_or_else(|| format!("can't find player {}", ctx.sender))?; - - ctx.db.logged_out_player().insert(player); - ctx.db.player().identity().delete(ctx.sender); - - Ok(()) + let player = ctx.db.player().identity().find(identity).unwrap(); + debug!("player {:?} has reconnected", player) + } } // #[reducer(init)] @@ -72,6 +65,11 @@ pub fn disconnect(ctx: &ReducerContext) -> Result<(), String> { // // Called everytime a new client connects // } +// #[reducer(client_disconnected)] +// pub fn identity_disconnected(_ctx: &ReducerContext) { +// // Called everytime a client disconnects +// } + // #[reducer] // pub fn add(ctx: &ReducerContext, name: String) { // ctx.db.player().insert(Player { name }); diff --git a/jong-line/src/reducers.rs b/jong-line/src/reducers.rs deleted file mode 100644 index 151c7a4..0000000 --- a/jong-line/src/reducers.rs +++ /dev/null @@ -1,119 +0,0 @@ -use std::time::Duration; - -use spacetimedb::{ReducerContext, ScheduleAt::Interval, reducer}; - -use jong_types::{GameState, TurnState}; - -use crate::{ - reducers::deal::shuffle_deal, - tables::{ - GameTimer, PlayerClock, PlayerOrBot, bot, game_timer, lobby as _, player_clock, - player_hand, wall, - }, -}; - -mod deal; -mod hand; -mod lobby; - -#[reducer] -pub fn advance_game(ctx: &ReducerContext, mut game_timer: GameTimer) -> Result<(), String> { - // checks every second (or more? when users make moves) on whether to advance the game's various states - // TODO this, or allow player/debug to call this? - if !ctx.sender_auth().is_internal() { - return Err("This reducer can only be called by the scheduler".to_string()); - } - - if let Some(mut lobby) = ctx.db.lobby().id().find(game_timer.lobby_id) { - match lobby.game_state { - GameState::Setup => { - // TODO reduce interval beforehand so we don't wait a second? - // TODO keep a count to clear stale lobbies - lobby.game_state = GameState::Deal; - } - GameState::Deal => { - // TODO reduce interval beforehand so this can animate? - shuffle_deal(ctx, lobby.id); - } - GameState::Play => { - let curr_player = lobby.players.get(lobby.current_idx as usize).unwrap(); - match curr_player { - PlayerOrBot::Player { id: player_id } => { - let mut clock = ctx.db.player_clock().player_id().find(player_id).unwrap(); - let mut hand = ctx.db.player_hand().player_id().find(player_id).unwrap(); - match hand.turn_state { - TurnState::None => { - // TODO draw tile - if let Some(mut wall) = ctx.db.wall().lobby_id().find(lobby.id) - && let Some(tile) = wall.tiles.pop() - { - hand.working_tile = Some(tile); - hand.turn_state = TurnState::Tsumo; - ctx.db.wall().lobby_id().update(wall); - ctx.db.player_hand().id().update(hand); - } else { - // TODO out of tiles - todo!() - } - } - TurnState::Tsumo => { - if clock.tick() { - ctx.db.player_clock().id().update(clock); - } else { - // TODO auto-discard - } - } - TurnState::Menzen => {} - TurnState::RiichiKan => {} - TurnState::RonChiiPonKan => {} - TurnState::End => {} - } - } - PlayerOrBot::Bot { id: bot_id } => { - let b = ctx.db.bot().id().find(bot_id).unwrap(); - } - } - } - GameState::Exit => { - ctx.db.game_timer().id().delete(game_timer.id); - ctx.db.lobby().id().delete(lobby.id); - // TODO reset all player lobbies, delete bots, etc? - // is there a way to do this automatically, or rely on elsewhere's checks clearing the state? - return Ok(()); - } - - // TODO handle stale lobbies - // TODO should this delete the timer? - _ => Err(format!("lobby {} in impossible state", lobby.id))?, - } - - // ctx.db.game_timer().id().update(game_timer); - ctx.db.lobby().id().update(lobby); - } else { - ctx.db.game_timer().id().delete(game_timer.id); - Err(format!( - "ran schedule {} for empty lobby {}", - game_timer.id, game_timer.lobby_id - ))?; - } - - Ok(()) -} - -impl PlayerClock { - fn tick(&mut self) -> bool { - if self.renewable > 0 { - self.renewable -= 1; - true - } else if self.total > 0 { - self.total -= 1; - true - } else { - false - } - } - - fn renew(&mut self) { - self.renewable = 5; - } -} diff --git a/jong-line/src/reducers/deal.rs b/jong-line/src/reducers/deal.rs index a82e78a..e6e280f 100644 --- a/jong-line/src/reducers/deal.rs +++ b/jong-line/src/reducers/deal.rs @@ -1,13 +1,18 @@ use log::debug; use spacetimedb::{ReducerContext, Table, rand::seq::SliceRandom, reducer}; +use super::hand::deal_hands; use crate::tables::*; +#[reducer] pub fn shuffle_deal(ctx: &ReducerContext, lobby_id: u32) { debug!("lobby_id: {lobby_id}"); let mut lobby = ctx.db.lobby().id().find(lobby_id).unwrap(); - if lobby.game_state == jong_types::states::GameState::Deal { + if lobby.game_state == jong_types::states::GameState::Setup { + lobby.game_state = jong_types::states::GameState::Deal; + lobby = ctx.db.lobby().id().update(lobby); + let tiles = new_shuffled_wall(ctx); ctx.db.wall().insert(DbWall { @@ -19,6 +24,7 @@ pub fn shuffle_deal(ctx: &ReducerContext, lobby_id: u32) { deal_hands(ctx, lobby_id); lobby.game_state = jong_types::states::GameState::Play; + lobby.turn_state = jong_types::states::TurnState::Tsumo; ctx.db.lobby().id().update(lobby); } } @@ -33,32 +39,3 @@ pub fn new_shuffled_wall(ctx: &ReducerContext) -> Vec { wall } - -pub fn deal_hands(ctx: &ReducerContext, lobby_id: u32) { - let players = ctx.db.player().lobby_id().filter(lobby_id); - let bots = ctx.db.bot().lobby_id().filter(lobby_id); - - let mut wall = ctx.db.wall().lobby_id().find(lobby_id).unwrap(); - - // FIXME rectify deal orders - for player in players { - let mut tiles = wall.tiles.split_off(wall.tiles.len() - 13); - wall = ctx.db.wall().lobby_id().update(wall); - tiles.sort_by_key(|t| t.tile); - ctx.db.player_hand().insert(PlayerHand { - id: 0, - player_id: player.id, - turn_state: jong_types::TurnState::None, - pond: vec![], - hand: tiles, - working_tile: None, - }); - } - for mut bot in bots { - let mut tiles = wall.tiles.split_off(wall.tiles.len() - 13); - wall = ctx.db.wall().lobby_id().update(wall); - tiles.sort_by_key(|t| t.tile); - bot.hand = tiles; - ctx.db.bot().id().update(bot); - } -} diff --git a/jong-line/src/reducers/hand.rs b/jong-line/src/reducers/hand.rs index be7b48f..842926a 100644 --- a/jong-line/src/reducers/hand.rs +++ b/jong-line/src/reducers/hand.rs @@ -1,27 +1,66 @@ use log::{debug, trace}; use spacetimedb::{ReducerContext, reducer}; +use crate::tables::{player::player, *}; use jong_types::states::TurnState; -use crate::tables::*; +pub fn deal_hands(ctx: &ReducerContext, lobby_id: u32) { + let players = ctx.db.player().lobby_id().filter(lobby_id); + let bots = ctx.db.bot().lobby_id().filter(lobby_id); + + let mut wall = ctx.db.wall().lobby_id().find(lobby_id).unwrap(); + + // FIXME rectify deal orders + for mut player in players { + let mut tiles = wall.tiles.split_off(wall.tiles.len() - 13); + wall = ctx.db.wall().lobby_id().update(wall); + tiles.sort_by_key(|t| t.tile); + player.hand = tiles; + ctx.db.player().id().update(player); + } + for mut bot in bots { + let mut tiles = wall.tiles.split_off(wall.tiles.len() - 13); + wall = ctx.db.wall().lobby_id().update(wall); + tiles.sort_by_key(|t| t.tile); + bot.hand = tiles; + ctx.db.bot().id().update(bot); + } +} + +#[reducer] +pub fn draw_tile(ctx: &ReducerContext) { + let mut player = ctx.db.player().identity().find(ctx.sender).unwrap(); + let mut wall = ctx.db.wall().lobby_id().find(player.lobby_id).unwrap(); + + // TODO if no more tiles, exhaust somehow + + player.drawn_tile = wall.tiles.pop(); + + ctx.db.wall().lobby_id().update(wall); + ctx.db.player().id().update(player); +} // TODO make sure this can't be called or just error here? #[reducer] pub fn discard_tile(ctx: &ReducerContext, tile_id: u32) -> Result<(), String> { - let player = ctx.db.player().identity().find(ctx.sender).unwrap(); - let mut hand = ctx.db.player_hand().player_id().find(player.id).unwrap(); + let mut player = ctx.db.player().identity().find(ctx.sender).unwrap(); + let mut lobby = ctx.db.lobby().id().find(player.lobby_id).unwrap(); let dealt_tile = if let Some(dealt) = ctx.db.tile().id().find(tile_id) { - if let Some(drawn) = hand.working_tile { + if let Some(drawn) = player.drawn_tile { if drawn.id == dealt.id { // dealt from drawn tile dealt - } else if let Some((i, _)) = hand.hand.iter().enumerate().find(|(_, t)| t.id == tile_id) + } else if let Some((i, _)) = player + .hand + .iter() + .enumerate() + .find(|(_, t)| t.id == tile_id) { // dealt from hand - let dealt = hand.hand.remove(i); - hand.hand.push(drawn); - hand.hand.sort_by_key(|t| t.tile); + let dealt = player.hand.remove(i); + player.hand.push(drawn); + player.hand.sort_by_key(|t| t.tile); dealt } else { @@ -43,53 +82,54 @@ pub fn discard_tile(ctx: &ReducerContext, tile_id: u32) -> Result<(), String> { )); }; - hand.pond.push(dealt_tile); - hand.working_tile = None; - hand.turn_state = TurnState::None; + player.pond.push(dealt_tile); + player.drawn_tile = None; + lobby.turn_state = TurnState::RonChiiPonKan; - ctx.db.player_hand().id().update(hand); + let player = ctx.db.player().id().update(player); + ctx.db.lobby().id().update(lobby); debug!("player {} discarded tile {:?}", player.id, dealt_tile.tile); Ok(()) } -// #[reducer] -// pub fn skip_call(ctx: &ReducerContext) { -// trace!("skip_call"); +#[reducer] +pub fn skip_call(ctx: &ReducerContext) { + trace!("skip_call"); -// let player = ctx.db.player().identity().find(ctx.sender).unwrap(); -// let mut lobby = ctx.db.lobby().id().find(player.lobby_id).unwrap(); + let player = ctx.db.player().identity().find(ctx.sender).unwrap(); + let mut lobby = ctx.db.lobby().id().find(player.lobby_id).unwrap(); -// lobby.turn_state = TurnState::Tsumo; -// lobby.current_idx += 1; -// if lobby.current_idx >= 3 { -// lobby.current_idx = 0; -// } + lobby.turn_state = TurnState::Tsumo; + lobby.current_idx += 1; + if lobby.current_idx >= 3 { + lobby.current_idx = 0; + } -// // FIXME where better can this go -// bot_moves(ctx, &mut lobby); + // FIXME where better can this go + bot_moves(ctx, &mut lobby); -// ctx.db.player().id().update(player); -// ctx.db.lobby().id().update(lobby); -// } + ctx.db.player().id().update(player); + ctx.db.lobby().id().update(lobby); +} -// fn bot_moves(ctx: &ReducerContext, lobby: &mut Lobby) { -// let mut wall = ctx.db.wall().lobby_id().find(lobby.id).unwrap(); -// if let Some(PlayerOrBot::Bot { id }) = lobby.players.get(lobby.current_idx as usize + 1) { -// let mut bot = ctx.db.bot().id().find(id).unwrap(); -// bot.pond.push(wall.tiles.pop().unwrap()); -// ctx.db.bot().id().update(bot); -// lobby.turn_state = TurnState::RonChiiPonKan; -// } else { -// lobby.turn_state = TurnState::Tsumo; -// } +fn bot_moves(ctx: &ReducerContext, lobby: &mut Lobby) { + let mut wall = ctx.db.wall().lobby_id().find(lobby.id).unwrap(); + if let Some(PlayerOrBot::Bot { id }) = lobby.players.get(lobby.current_idx as usize + 1) { + let mut bot = ctx.db.bot().id().find(id).unwrap(); + bot.pond.push(wall.tiles.pop().unwrap()); + ctx.db.bot().id().update(bot); + lobby.turn_state = TurnState::RonChiiPonKan; + } else { + lobby.turn_state = TurnState::Tsumo; + } -// lobby.current_idx += 1; -// if lobby.current_idx >= 3 { -// lobby.current_idx = 0; -// } -// } + lobby.current_idx += 1; + if lobby.current_idx >= 3 { + lobby.current_idx = 0; + } +} // #[view(name = view_player_hand, public)] // pub fn view_player_hand(ctx: &ViewContext) -> Option { diff --git a/jong-line/src/reducers/lobby.rs b/jong-line/src/reducers/lobby.rs index ebe69c9..f169dfc 100644 --- a/jong-line/src/reducers/lobby.rs +++ b/jong-line/src/reducers/lobby.rs @@ -1,5 +1,3 @@ -use std::time::Duration; - use log::info; use spacetimedb::{ReducerContext, Table, rand::seq::SliceRandom, reducer}; @@ -7,18 +5,18 @@ use crate::tables::*; #[reducer] pub fn join_or_create_lobby(ctx: &ReducerContext, mut lobby_id: u32) -> Result<(), String> { - let mut player = ctx + let ok_or = ctx .db .player() .identity() .find(ctx.sender) .ok_or(format!("cannot find player {}", ctx.sender))?; + let mut player = ok_or; if lobby_id == 0 { - // TODO check first if player is already in a lobby - let lobby = ctx.db.lobby().insert(Lobby { id: 0, + host_player_id: player.id, players: vec![PlayerOrBot::Player { id: player.id }], game_state: jong_types::states::GameState::Lobby, dealer_idx: 0, @@ -51,8 +49,7 @@ pub fn add_bot(ctx: &ReducerContext, lobby_id: u32) -> Result<(), String> { lobby_id, hand: vec![], pond: vec![], - working_tile: None, - turn_state: jong_types::TurnState::None, + drawn_tile: None, }); lobby.players.push(PlayerOrBot::Bot { id: bot.id }); ctx.db.lobby().id().update(lobby); @@ -64,33 +61,29 @@ pub fn add_bot(ctx: &ReducerContext, lobby_id: u32) -> Result<(), String> { } #[reducer] -pub fn set_ready(ctx: &ReducerContext, ready: bool) -> Result<(), String> { +pub fn set_ready(ctx: &ReducerContext, ready: bool) { let mut player = ctx.db.player().identity().find(ctx.sender).unwrap(); player.ready = ready; - player = ctx.db.player().identity().update(player); - if let Some(mut lobby) = ctx.db.lobby().id().find(player.lobby_id) + ctx.db.player().identity().update(player); +} + +#[reducer] +pub fn start_game(ctx: &ReducerContext) { + let player = ctx.db.player().identity().find(ctx.sender).unwrap(); + if let Some(mut lobby) = ctx.db.lobby().host_player_id().find(player.id) && lobby.players.len() == 4 - && ctx.db.player().lobby_id().filter(lobby.id).all(|p| p.ready) + && lobby.players.iter().all(|p| match p { + PlayerOrBot::Player { id } => ctx.db.player().id().find(id).is_some_and(|p| p.ready), + PlayerOrBot::Bot { id } => ctx.db.bot().id().find(id).is_some(), + }) { lobby.game_state = jong_types::states::GameState::Setup; lobby.players.shuffle(&mut ctx.rng()); - let lobby = ctx.db.lobby().id().update(lobby); - - // TODO should we schedule this outside so that we can clear out stale lobbies? - ctx.db.game_timer().insert(GameTimer { - id: 0, - lobby_id: lobby.id, - scheduled_at: spacetimedb::ScheduleAt::Interval(Duration::from_secs(1).into()), - }); - } else { - // if lobby doesn't exist, reset player state - player.lobby_id = 0; - player.ready = false; - player = ctx.db.player().identity().update(player); - - return Err(format!("couldn't find lobby with id: {}", player.lobby_id)); + lobby.dealer_idx += 1; + if lobby.dealer_idx > 3 { + lobby.dealer_idx = 0; + } + ctx.db.lobby().id().update(lobby); } - - Ok(()) } diff --git a/jong-line/src/tables.rs b/jong-line/src/tables.rs index 4dfc472..5939c67 100644 --- a/jong-line/src/tables.rs +++ b/jong-line/src/tables.rs @@ -1,12 +1,10 @@ -use spacetimedb::{SpacetimeType, ViewContext, table, view}; +use spacetimedb::{SpacetimeType, table}; use jong_types::{ states::{GameState, TurnState}, tiles::Tile, }; -use crate::reducers::advance_game; - #[derive(Debug, Clone)] #[table(name = lobby, public)] pub struct Lobby { @@ -14,6 +12,8 @@ pub struct Lobby { #[auto_inc] pub id: u32, + #[unique] + pub host_player_id: u32, pub players: Vec, pub dealer_idx: u8, pub current_idx: u8, @@ -45,57 +45,44 @@ pub enum PlayerOrBot { Bot { id: u32 }, } +#[table(name = advance_state_timer)] +pub struct AdvanceStateTimer { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + scheduled_at: spacetimedb::ScheduleAt, + + lobby_id: u32, +} + +// FIXME this shant be public, use views #[table(name = player, public)] -#[table(name = logged_out_player)] #[derive(Debug)] pub struct Player { + #[primary_key] + pub identity: spacetimedb::Identity, + #[unique] #[auto_inc] pub id: u32, - #[primary_key] - pub identity: spacetimedb::Identity, - pub name: Option, #[index(btree)] pub lobby_id: u32, pub ready: bool, - pub sort: bool, -} - -#[table(name = player_clock, public)] -pub struct PlayerClock { - #[primary_key] - pub id: u32, - - #[unique] - pub player_id: u32, - - pub renewable: u16, - pub total: u16, -} - -#[table(name = player_hand)] -pub struct PlayerHand { - #[primary_key] - #[auto_inc] - pub id: u32, - - #[unique] - pub player_id: u32, - pub turn_state: TurnState, - pub pond: Vec, - pub hand: Vec, + pub sort: bool, - /// drawn or callable tile - pub working_tile: Option, + pub hand: Vec, + pub pond: Vec, + + pub drawn_tile: Option, } -#[table(name = bot, public)] +#[table(name = bot)] pub struct Bot { #[primary_key] #[auto_inc] @@ -104,31 +91,8 @@ pub struct Bot { #[index(btree)] pub lobby_id: u32, - pub turn_state: TurnState, - pub hand: Vec, pub pond: Vec, - pub working_tile: Option, -} - -#[table(name = game_timer, scheduled(advance_game))] -pub struct GameTimer { - #[primary_key] - #[auto_inc] - pub id: u64, - - #[unique] - pub lobby_id: u32, - - pub scheduled_at: spacetimedb::ScheduleAt, -} - -#[view(name = view_hand, public)] -fn view_hand(ctx: &ViewContext) -> Option { - ctx.db - .player() - .identity() - .find(ctx.sender) - .and_then(|p| ctx.db.player_hand().player_id().find(p.id)) + pub drawn_tile: Option, } diff --git a/jong/src/riichi.rs b/jong/src/riichi.rs index 73134f5..38afe95 100644 --- a/jong/src/riichi.rs +++ b/jong/src/riichi.rs @@ -3,11 +3,8 @@ use bevy_spacetimedb::{ ReadInsertUpdateMessage, ReadStdbConnectedMessage, ReadStdbDisconnectedMessage, StdbPlugin, }; -use jong_db::{ - self, DbConnection, LobbyTableAccess, PlayerHand, PlayerTableAccess, RemoteTables, - ViewHandTableAccess as _, -}; -use jong_db::{add_bot, set_ready}; +use jong_db::{self, DbConnection, LobbyTableAccess, PlayerTableAccess, RemoteTables}; +use jong_db::{add_bot, draw_tile, set_ready, shuffle_deal, skip_call, start_game}; use jong_types::*; pub mod player; @@ -22,10 +19,11 @@ impl Plugin for Riichi { .with_uri("http://localhost:3000") .with_module_name("jong-line") .with_run_fn(DbConnection::run_threaded) + // TODO why don't I need to call add_reducer? + + // TODO do these need to be subscription & vice-versa? .add_table(RemoteTables::player) .add_table(RemoteTables::lobby) - // TODO check bevy_spacetimedb PR status - .add_view_with_pk(RemoteTables::view_hand, |p| p.id) // semicolon stopper ; @@ -89,59 +87,92 @@ fn subscriptions(stdb: SpacetimeDB) { .on_applied(|_| trace!("made all subs!")) .on_error(|_, err| error!("sub failed: {err}")) .subscribe([ - // TODO change these to sub/unsub based on being in lobby and some such + // TODO until views work format!( "SELECT * FROM player p WHERE p.identity = '{}'", stdb.identity() ), - "SELECT l.* FROM lobby l JOIN player p ON l.id = p.lobby_id".to_string(), - "SELECT c.* FROM player_clock c JOIN player p ON c.player_id = p.id".to_string(), - "SELECT * FROM view_hand".to_string(), - "SELECT b.* FROM bot b JOIN lobby l ON l.id = b.lobby_id".to_string(), + "SELECT l.* FROM lobby l JOIN player p ON l.host_player_id = p.id".to_string(), ]); // .subscribe_to_all_tables(); } -fn on_view_hand_insert_update( - stdb: SpacetimeDB, - mut messages: ReadInsertUpdateMessage, - - mut commands: Commands, - mut hand: Option>>, - tiles: Query<&Tile>, - mut next_turnstate: ResMut>, -) { - for msg in messages.read() { - if hand.is_none() { - let hand_tiles: Vec<_> = msg - .new - .hand - .iter() - .map(|dbt| commands.spawn((Tile::from(&dbt.tile), TileId(dbt.id))).id()) - .collect(); - commands.spawn(Hand).add_children(&hand_tiles); - } - - // match msg.new.turn_state { - // jong_db::TurnState::None => todo!(), - // jong_db::TurnState::Tsumo => todo!(), - // jong_db::TurnState::Menzen => todo!(), - // jong_db::TurnState::RiichiKan => todo!(), - // jong_db::TurnState::RonChiiPonKan => todo!(), - // jong_db::TurnState::End => todo!(), - // } - - next_turnstate.set(msg.new.turn_state.into()); - } -} - fn on_player_insert_update( - stdb: SpacetimeDB, mut messages: ReadInsertUpdateMessage, - mut commands: Commands, + + pond: Option>>, + hand: Option>>, + tiles: Query<(Entity, &TileId)>, ) { - for msg in messages.read() {} + let hand = if hand.is_none() { + let hand = commands.spawn(Hand).id(); + commands.spawn(Pond); + hand + } else { + *hand.unwrap() + }; + let pond = if pond.is_none() { + let pond = commands.spawn(Pond).id(); + commands.spawn(Pond); + pond + } else { + *pond.unwrap() + }; + + for msg in messages.read() { + match msg.new.turn_state { + jong_db::TurnState::None => {} + jong_db::TurnState::Tsumo => { + stdb.reducers().draw_tile().unwrap(); + } + jong_db::TurnState::Menzen => todo!(), + jong_db::TurnState::RiichiKan => todo!(), + jong_db::TurnState::RonChiiPonKan => { + stdb.reducers().skip_call().unwrap(); + } + jong_db::TurnState::End => todo!(), + } + let hand_tiles: Vec<_> = msg + .new + .hand + .iter() + .map(|dbt| { + tiles + .iter() + .find_map(|(e, t)| if *t == TileId(dbt.id) { Some(e) } else { None }) + .or_else(|| Some(commands.spawn((Tile::from(&dbt.tile), TileId(dbt.id))).id())) + .unwrap() + }) + .collect(); + + let pond_tiles: Vec<_> = msg + .new + .pond + .iter() + .map(|dbt| { + tiles + .iter() + .find_map(|(e, t)| if *t == TileId(dbt.id) { Some(e) } else { None }) + .expect(&format!( + "dealt tiles should still be around, couldn't find {:?}. Tiles: {:?}", + dbt, + tiles.iter().map(|(_, t)| t).collect::>() + )) + }) + .collect(); + + debug!("hand_tiles: {hand_tiles:?}"); + + commands.entity(hand).replace_children(&hand_tiles); + commands.entity(pond).replace_children(&pond_tiles); + + // drawn tile is always a new tile to us until wall isn't fake + if let Some(dbt) = &msg.new.drawn_tile { + debug!("drew tile with id: {}", dbt.id); + commands.spawn((Tile::from(&dbt.tile), TileId(dbt.id), Drawn)); + } + } } fn on_lobby_insert_update( @@ -150,9 +181,10 @@ fn on_lobby_insert_update( commands: Commands, mut next_gamestate: ResMut>, + mut next_turnstate: ResMut>, ) { for msg in messages.read() { - trace!("on_lobby_insert_update msg:\n{:#?}", msg.new); + // trace!("on_lobby_insert_update msg:\n{:#?}", msg.new); let player = stdb .db() @@ -173,10 +205,12 @@ fn on_lobby_insert_update( stdb.reducers().add_bot(player.lobby_id).unwrap(); } stdb.reducers().set_ready(true).unwrap(); + stdb.reducers().start_game().unwrap(); } } jong_db::GameState::Setup => { trace!("game entered setup"); + stdb.reducers().shuffle_deal(player.lobby_id).unwrap(); } jong_db::GameState::Deal => { trace!("game entered deal"); diff --git a/jong/src/tui.rs b/jong/src/tui.rs index 4a82498..9198051 100644 --- a/jong/src/tui.rs +++ b/jong/src/tui.rs @@ -97,8 +97,9 @@ impl Plugin for TuiPlugin { fn discard_tile( stdb: SpacetimeDB, - mut commands: Commands, mut selected: MessageReader, + + mut commands: Commands, drawn: Single<(Entity, &TileId), With>, tiles: Query<&TileId>, ) { diff --git a/jong/src/tui/input/keyboard.rs b/jong/src/tui/input/keyboard.rs index 91b8901..be09002 100644 --- a/jong/src/tui/input/keyboard.rs +++ b/jong/src/tui/input/keyboard.rs @@ -3,6 +3,7 @@ use bevy_ratatui::crossterm::event::KeyCode; use bevy_ratatui::event::KeyMessage; use jong_db::PlayerTableAccess; use jong_db::join_or_create_lobby; +use jong_db::start_game; use tui_logger::TuiWidgetEvent; use jong::SpacetimeDB; diff --git a/justfile b/justfile index 4541442..8f51801 100644 --- a/justfile +++ b/justfile @@ -8,6 +8,8 @@ default: just --list run-tui: + just spacetime_restart_dev + sleep 3sec cargo run -- run-tui update: @@ -25,8 +27,3 @@ spacetime_generate-bindings: spacetime_restart_dev: mprocs -s localhost:4050 --ctl $"({c: restart-proc, name: spacetimedb_dev} | to yaml)" - -rrt: - just spacetime_restart_dev - sleep 3sec - just run-tui