Client features

- work on computer scripting
- work on discord rich presence
- work on ui
Libspace features
- work on wiki
- work on damage types
- work on a standard protocol
- work on user info
This commit is contained in:
Able 2022-05-02 05:06:36 -05:00
parent e49c36d9cb
commit ec5c27c260
24 changed files with 841 additions and 118 deletions

527
Cargo.lock generated
View file

@ -7,6 +7,15 @@ name = "SpaceGameTM"
version = "0.1.0"
dependencies = [
"bevy",
"bevy-discord-presence",
"bevy_egui",
"bevy_framepace",
"bevy_rhai",
"bevy_screen_diags",
"discord-presence",
"egui",
"libspace",
"rhai",
"serde",
]
@ -225,7 +234,7 @@ checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom",
"once_cell",
"version_check",
"version_check 0.9.4",
]
[[package]]
@ -261,7 +270,7 @@ dependencies = [
"alsa-sys",
"bitflags",
"libc",
"nix",
"nix 0.23.1",
]
[[package]]
@ -316,6 +325,26 @@ dependencies = [
"num-traits",
]
[[package]]
name = "arboard"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6045ca509e4abacde2b884ac4618a51d0c017b5d85a3ee84a7226eb33b3154a9"
dependencies = [
"clipboard-win",
"core-graphics 0.22.3",
"image",
"log",
"objc",
"objc-foundation",
"objc_id",
"once_cell",
"parking_lot 0.12.0",
"thiserror",
"winapi",
"x11rb",
]
[[package]]
name = "arrayvec"
version = "0.7.2"
@ -328,7 +357,7 @@ version = "0.34.0+1.2.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0f780da53d0063880d45554306489f09dd8d1bda47688b4a57bc579119356df"
dependencies = [
"libloading",
"libloading 0.7.3",
]
[[package]]
@ -362,6 +391,12 @@ version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9"
[[package]]
name = "atomic_refcell"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
[[package]]
name = "autocfg"
version = "1.1.0"
@ -402,6 +437,17 @@ dependencies = [
"syn",
]
[[package]]
name = "bevy-discord-presence"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d8fab635ff45976721ea0e6eaf11600b92f0012db8751f0f973af9526ec0e"
dependencies = [
"bevy",
"discord-presence",
"serde_json",
]
[[package]]
name = "bevy_animation"
version = "0.7.0"
@ -582,6 +628,29 @@ dependencies = [
"syn",
]
[[package]]
name = "bevy_egui"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27dc596053c0aa4b5ec698d8d7ef524f6cc457db7ac7d42c330f32d80720bff6"
dependencies = [
"arboard",
"bevy",
"egui",
"thread_local",
"webbrowser",
]
[[package]]
name = "bevy_framepace"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ac1ae0ceb2dee804531af6701b1b430c1ba868c4f3c5d4d9d7817fb5bd47452"
dependencies = [
"bevy",
"spin_sleep",
]
[[package]]
name = "bevy_gilrs"
version = "0.7.0"
@ -767,7 +836,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn",
"uuid",
"uuid 0.8.2",
]
[[package]]
@ -806,6 +875,20 @@ dependencies = [
"wgpu",
]
[[package]]
name = "bevy_rhai"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4632f35783947a83c6268f502b92c2e5637f45cf3d3519f00fab3175e313aa60"
dependencies = [
"anyhow",
"bevy_app",
"bevy_asset",
"bevy_ecs",
"bevy_reflect",
"rhai",
]
[[package]]
name = "bevy_scene"
version = "0.7.0"
@ -822,7 +905,16 @@ dependencies = [
"ron",
"serde",
"thiserror",
"uuid",
"uuid 0.8.2",
]
[[package]]
name = "bevy_screen_diags"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00d2b66ba0c86e892747506bea761a37c0e79d5efacc93b1980fcf7710e1f8b8"
dependencies = [
"bevy",
]
[[package]]
@ -943,7 +1035,7 @@ dependencies = [
"hashbrown",
"instant",
"tracing",
"uuid",
"uuid 0.8.2",
]
[[package]]
@ -981,12 +1073,13 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.56.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
checksum = "99de13bb6361e01e493b3db7928085dcc474b7ba4f5481818e53a89d76b8393f"
dependencies = [
"bitflags",
"cexpr",
"cfg-if 0.1.10",
"clang-sys",
"lazy_static",
"lazycell",
@ -1136,9 +1229,9 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.4.0"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
dependencies = [
"nom",
]
@ -1163,13 +1256,24 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "clang-sys"
version = "1.3.1"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21"
checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
dependencies = [
"glob",
"libc",
"libloading",
"libloading 0.5.2",
]
[[package]]
name = "clipboard-win"
version = "4.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db"
dependencies = [
"error-code",
"str-buf",
"winapi",
]
[[package]]
@ -1262,7 +1366,7 @@ checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05"
dependencies = [
"percent-encoding",
"time",
"version_check",
"version_check 0.9.4",
]
[[package]]
@ -1381,9 +1485,9 @@ dependencies = [
[[package]]
name = "coreaudio-sys"
version = "0.2.9"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca4679a59dbd8c15f064c012dfe8c1163b9453224238b59bb9328c142b8b248b"
checksum = "17f73df0f29f4c3c374854f076c47dc018f19acaa63538880dba0937ad4fa8d7"
dependencies = [
"bindgen",
]
@ -1404,7 +1508,7 @@ dependencies = [
"mach 0.3.2",
"ndk 0.6.0",
"ndk-glue 0.6.1",
"nix",
"nix 0.23.1",
"oboe",
"parking_lot 0.11.2",
"stdweb 0.1.3",
@ -1475,7 +1579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2daefd788d1e96e0a9d66dee4b828b883509bc3ea9ce30665f04c3246372690c"
dependencies = [
"bitflags",
"libloading",
"libloading 0.7.3",
"winapi",
]
@ -1553,6 +1657,26 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "discord-presence"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbdf0333b5919eb714eef66ef3bd3fc5765db1b80de24d3ac5c7304baa476f5c"
dependencies = [
"byteorder",
"bytes",
"crossbeam-channel",
"log",
"named_pipe",
"num-derive",
"num-traits",
"parking_lot 0.12.0",
"serde",
"serde_derive",
"serde_json",
"uuid 1.0.0",
]
[[package]]
name = "dispatch"
version = "0.2.0"
@ -1565,6 +1689,26 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "egui"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb095a8b9feb9b7ff8f00b6776dffcef059538a3f4a91238e03c900e9c9ad9a2"
dependencies = [
"ahash",
"epaint",
"nohash-hasher",
]
[[package]]
name = "emath"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c223f58c7e38abe1770f367b969f1b3fbd4704b67666bcb65dbb1adb0980ba72"
dependencies = [
"bytemuck",
]
[[package]]
name = "encoding_rs"
version = "0.8.31"
@ -1584,6 +1728,21 @@ dependencies = [
"regex",
]
[[package]]
name = "epaint"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c29567088888e8ac3e8f61bbb2ddc820207ebb8d69eefde5bcefa06d65e4e89"
dependencies = [
"ab_glyph",
"ahash",
"atomic_refcell",
"bytemuck",
"emath",
"nohash-hasher",
"parking_lot 0.12.0",
]
[[package]]
name = "erased-serde"
version = "0.3.20"
@ -1593,6 +1752,16 @@ dependencies = [
"serde",
]
[[package]]
name = "error-code"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
dependencies = [
"libc",
"str-buf",
]
[[package]]
name = "euclid"
version = "0.22.7"
@ -1760,7 +1929,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
dependencies = [
"typenum",
"version_check",
"version_check 0.9.4",
]
[[package]]
name = "gethostname"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
dependencies = [
"libc",
"winapi",
]
[[package]]
@ -1785,7 +1964,7 @@ dependencies = [
"fnv",
"gilrs-core",
"log",
"uuid",
"uuid 0.8.2",
"vec_map",
]
@ -1801,10 +1980,10 @@ dependencies = [
"libc",
"libudev-sys",
"log",
"nix",
"nix 0.23.1",
"rusty-xinput",
"stdweb 0.4.20",
"uuid",
"uuid 0.8.2",
"vec_map",
"web-sys",
"winapi",
@ -2048,6 +2227,7 @@ dependencies = [
"num-traits",
"png",
"scoped_threadpool",
"tiff",
]
[[package]]
@ -2149,6 +2329,12 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]]
name = "js-sys"
version = "0.3.57"
@ -2165,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3"
dependencies = [
"libc",
"libloading",
"libloading 0.7.3",
]
[[package]]
@ -2223,6 +2409,16 @@ version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb691a747a7ab48abc15c5b42066eaafde10dc427e3b6ee2a1cf43db04c763bd"
[[package]]
name = "libloading"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
dependencies = [
"cc",
"winapi",
]
[[package]]
name = "libloading"
version = "0.7.3"
@ -2243,6 +2439,9 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
name = "libspace"
version = "0.1.0"
dependencies = [
"bevy_ecs",
"naia-shared",
"nanoid",
"serde",
]
@ -2379,6 +2578,16 @@ dependencies = [
"adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.5.1"
@ -2450,6 +2659,90 @@ dependencies = [
"thiserror",
]
[[package]]
name = "naia-derive"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac0afde39541a40c7c9ee4cc04d6af37fe3d0b1d1e1336139b9220e3df85b9d9"
dependencies = [
"naia-parse",
"naia-serde-derive",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "naia-parse"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "868aabdd8cc541ce30f3db89b61fb57a15dc9139d6ab88a772e4d5b30a68af77"
[[package]]
name = "naia-serde"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8215479a3e99d86c86ff4df320d226b65879823de4d74a9647707c3149ddc914"
dependencies = [
"cfg-if 1.0.0",
"log",
"naia-serde-derive",
]
[[package]]
name = "naia-serde-derive"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b54880b7d9a96304c806159b0cacbf5e68c0e595a76ca54b4635fd6c361c0388"
dependencies = [
"cfg-if 1.0.0",
"log",
"naia-parse",
]
[[package]]
name = "naia-shared"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9720cc904695beb9051e7f9de8ea462ef37d04a65739713c8be78a3e94335e02"
dependencies = [
"cfg-if 1.0.0",
"log",
"naia-derive",
"naia-serde",
"naia-socket-shared",
]
[[package]]
name = "naia-socket-shared"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf018241a885674b5a1545a4438ac5919552f31a638d35a8f7dd7cb6cf389894"
dependencies = [
"cfg-if 1.0.0",
"log",
"rand",
"url",
]
[[package]]
name = "named_pipe"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad9c443cce91fc3e12f017290db75dde490d685cdaaf508d7159d7cf41f0eb2b"
dependencies = [
"winapi",
]
[[package]]
name = "nanoid"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8"
dependencies = [
"rand",
]
[[package]]
name = "ndk"
version = "0.5.0"
@ -2541,6 +2834,19 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "nix"
version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.23.1"
@ -2555,13 +2861,19 @@ dependencies = [
]
[[package]]
name = "nom"
version = "5.1.2"
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
dependencies = [
"memchr",
"version_check",
"version_check 0.1.5",
]
[[package]]
@ -2693,6 +3005,17 @@ dependencies = [
"objc_exception",
]
[[package]]
name = "objc-foundation"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
dependencies = [
"block",
"objc",
"objc_id",
]
[[package]]
name = "objc_exception"
version = "0.1.2"
@ -2702,6 +3025,15 @@ dependencies = [
"cc",
]
[[package]]
name = "objc_id"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
dependencies = [
"objc",
]
[[package]]
name = "oboe"
version = "0.4.5"
@ -3002,6 +3334,32 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
[[package]]
name = "rhai"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ef3d57e55ca044c53ced279d2d3ee9df229b247556b005a23713d5206a2ecfc"
dependencies = [
"ahash",
"bitflags",
"instant",
"num-traits",
"rhai_codegen",
"smallvec",
"smartstring",
]
[[package]]
name = "rhai_codegen"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faa0ff1c9dc19c9f8bba510a2a75d3f0449f6233570c2672c7e31c692a11a59a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "rodio"
version = "0.15.0"
@ -3152,6 +3510,11 @@ dependencies = [
[[package]]
name = "server"
version = "0.1.0"
dependencies = [
"bevy",
"libspace",
"serde",
]
[[package]]
name = "sha-1"
@ -3215,7 +3578,7 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
dependencies = [
"version_check",
"version_check 0.9.4",
]
[[package]]
@ -3227,6 +3590,17 @@ dependencies = [
"serde",
]
[[package]]
name = "smartstring"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
dependencies = [
"autocfg",
"static_assertions",
"version_check 0.9.4",
]
[[package]]
name = "socket2"
version = "0.4.4"
@ -3237,6 +3611,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "spin_sleep"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cafa7900db085f4354dbc7025e25d7a839a14360ea13b5fc4fd717f2d3b23134"
dependencies = [
"once_cell",
"winapi",
]
[[package]]
name = "spirv"
version = "0.2.0+1.5.4"
@ -3247,6 +3631,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stdweb"
version = "0.1.3"
@ -3304,6 +3694,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
[[package]]
name = "str-buf"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a"
[[package]]
name = "stretch"
version = "0.3.2"
@ -3375,6 +3771,17 @@ dependencies = [
"once_cell",
]
[[package]]
name = "tiff"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437"
dependencies = [
"jpeg-decoder",
"miniz_oxide 0.4.4",
"weezl",
]
[[package]]
name = "time"
version = "0.3.9"
@ -3585,6 +3992,15 @@ dependencies = [
"serde",
]
[[package]]
name = "uuid"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0"
dependencies = [
"getrandom",
]
[[package]]
name = "valuable"
version = "0.1.0"
@ -3597,6 +4013,12 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
name = "version_check"
version = "0.9.4"
@ -3708,6 +4130,26 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webbrowser"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6a3cffdb686fbb24d9fb8f03a213803277ed2300f11026a3afe1f108dc021b"
dependencies = [
"jni",
"ndk-glue 0.6.1",
"url",
"web-sys",
"widestring",
"winapi",
]
[[package]]
name = "weezl"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4"
[[package]]
name = "wgpu"
version = "0.12.0"
@ -3773,7 +4215,7 @@ dependencies = [
"inplace_it",
"js-sys",
"khronos-egl",
"libloading",
"libloading 0.7.3",
"log",
"metal",
"naga",
@ -3799,6 +4241,12 @@ dependencies = [
"bitflags",
]
[[package]]
name = "widestring"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
[[package]]
name = "wiki_server"
version = "0.1.0"
@ -3833,6 +4281,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "winapi-wsapoll"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@ -3923,6 +4380,18 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "x11rb"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a"
dependencies = [
"gethostname",
"nix 0.22.3",
"winapi",
"winapi-wsapoll",
]
[[package]]
name = "xi-unicode"
version = "0.3.0"

View file

@ -8,3 +8,15 @@ resolver = "2"
[dependencies]
bevy = { version = "0.7.0", features = ["dynamic"] }
serde = { version = "1.0.136", features = ["derive"] }
libspace = { path="../libspace" }
bevy_screen_diags = "*"
bevy_framepace = "0.4.0"
bevy_rhai = "0.3.0"
rhai ="*"
bevy-discord-presence = "0.2"
bevy_egui = "0.14"
egui= "*"
discord-presence = "0.5.0"

View file

@ -1,5 +1,9 @@
# Name Here
# Time System
- Ticks per IRL Second: 60
- How long is an ingame minute?
# Armory
## Helmets
@ -13,6 +17,7 @@
## Boots
# Bestiary
## Fungi
## Animals
@ -21,20 +26,16 @@
## Pathogen
# Factions
# Ship Capacity
##
# Servers
## Auth Server
## Alpha (Game Server)
### Relay (America)

View file

@ -0,0 +1,2 @@
counter.count += 105;
print("Hi");

View file

@ -0,0 +1,88 @@
use bevy::{core::FixedTimestep, prelude::*};
use bevy_rhai::*;
use rhai::plugin::*;
#[derive(Debug, Clone, Copy, Default, Component)]
pub struct Counter {
count: i64,
}
pub type Screen = [char; 80 * 25];
pub struct Computer {
pub screen: Screen,
}
#[rhai::export_module]
mod counter_api {
#[rhai_fn(get = "count", pure)]
pub fn count(counter: &mut Counter) -> i64 {
counter.count
}
#[rhai_fn(set = "count", pure)]
pub fn set_count(counter: &mut Counter, count: i64) {
counter.count = count
}
}
pub struct ComputerPlugin;
impl Plugin for ComputerPlugin {
fn build(&self, app: &mut App) {
app.add_plugin(StandardScriptPlugin)
.add_startup_system(setup)
.add_system_set(
SystemSet::new()
.with_run_criteria(FixedTimestep::steps_per_second(2.0))
.with_system(increment),
);
}
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let increment: Handle<StandardScript> = asset_server.load("increment.rhai");
asset_server.watch_for_changes().unwrap();
commands
.spawn()
.insert(StandardEngine::with_engine(engine_construction()))
.insert(StandardScope::default())
.insert(Counter::default())
.insert(increment);
}
fn increment(
scripts: Res<Assets<StandardScript>>,
mut query: Query<(
&StandardEngine,
&Handle<StandardScript>,
&mut StandardScope,
&mut Counter,
)>,
) {
for (engine, script, mut scope, mut counter) in query.iter_mut() {
if let Some(script) = scripts.get(script) {
scope.set_or_push("counter", *counter);
engine.run_ast_with_scope(&mut scope, &script.ast).unwrap();
*counter = scope.get_value("counter").unwrap();
info!("Counter: {:?}", counter);
}
}
}
pub fn engine_construction() -> Engine {
let mut engine = Engine::new();
// allow strings only up to 500 bytes long (in UTF-8 format)
engine.set_max_string_size(500);
engine.set_strict_variables(true);
engine.on_print(|x| println!("hello: {}", x));
engine
.disable_symbol("eval")
.register_type_with_name::<Counter>("Counter")
.register_global_module(exported_module!(counter_api).into());
engine
}

33
client/src/discord.rs Normal file
View file

@ -0,0 +1,33 @@
use bevy::{
core::{Time, Timer},
prelude::*,
};
use bevy_discord_presence::{ActivityState, RPCConfig, RPCPlugin};
pub struct DiscordPlugin;
impl Plugin for DiscordPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(UpdateTimer(Timer::from_seconds(2.0, true)))
.add_plugin(RPCPlugin(RPCConfig {
app_id: 970599240957042718,
show_time: true,
}))
.add_system(update_presence);
}
}
struct UpdateTimer(Timer);
fn update_presence(
time: Res<Time>,
mut timer: ResMut<UpdateTimer>,
mut state: ResMut<ActivityState>,
) {
// update our timer with the time elapsed since the last update
// if that caused the timer to finish, we say hello to everyone
if timer.0.tick(time.delta()).just_finished() {
state.instance = Some(true);
state.details = Some("Hello World".to_string());
state.state = Some("This is state".to_string());
}
}

View file

@ -1,91 +1,58 @@
#![feature(default_free_fn)]
pub mod computer;
pub mod discord;
pub mod species;
// pub mod wiki;
pub mod ui;
// use crate::{computer::ComputerPlugin, discord::DiscordPlugin};
use bevy::prelude::*;
use bevy::winit::WinitSettings;
use std::default::default;
use bevy_egui::EguiPlugin;
use bevy_framepace::FramepacePlugin;
use libspace::user::generate_user_id;
use crate::ui::{
client_settings::{client_settings, Settings},
stats::stats_ui,
wiki::wiki_ui,
};
fn main() {
println!("{}", generate_user_id());
App::new()
.add_plugins(DefaultPlugins)
.insert_resource(WinitSettings::game())
.insert_resource(UI { wiki_open: false })
.add_startup_system(setup)
.add_system(button_system)
.insert_resource(Settings::default())
.add_plugin(FramepacePlugin::default().without_warnings())
// .add_plugin(ComputerPlugin) // Pending: Jordans acceptance
// .add_plugin(DiscordPlugin) // FIXME: Preformance increase, halts game while updating
.add_plugin(EguiPlugin)
.add_system(client_settings)
.add_system(settings_handler)
.add_system(wiki_ui)
.add_system(stats_ui)
.run();
}
pub struct UI {
pub wiki_open: bool,
}
#[derive(Component)]
struct EnableText;
const NORMAL_BUTTON: Color = Color::rgb(0.15, 0.15, 0.15);
const HOVERED_BUTTON: Color = Color::rgb(0.25, 0.25, 0.25);
const PRESSED_BUTTON: Color = Color::rgb(0.35, 0.75, 0.35);
fn settings_handler(
mut plugin: ResMut<FramepacePlugin>,
mut windows: ResMut<Windows>,
fn button_system(
mut interaction_query: Query<
(&Interaction, &mut UiColor, &Children),
(Changed<Interaction>, With<Button>),
>,
mut text_query: Query<&mut Text>,
mut ui_query: ResMut<UI>,
settings: Res<Settings>,
) {
for (interaction, mut color, children) in interaction_query.iter_mut() {
let mut text = text_query.get_mut(children[0]).unwrap();
match *interaction {
Interaction::Clicked => {
text.sections[0].value = "Press".to_string();
ui_query.wiki_open = !ui_query.wiki_open;
let window = windows.primary_mut();
println!("Wiki open: {}", ui_query.wiki_open);
*color = PRESSED_BUTTON.into();
}
Interaction::Hovered => {
text.sections[0].value = "Hover".to_string();
println!("Hovered");
*color = HOVERED_BUTTON.into();
}
Interaction::None => {
text.sections[0].value = "Button".to_string();
*color = NORMAL_BUTTON.into();
plugin.framerate_limit = bevy_framepace::FramerateLimit::Manual(settings.target_fps);
use bevy::window::WindowMode::{BorderlessFullscreen, Windowed};
match settings.fullscreen {
true => window.set_mode(BorderlessFullscreen),
false => window.set_mode(Windowed),
}
}
}
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// ui camera
commands.spawn_bundle(UiCameraBundle::default());
commands
.spawn_bundle(ButtonBundle {
style: Style {
size: Size::new(Val::Px(150.0), Val::Px(65.0)),
// center button
margin: Rect::all(Val::Auto),
// horizontally center child text
justify_content: JustifyContent::Center,
// vertically center child text
align_items: AlignItems::Center,
..default()
},
color: NORMAL_BUTTON.into(),
..default()
})
.with_children(|parent| {
parent.spawn_bundle(TextBundle {
text: Text::with_section(
"Button",
TextStyle {
font: asset_server.load("fonts/OpenSans/OpenSans-Regular.ttf"),
font_size: 40.0,
color: Color::rgb(0.9, 0.9, 0.9),
},
Default::default(),
),
..default()
});
});
}

View file

@ -0,0 +1,27 @@
use bevy::prelude::*;
use bevy_egui::EguiContext;
pub struct Settings {
pub target_fps: u16,
pub fullscreen: bool,
}
impl Default for Settings {
fn default() -> Self {
Self {
target_fps: 60,
fullscreen: false,
}
}
}
pub fn client_settings(mut egui_context: ResMut<EguiContext>, mut settings: ResMut<Settings>) {
egui::Window::new("Settings")
.resizable(false)
.show(egui_context.ctx_mut(), |ui| {
ui.horizontal(|ui| {
ui.add(egui::Slider::new(&mut settings.target_fps, 5..=120).step_by(5.0));
ui.label(": FPS");
});
ui.checkbox(&mut settings.fullscreen, "Fullscreen");
});
}

3
client/src/ui/mod.rs Normal file
View file

@ -0,0 +1,3 @@
pub mod client_settings;
pub mod stats;
pub mod wiki;

11
client/src/ui/stats.rs Normal file
View file

@ -0,0 +1,11 @@
use bevy::prelude::*;
use bevy_egui::EguiContext;
pub fn stats_ui(mut egui_context: ResMut<EguiContext>) {
egui::Window::new("Stats").show(egui_context.ctx_mut(), |ui| {
ui.label("Health: 123");
ui.label("Stamina: 123");
ui.label("Hunger: 123");
ui.label("Thirst: 123");
});
}

6
client/src/ui/wiki.rs Normal file
View file

@ -0,0 +1,6 @@
use bevy::prelude::*;
use bevy_egui::EguiContext;
pub fn wiki_ui(mut egui_context: ResMut<EguiContext>) {
egui::Window::new("Wiki").show(egui_context.ctx_mut(), |ui| {});
}

View file

@ -7,3 +7,6 @@ edition = "2021"
[dependencies]
serde = { version = "1.0.136", features = ["derive"] }
nanoid = "0.4.0"
naia-shared = "*"
bevy_ecs = "*"

View file

@ -1 +0,0 @@
pub enum API {}

0
libspace/src/chat/mod.rs Normal file
View file

10
libspace/src/damage.rs Normal file
View file

@ -0,0 +1,10 @@
pub type Speed = f32;
pub type Intensity = f32;
pub type Temperature = f32;
// TODO: Refine damage types.
pub enum DamageType {
Kinetic(Speed),
Energy(Intensity),
Heat(Temperature),
}

18
libspace/src/datetime.rs Normal file
View file

@ -0,0 +1,18 @@
#[derive(Default)]
pub struct DateTime {
pub year: u16,
pub month: u8,
pub day: u8,
pub hour: u32,
pub minute: u32,
pub second: u32,
}
impl DateTime {
pub fn format(&self) -> String {
format!(
"{:02}/{:02}/{:02}-{:02}:{:02}:{:02}",
self.year, self.month, self.day, self.hour, self.minute, self.second
)
}
}

View file

@ -1,3 +1,8 @@
pub mod armor;
pub mod currency;
pub mod damage;
pub mod datetime;
pub mod protocol;
pub mod ship;
pub mod user;
pub mod wiki;

7
libspace/src/protocol.rs Normal file
View file

@ -0,0 +1,7 @@
use crate::user::User;
use naia_shared::Protocolize;
#[derive(Protocolize)]
pub enum Protocol {
User(User),
}

View file

@ -1,7 +1,7 @@
pub enum ShipCapacity {
Tiny, // 1-2 person ship
Small, // 4-5 person ship
Medium, // 10-15 person ship
Large, // 50-100 person ship
Huge, // Minimum 200 person ship
Tiny = 1, // 1-2 person ship
Small = 2, // 4-5 person ship
Medium = 3, // 10-15 person ship
Large = 4, // 50-100 person ship
Huge = 5, // Minimum 200 person ship
}

18
libspace/src/user.rs Normal file
View file

@ -0,0 +1,18 @@
// use crate::protocol::Protocol::User;
use bevy_ecs::prelude::Component;
use naia_shared::{Property, Replicate};
use nanoid::nanoid;
pub type UserID = String;
#[derive(Component, Replicate)]
#[protocol_path = "crate::protocol::Protocol"]
pub struct User {
pub id: Property<UserID>,
pub name: Property<String>,
}
pub fn generate_user_id() -> UserID {
let id = nanoid!(10);
UserID::from(id.to_string())
}

View file

@ -6,3 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = { version = "0.7.0", features = ["dynamic"] }
serde = { version = "1.0.136", features = ["derive"] }
libspace = { path="../libspace" }

View file

@ -1,3 +1,44 @@
use bevy::{app::ScheduleRunnerSettings, prelude::*, utils::Duration};
use libspace::datetime::DateTime;
// TODO: Workout a proper TPS for the server.
pub const TICKS_PER_SECOND: u32 = 20;
fn main() {
println!("Hello, world!");
App::new()
.insert_resource(ScheduleRunnerSettings::run_loop(Duration::from_secs_f64(
1.0 / TICKS_PER_SECOND as f64,
)))
.insert_resource(DateTime::default())
.add_plugins(MinimalPlugins)
.add_system(tick_system)
.run();
}
fn tick_system(mut state: ResMut<DateTime>) {
// This is an example time system
// TODO: Work out a proper time system for the game
if state.second % TICKS_PER_SECOND == 0 {
state.second = 0;
state.minute += 1;
if state.minute % 60 == 0 {
state.minute = 0;
state.hour += 1;
if state.hour % 24 == 0 {
state.hour = 0;
state.day += 1;
if state.day % 30 == 0 {
state.day = 0;
state.month += 1;
if state.month % 12 == 0 {
state.month = 0;
state.year += 1;
}
}
}
}
}
// }
state.second += 1;
println!("{}", state.format());
}