Compare commits
28 Commits
db3382f38a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02b74c8ee5 | ||
|
|
42831b71a1 | ||
|
|
8e3cecdc6a | ||
|
|
e94a802034 | ||
|
|
9130797eec | ||
|
|
61f7299e42 | ||
|
|
5bf7d3b1d8 | ||
|
|
dfc99e97e3 | ||
|
|
dcbdc29f78 | ||
|
|
fa3c80105f | ||
|
|
f493a5e98c | ||
|
|
6007c2f2ed | ||
|
|
50841b807a | ||
|
|
9edb4a224c | ||
|
|
262c962d5d | ||
|
|
5b60e34801 | ||
|
|
e6fa3a9293 | ||
|
|
f7f46ba96e | ||
|
|
ed5e6d4487 | ||
|
|
3893702330 | ||
|
|
a2f4fce705 | ||
|
|
b04ab122eb | ||
|
|
c2f05eaeb0 | ||
|
|
4c2ab4a592 | ||
|
|
20a3bc7864 | ||
|
|
71405ab25f | ||
|
|
8ce43b449d | ||
|
|
5924d28b71 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
# breel
|
||||
**/*.sw*
|
||||
/target
|
||||
**/target
|
||||
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
834
src/gmon/Cargo.lock
generated
Executable file
834
src/gmon/Cargo.lock
generated
Executable file
@@ -0,0 +1,834 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.96"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
|
||||
|
||||
[[package]]
|
||||
name = "bytecount"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
|
||||
dependencies = [
|
||||
"camino",
|
||||
"cargo-platform",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-chain"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdextension-api"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af8707eca996b28193b772a4a9a28a97364bb93c97e3c313542e812f2963fb93"
|
||||
|
||||
[[package]]
|
||||
name = "gensym"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "913dce4c5f06c2ea40fc178c06f777ac89fc6b1383e90c254fafb1abe4ba3c82"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
||||
|
||||
[[package]]
|
||||
name = "gmon"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"godot",
|
||||
"mon",
|
||||
"native_db",
|
||||
"native_model",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a29a3646d4b02bf4587fedba4ac7b44a47d45c933fd85ba7e61292408818eaa4"
|
||||
dependencies = [
|
||||
"godot-core",
|
||||
"godot-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot-bindings"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0014540bff93ba275031bc852f1cf9a3ff3216f02cdd51dc249745dccc8c578"
|
||||
dependencies = [
|
||||
"gdextension-api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot-cell"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88184d525d763ebc88ff6806ffee35e19c7118d5c9e4eedbc74e70e069f8a671"
|
||||
|
||||
[[package]]
|
||||
name = "godot-codegen"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caa72d9b8be812fef2932f2a172b80c8b3feaee030571682f8f770c3d1c348d8"
|
||||
dependencies = [
|
||||
"godot-bindings",
|
||||
"heck",
|
||||
"nanoserde",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot-core"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ff8345372e4c990ca592d7b61490ef88ff249fc77226f5b79beca173b4a0458"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"godot-bindings",
|
||||
"godot-cell",
|
||||
"godot-codegen",
|
||||
"godot-ffi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot-ffi"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "606d08085bd590d2f9c72633d4d218fee665ab3a0760b2d9daff2d964d628def"
|
||||
dependencies = [
|
||||
"gensym",
|
||||
"godot-bindings",
|
||||
"godot-codegen",
|
||||
"libc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "godot-macros"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c11b3188e54ebacf88feb4c968ed19048a71a329c4cfd4a06cf374f18357a36"
|
||||
dependencies = [
|
||||
"godot-bindings",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"venial",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.170"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "mon"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "nanoserde"
|
||||
version = "0.1.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5de9cf844ab1e25a0353525bd74cb889843a6215fa4a0d156fd446f4857a1b99"
|
||||
dependencies = [
|
||||
"nanoserde-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nanoserde-derive"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e943b2c21337b7e3ec6678500687cdc741b7639ad457f234693352075c082204"
|
||||
|
||||
[[package]]
|
||||
name = "native_db"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db7c6b50f9889052a3c1bbd3aa70cc33b76ec1761092aeb0ec0e1ac3cfdb881a"
|
||||
dependencies = [
|
||||
"native_db_macro",
|
||||
"native_model",
|
||||
"redb 1.5.1",
|
||||
"redb 2.4.0",
|
||||
"semver",
|
||||
"serde",
|
||||
"skeptic",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native_db_macro"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "434acde56fc4485e0b62533bb2fbc08155ee7e47408b1358348acff556c31b3c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native_model"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c10f4542302b7fa69ef18b49d93106e27f20b59d695555121d9ed22fe5d716a8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"native_model_macro",
|
||||
"serde",
|
||||
"skeptic",
|
||||
"thiserror",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native_model_macro"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f385f3d57adaea8d8868e65a0bc821bcb8ba2228bbf87a1c3c6144ac48f3791"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.20.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.93"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"memchr",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redb"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd7f82ecd6ba647a39dd1a7172b8a1cd9453c0adee6da20cb553d83a9a460fa5"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redb"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea0a72cd7140de9fc3e318823b883abf819c20d478ec89ce880466dc2ef263c6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "skeptic"
|
||||
version = "0.13.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8"
|
||||
dependencies = [
|
||||
"bytecount",
|
||||
"cargo_metadata",
|
||||
"error-chain",
|
||||
"glob",
|
||||
"pulldown-cmark",
|
||||
"tempfile",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "venial"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a42528baceab6c7784446df2a10f4185078c39bf73dc614f154353f1a6b1229"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.13.3+wasi-0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
||||
dependencies = [
|
||||
"wit-bindgen-rt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcf01143b2dd5d134f11f545cf9f1431b13b749695cb33bcce051e7568f99478"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712c8386f4f4299382c9abee219bee7084f78fb939d88b6840fcc1320d5f6da2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
15
src/gmon/Cargo.toml
Executable file
15
src/gmon/Cargo.toml
Executable file
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "gmon"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.31"
|
||||
godot = "0.2.4"
|
||||
native_db = "0.8.1"
|
||||
native_model = "0.4.20"
|
||||
serde = "1.0.218"
|
||||
mon = { path = "../mon" }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
26
src/gmon/src/battle.rs
Normal file
26
src/gmon/src/battle.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use ::mon::*;
|
||||
use godot::classes::{ISprite2D, Sprite2D};
|
||||
use godot::prelude::*;
|
||||
|
||||
pub type Instance = mon::battle::Instance;
|
||||
pub type Team = mon::battle::Team;
|
||||
pub type Event = mon::battle::Event;
|
||||
pub type Move = mon::battle::Move;
|
||||
|
||||
#[derive(GodotClass)]
|
||||
#[class(base=Sprite2D)]
|
||||
struct Engine {
|
||||
instance: mon::battle::Engine,
|
||||
|
||||
base: Base<Sprite2D>,
|
||||
}
|
||||
|
||||
#[godot_api]
|
||||
impl ISprite2D for Engine {
|
||||
fn init(base: Base<Sprite2D>) -> Self {
|
||||
Self {
|
||||
instance: mon::battle::Engine::new(),
|
||||
base: base,
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/gmon/src/lib.rs
Executable file
9
src/gmon/src/lib.rs
Executable file
@@ -0,0 +1,9 @@
|
||||
use godot::prelude::*;
|
||||
|
||||
struct MyExtension;
|
||||
|
||||
#[gdextension]
|
||||
unsafe impl ExtensionLibrary for MyExtension {}
|
||||
|
||||
pub mod battle;
|
||||
pub mod mon;
|
||||
5
src/gmon/src/mon.rs
Normal file
5
src/gmon/src/mon.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use ::mon::*;
|
||||
|
||||
pub type Instance = mon::mon::Instance;
|
||||
pub type Species = mon::mon::Species;
|
||||
pub type Dex = mon::mon::Dex;
|
||||
@@ -1,4 +1,4 @@
|
||||
# Price is Wrong
|
||||
# Mon
|
||||
|
||||
Like https://gitea.inhome.blapointe.com/bel/price-is-wrong but
|
||||
|
||||
14
src/godot/Rust.gdextension
Normal file
14
src/godot/Rust.gdextension
Normal file
@@ -0,0 +1,14 @@
|
||||
[configuration]
|
||||
entry_symbol = "gdext_rust_init"
|
||||
compatibility_minimum = 4.1
|
||||
reloadable = true
|
||||
|
||||
[libraries]
|
||||
linux.debug.x86_64 = "res://../gmon/target/debug/libgmon.so"
|
||||
linux.release.x86_64 = "res://../gmon/target/release/libgmon.so"
|
||||
windows.debug.x86_64 = "res://../gmon/target/debug/gmon.dll"
|
||||
windows.release.x86_64 = "res://../gmon/target/release/gmon.dll"
|
||||
macos.debug = "res://../gmon/target/debug/libgmon.dylib"
|
||||
macos.release = "res://../gmon/target/release/libgmon.dylib"
|
||||
macos.debug.arm64 = "res://../gmon/target/debug/libgmon.dylib"
|
||||
macos.release.arm64 = "res://../gmon/target/release/libgmon.dylib"
|
||||
16
src/godot/gd/bree_l_player.gd
Normal file
16
src/godot/gd/bree_l_player.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends BreeLPlayer
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_speed_increased() -> void:
|
||||
print("SPEED INCREASED")
|
||||
pass # Replace with function body.
|
||||
16
src/godot/gd/button.gd
Normal file
16
src/godot/gd/button.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Button
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_button_up() -> void:
|
||||
print("button up")
|
||||
get_parent().get_parent().tackled()
|
||||
10
src/godot/gd/name.gd
Normal file
10
src/godot/gd/name.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
self.text = get_parent().mon_name()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
58
src/godot/gd/node_2d.tscn
Normal file
58
src/godot/gd/node_2d.tscn
Normal file
@@ -0,0 +1,58 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dg85xsdqg6wj0"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cneqjngiworik" path="res://icon.svg" id="1_swwii"]
|
||||
[ext_resource type="Script" path="res://gd/texture_progress_bar.gd" id="2_2jm7r"]
|
||||
[ext_resource type="Script" path="res://gd/name.gd" id="3_u8x5l"]
|
||||
[ext_resource type="Script" path="res://gd/button.gd" id="4_iyywh"]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(2, 0)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
z_index = -10
|
||||
position = Vector2(-9.53674e-06, 4.29153e-06)
|
||||
scale = Vector2(9, 5.0625)
|
||||
texture = ExtResource("1_swwii")
|
||||
|
||||
[node name="attacker" type="Mon" parent="."]
|
||||
position = Vector2(-408.5, 157.5)
|
||||
scale = Vector2(2.41406, 2.41406)
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="attacker"]
|
||||
z_index = 10
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
texture_progress = ExtResource("1_swwii")
|
||||
script = ExtResource("2_2jm7r")
|
||||
|
||||
[node name="name" type="RichTextLabel" parent="attacker"]
|
||||
z_index = 10
|
||||
offset_right = 348.0
|
||||
offset_bottom = 40.0
|
||||
text = "asdf"
|
||||
script = ExtResource("3_u8x5l")
|
||||
|
||||
[node name="sprite" type="Sprite2D" parent="attacker"]
|
||||
texture = ExtResource("1_swwii")
|
||||
|
||||
[node name="actions" type="Node2D" parent="attacker"]
|
||||
position = Vector2(169.217, -65.2427)
|
||||
scale = Vector2(0.414239, 0.414239)
|
||||
|
||||
[node name="button" type="Button" parent="attacker/actions"]
|
||||
offset_left = 435.0
|
||||
offset_top = 180.0
|
||||
offset_right = 435.0
|
||||
offset_bottom = 180.0
|
||||
icon = ExtResource("1_swwii")
|
||||
script = ExtResource("4_iyywh")
|
||||
|
||||
[node name="opponent" type="Sprite2D" parent="."]
|
||||
position = Vector2(420, -166)
|
||||
scale = Vector2(2.41406, 2.41406)
|
||||
texture = ExtResource("1_swwii")
|
||||
|
||||
[connection signal="hp_changed" from="attacker" to="attacker/TextureProgressBar" method="_on_mon_hp_changed"]
|
||||
[connection signal="button_up" from="attacker/actions/button" to="attacker/actions/button" method="_on_button_up"]
|
||||
15
src/godot/gd/texture_progress_bar.gd
Normal file
15
src/godot/gd/texture_progress_bar.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
extends TextureProgressBar
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_mon_hp_changed() -> void:
|
||||
self.value = 100 * get_parent().hp()
|
||||
14
src/godot/gd/touch_screen_button.gd
Normal file
14
src/godot/gd/touch_screen_button.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends TouchScreenButton
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _on_pressed() -> void:
|
||||
print("pressed")
|
||||
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 994 B |
@@ -10,7 +10,8 @@ config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="price-is-wrong"
|
||||
config/name="mon"
|
||||
run/main_scene="res://gd/node_2d.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
7
src/mon/Cargo.lock
generated
Normal file
7
src/mon/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "mon"
|
||||
version = "0.1.0"
|
||||
8
src/mon/Cargo.toml
Executable file
8
src/mon/Cargo.toml
Executable file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "mon"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lib]
|
||||
1
src/mon/src/lib.rs
Executable file
1
src/mon/src/lib.rs
Executable file
@@ -0,0 +1 @@
|
||||
pub mod mon;
|
||||
574
src/mon/src/mon.rs
Executable file
574
src/mon/src/mon.rs
Executable file
@@ -0,0 +1,574 @@
|
||||
pub mod mon {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Species {
|
||||
pub name: String,
|
||||
pub hp: i32,
|
||||
pub atk: i32,
|
||||
pub def: i32,
|
||||
pub spd: i32,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod species_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_literal() {
|
||||
let _: Species = Species {
|
||||
name: "".to_string(),
|
||||
hp: 1,
|
||||
atk: 2,
|
||||
def: 3,
|
||||
spd: 4,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Dex {
|
||||
Pika,
|
||||
Mari,
|
||||
}
|
||||
|
||||
impl Dex {
|
||||
pub fn new(&self) -> Species {
|
||||
self.clone().into()
|
||||
}
|
||||
|
||||
pub fn name(&self) -> String {
|
||||
self.new().name
|
||||
}
|
||||
|
||||
pub fn hp(&self) -> i32 {
|
||||
self.new().hp
|
||||
}
|
||||
|
||||
pub fn atk(&self) -> i32 {
|
||||
self.new().atk
|
||||
}
|
||||
|
||||
pub fn def(&self) -> i32 {
|
||||
self.new().def
|
||||
}
|
||||
|
||||
pub fn spd(&self) -> i32 {
|
||||
self.new().spd
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Species> for Dex {
|
||||
fn into(self) -> Species {
|
||||
match self {
|
||||
Dex::Pika => Species {
|
||||
name: "Pika".to_string(),
|
||||
hp: 10,
|
||||
atk: 11,
|
||||
def: 9,
|
||||
spd: 11,
|
||||
},
|
||||
Dex::Mari => Species {
|
||||
name: "Mari".to_string(),
|
||||
hp: 10,
|
||||
atk: 8,
|
||||
def: 12,
|
||||
spd: 9,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod dex_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_dex_to_species() {
|
||||
let dex = Dex::Pika;
|
||||
let _: Species = dex.new();
|
||||
let _: Species = dex.into();
|
||||
let _: Species = Dex::Pika.new();
|
||||
let _: Species = Dex::Pika.into();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Instance {
|
||||
pub dex: Dex,
|
||||
pub damage: i32,
|
||||
}
|
||||
|
||||
impl Instance {
|
||||
pub fn roll(dex: Dex) -> Instance {
|
||||
Instance {
|
||||
dex: dex,
|
||||
damage: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hit(&mut self, damage: i32) {
|
||||
let cap = self.dex.new().hp;
|
||||
self.damage = match self.damage + damage {
|
||||
v if v < cap => v,
|
||||
_ => cap,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod instance_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_instance_roll() {
|
||||
let i: Instance = Instance::roll(Dex::Pika);
|
||||
assert_eq!(0, i.damage);
|
||||
assert_eq!(Dex::Pika, i.dex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod battle {
|
||||
use super::*;
|
||||
|
||||
pub struct Engine {
|
||||
teams: Vec<Team>,
|
||||
q: Vec<Move>,
|
||||
}
|
||||
|
||||
impl Engine {
|
||||
pub fn new(first: Vec<mon::Instance>, second: Vec<mon::Instance>) -> Engine {
|
||||
let mut result = Self {
|
||||
teams: vec![],
|
||||
q: vec![],
|
||||
};
|
||||
result.join(first);
|
||||
result.join(second);
|
||||
result
|
||||
}
|
||||
|
||||
pub fn join(&mut self, third: Vec<mon::Instance>) {
|
||||
self.teams.push(Team::new(third));
|
||||
}
|
||||
|
||||
pub fn enqueue(&mut self, m: Move) -> Result<(), String> {
|
||||
match m {
|
||||
Move::Attack(w_idx, r_idx) => {
|
||||
if self.teams()[w_idx].lost {
|
||||
return Err(format!("team[{w_idx}] lost"));
|
||||
}
|
||||
if !self.teams()[w_idx].any_can_attack() {
|
||||
return Err(format!("team[{w_idx}] cannot attack"));
|
||||
}
|
||||
if !self.teams()[r_idx].any_can_be_attacked() {
|
||||
return Err(format!("team[{r_idx}] cannot be attacked"));
|
||||
}
|
||||
}
|
||||
Move::Pass(team_idx) => {
|
||||
if self.teams()[team_idx].lost {
|
||||
return Err(format!("team[{team_idx}] lost"));
|
||||
}
|
||||
if !self.teams()[team_idx].any_can_attack() {
|
||||
return Err(format!("team[{team_idx}] cannot move"));
|
||||
}
|
||||
}
|
||||
Move::Swap(team_idx, mon_idx) => {
|
||||
if self.teams()[team_idx].lost {
|
||||
return Err(format!("team[{team_idx}] lost"));
|
||||
}
|
||||
if !self.teams()[team_idx].mons()[mon_idx].alive() {
|
||||
return Err(format!("team[{team_idx}].mons[{mon_idx}] cannot swap in"));
|
||||
}
|
||||
if self.teams()[team_idx].mons()[mon_idx].out {
|
||||
return Err(format!("team[{team_idx}].mons[{mon_idx}] already in"));
|
||||
}
|
||||
}
|
||||
};
|
||||
self.q.push(m);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn exec(&mut self) -> Vec<Event> {
|
||||
self.turn_order().iter().for_each(|idx| {
|
||||
match self.q[*idx].clone() {
|
||||
Move::Pass(_) => {}
|
||||
Move::Attack(r_team_idx, w_team_idx) => {
|
||||
let r_team = self.teams[r_team_idx].clone();
|
||||
let w_team = &mut self.teams[w_team_idx];
|
||||
|
||||
for r_mon_idx in 0..r_team.mons().len() {
|
||||
let r_mon = &r_team.mons()[r_mon_idx];
|
||||
if !r_mon.can_attack() {
|
||||
continue;
|
||||
}
|
||||
for w_mon_idx in 0..w_team.mons().len() {
|
||||
let w_mon = &w_team.mons()[w_mon_idx];
|
||||
if !w_mon.can_be_attacked() {
|
||||
continue;
|
||||
}
|
||||
let r_mon = &r_mon.mon;
|
||||
let w_mon = &w_mon.mon;
|
||||
w_team.mons[w_mon_idx].mon = Engine::attack(w_mon, r_mon);
|
||||
w_team.mons[w_mon_idx].out =
|
||||
w_team.mons[w_mon_idx].out && w_team.mons[w_mon_idx].alive()
|
||||
}
|
||||
}
|
||||
|
||||
self.teams[w_team_idx] = w_team.to_owned();
|
||||
}
|
||||
Move::Swap(team_idx, mon_idx) => {
|
||||
let mut team = self.teams[team_idx].clone();
|
||||
team.mons = team
|
||||
.mons()
|
||||
.iter()
|
||||
.map(|m| {
|
||||
let mut m = m.clone();
|
||||
m.out = false;
|
||||
m
|
||||
})
|
||||
.collect();
|
||||
team.mons[mon_idx].out = true;
|
||||
self.teams[team_idx] = team;
|
||||
}
|
||||
};
|
||||
});
|
||||
self.new_turn()
|
||||
}
|
||||
|
||||
pub fn teams(&self) -> Vec<Team> {
|
||||
self.teams.iter().map(|t| t.clone()).collect()
|
||||
}
|
||||
|
||||
fn new_turn(&mut self) -> Vec<Event> {
|
||||
self.q = vec![];
|
||||
|
||||
let mut result = vec![];
|
||||
|
||||
let teams = self.teams();
|
||||
let mut teams_not_lost = vec![];
|
||||
for i in 0..teams.len() {
|
||||
let has_mon_out = teams[i].mons().iter().filter(|m| m.out).count() > 0;
|
||||
let has_mon_alive = teams[i].mons().iter().filter(|m| m.alive()).count() > 0;
|
||||
let lost_before = teams[i].lost;
|
||||
|
||||
if !has_mon_out && has_mon_alive {
|
||||
result.push(Event::MustSwap(i));
|
||||
} else if !has_mon_alive && !lost_before {
|
||||
self.teams[i].lost = true;
|
||||
result.push(Event::Lose(i));
|
||||
}
|
||||
|
||||
if !self.teams()[i].lost {
|
||||
teams_not_lost.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
if teams_not_lost.len() == 1 {
|
||||
result.push(Event::Win(teams_not_lost[0]));
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
fn turn_order(&self) -> Vec<usize> {
|
||||
let mut order = vec![];
|
||||
for i in 0..self.q.len() {
|
||||
order.push((
|
||||
i,
|
||||
match &self.q[i] {
|
||||
Move::Pass(_) => 0,
|
||||
Move::Swap(_, _) => -10,
|
||||
Move::Attack(r_team, _) => self.teams[r_team.to_owned()]
|
||||
.mons
|
||||
.iter()
|
||||
.filter(|m| m.can_attack())
|
||||
.map(|m| m.mon.dex.new().spd)
|
||||
.collect::<Vec<_>>()
|
||||
.first()
|
||||
.expect("team had no pokemon to attack")
|
||||
.to_owned(),
|
||||
},
|
||||
));
|
||||
}
|
||||
order.sort_unstable_by(|a, b| a.1.cmp(&b.1));
|
||||
order.iter().map(|x| x.0).collect()
|
||||
}
|
||||
|
||||
fn attack(w: &mon::Instance, r: &mon::Instance) -> mon::Instance {
|
||||
let mut w = w.clone();
|
||||
let atk_delta = r.dex.new().atk - 10;
|
||||
let def_delta = w.dex.new().def - 10;
|
||||
|
||||
let power = match atk_delta - def_delta {
|
||||
v if v < 1 => 1,
|
||||
v => v,
|
||||
};
|
||||
|
||||
w.hit(power);
|
||||
|
||||
w
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod engine_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_new() {
|
||||
let mut engine = Engine::new(team_a(), team_b());
|
||||
engine.join(team_b());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_attack() {
|
||||
let mut pika = mon::Instance::roll(mon::Dex::Pika);
|
||||
let mut mari = mon::Instance::roll(mon::Dex::Mari);
|
||||
|
||||
pika = Engine::attack(&mut pika, &mut mari);
|
||||
assert_eq!(1, pika.damage);
|
||||
|
||||
mari = Engine::attack(&mut mari, &mut pika);
|
||||
assert_eq!(1, mari.damage);
|
||||
|
||||
for _ in 0..pika.dex.new().hp + 5 {
|
||||
pika = Engine::attack(&mut pika, &mut mari);
|
||||
}
|
||||
assert_eq!(pika.dex.new().hp, pika.damage);
|
||||
assert_eq!(1, mari.damage);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_turn() {
|
||||
let mut engine = Engine::new(team_a(), team_b());
|
||||
engine.join(team_b());
|
||||
|
||||
// player 0 mon 0 attacks team 1 mon 0
|
||||
engine
|
||||
.enqueue(Move::Attack(0, 1))
|
||||
.expect("failed to attack");
|
||||
// player 1 mon 0 passes
|
||||
engine.enqueue(Move::Pass(1)).expect("failed to pass");
|
||||
// player 1 mon 1 not out
|
||||
assert_eq!(0, engine.exec().len());
|
||||
|
||||
assert_eq!(0, engine.teams()[0].mons()[0].mon.damage);
|
||||
assert_eq!(1, engine.teams()[1].mons()[0].mon.damage);
|
||||
assert_eq!(0, engine.teams()[1].mons()[1].mon.damage);
|
||||
}
|
||||
|
||||
fn team_a() -> Vec<mon::Instance> {
|
||||
vec![mon::Instance::roll(mon::Dex::Pika)]
|
||||
}
|
||||
|
||||
fn team_b() -> Vec<mon::Instance> {
|
||||
vec![
|
||||
mon::Instance::roll(mon::Dex::Mari),
|
||||
mon::Instance::roll(mon::Dex::Pika),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Team {
|
||||
mons: Vec<Instance>,
|
||||
lost: bool,
|
||||
}
|
||||
|
||||
impl Team {
|
||||
fn new(mons: Vec<mon::Instance>) -> Self {
|
||||
assert!(mons.len() > 0);
|
||||
let mut mons: Vec<_> = mons
|
||||
.iter()
|
||||
.map(|m| Instance {
|
||||
mon: m.clone(),
|
||||
out: false,
|
||||
})
|
||||
.collect();
|
||||
mons[0].out = true;
|
||||
Self {
|
||||
mons: mons.clone(),
|
||||
lost: mons.len() == 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mons(&self) -> Vec<Instance> {
|
||||
self.mons.iter().map(|i| i.clone()).collect()
|
||||
}
|
||||
|
||||
fn any_can_attack(&self) -> bool {
|
||||
self.mons().iter().filter(|m| m.can_attack()).count() > 0
|
||||
}
|
||||
|
||||
fn any_can_be_attacked(&self) -> bool {
|
||||
self.mons().iter().filter(|m| m.can_be_attacked()).count() > 0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Instance {
|
||||
pub mon: mon::Instance,
|
||||
pub out: bool,
|
||||
}
|
||||
|
||||
impl Instance {
|
||||
fn alive(&self) -> bool {
|
||||
self.damage() < self.mon.dex.new().hp
|
||||
}
|
||||
|
||||
fn can_attack(&self) -> bool {
|
||||
self.out && self.alive()
|
||||
}
|
||||
|
||||
fn can_be_attacked(&self) -> bool {
|
||||
self.out && self.alive()
|
||||
}
|
||||
|
||||
pub fn damage(&self) -> i32 {
|
||||
self.mon.damage
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod instance_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_checks() {
|
||||
let mut i = Instance {
|
||||
mon: mon::Instance::roll(mon::Dex::Pika),
|
||||
out: true,
|
||||
};
|
||||
assert_eq!(true, i.alive());
|
||||
assert_eq!(true, i.can_attack());
|
||||
assert_eq!(true, i.can_be_attacked());
|
||||
i.mon.damage = i.mon.dex.new().hp;
|
||||
assert_eq!(false, i.alive());
|
||||
assert_eq!(false, i.can_attack());
|
||||
assert_eq!(false, i.can_be_attacked());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Move {
|
||||
Pass(usize),
|
||||
Attack(usize, usize),
|
||||
Swap(usize, usize),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Event {
|
||||
MustSwap(usize),
|
||||
Lose(usize),
|
||||
Win(usize),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod mon_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
let mut my_mons = vec![
|
||||
mon::Instance::roll(mon::Dex::Pika),
|
||||
mon::Instance::roll(mon::Dex::Mari),
|
||||
];
|
||||
my_mons[0].hit(5);
|
||||
let they_mons = vec![
|
||||
mon::Instance::roll(mon::Dex::Mari),
|
||||
mon::Instance::roll(mon::Dex::Mari),
|
||||
mon::Instance::roll(mon::Dex::Mari),
|
||||
];
|
||||
|
||||
let mut engine = battle::Engine::new(my_mons, they_mons);
|
||||
|
||||
// team0mon0 trades attacks with team1mon0
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to attack");
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(0, 1))
|
||||
.expect("failed to attack");
|
||||
assert_eq!(0, engine.exec().len());
|
||||
assert_eq!(6, engine.teams()[0].mons()[0].damage());
|
||||
assert_eq!(0, engine.teams()[0].mons()[1].damage());
|
||||
assert_eq!(1, engine.teams()[1].mons()[0].damage());
|
||||
assert_eq!(0, engine.teams()[1].mons()[1].damage());
|
||||
assert_eq!(0, engine.teams()[1].mons()[2].damage());
|
||||
|
||||
// team0mon0 swaps with team0mon0
|
||||
// team1mon0 attacks team0
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to attack");
|
||||
engine
|
||||
.enqueue(battle::Move::Swap(0, 1))
|
||||
.expect("failed to swap");
|
||||
assert_eq!(0, engine.exec().len());
|
||||
assert_eq!(6, engine.teams()[0].mons()[0].damage());
|
||||
assert_eq!(1, engine.teams()[0].mons()[1].damage());
|
||||
assert_eq!(1, engine.teams()[1].mons()[0].damage());
|
||||
assert_eq!(0, engine.teams()[1].mons()[1].damage());
|
||||
assert_eq!(0, engine.teams()[1].mons()[2].damage());
|
||||
|
||||
// team1mon0 wears down team0mon1
|
||||
for i in 2..engine.teams()[0].mons()[1].mon.dex.hp() {
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to attack");
|
||||
assert_eq!(0, engine.exec().len());
|
||||
assert_eq!(i, engine.teams()[0].mons()[1].damage());
|
||||
}
|
||||
|
||||
// team1mon0 downs team0mon1
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to kill");
|
||||
let turn_results = engine.exec();
|
||||
assert_eq!(1, turn_results.len());
|
||||
assert_eq!(battle::Event::MustSwap(0), turn_results[0]);
|
||||
assert_eq!(
|
||||
engine.teams()[0].mons()[1].mon.dex.hp(),
|
||||
engine.teams()[0].mons()[1].damage()
|
||||
);
|
||||
assert!(!engine.teams()[0].mons()[1].out);
|
||||
|
||||
// team0 must swap
|
||||
assert!(engine.enqueue(battle::Move::Attack(0, 1)).is_err());
|
||||
assert!(engine.enqueue(battle::Move::Pass(0)).is_err());
|
||||
engine
|
||||
.enqueue(battle::Move::Swap(0, 0))
|
||||
.expect("failed to swap on MustSwap");
|
||||
assert!(engine.enqueue(battle::Move::Attack(1, 0)).is_err());
|
||||
assert_eq!(0, engine.exec().len());
|
||||
|
||||
// team1mon0 wears down team0mon0
|
||||
for i in 7..engine.teams()[0].mons()[0].mon.dex.hp() {
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to attack");
|
||||
assert_eq!(0, engine.exec().len());
|
||||
assert_eq!(i, engine.teams()[0].mons()[0].damage());
|
||||
}
|
||||
|
||||
// team1mon0 downs team0mon0
|
||||
// team0 loses
|
||||
// team1 wins
|
||||
engine
|
||||
.enqueue(battle::Move::Attack(1, 0))
|
||||
.expect("failed to kill");
|
||||
let turn_results = engine.exec();
|
||||
assert_eq!(2, turn_results.len(), "{:?}", turn_results);
|
||||
assert_eq!(
|
||||
battle::Event::Lose(0),
|
||||
turn_results[0],
|
||||
"{:?}",
|
||||
turn_results
|
||||
);
|
||||
assert_eq!(battle::Event::Win(1), turn_results[1], "{:?}", turn_results);
|
||||
assert_eq!(
|
||||
engine.teams()[0].mons()[0].mon.dex.hp(),
|
||||
engine.teams()[0].mons()[0].damage()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user