mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'plugins' into 'master'
Plugins and codebase refactor See merge request veloren/veloren!1625
This commit is contained in:
commit
9f2e01617e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4,4 +4,5 @@
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
assets/world/map/*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
|
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added chat commands for inviting, kicking, leaving, and promoting in groups
|
||||
- Aura system
|
||||
- Campfire resting heal
|
||||
- Initial support for game plugins, both server-side and client-side
|
||||
|
||||
### Changed
|
||||
|
||||
|
571
Cargo.lock
generated
571
Cargo.lock
generated
@ -22,7 +22,7 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
"gimli 0.22.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -172,7 +172,7 @@ checksum = "0609c78bd572f4edc74310dfb63a01f5609d53fa8b4dd7c4d98aef3b3e8d72d1"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -182,9 +182,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a1ae06b5f52588295bfd019b837b6fb1a6914d58ece30b0c43ae439ef08e562"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -290,7 +290,7 @@ source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c
|
||||
dependencies = [
|
||||
"auth-common",
|
||||
"fxhash",
|
||||
"hex",
|
||||
"hex 0.3.2",
|
||||
"rust-argon2",
|
||||
"serde_json",
|
||||
"ureq 1.4.1",
|
||||
@ -373,7 +373,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"peeking_take_while",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
@ -407,6 +407,21 @@ dependencies = [
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake3"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec 0.5.1",
|
||||
"cc",
|
||||
"cfg-if 0.1.10",
|
||||
"constant_time_eq",
|
||||
"crypto-mac",
|
||||
"digest 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block"
|
||||
version = "0.1.6"
|
||||
@ -785,9 +800,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d709e38f0f6100c0c8c0b3aefb0aa1f83af865d7b6b267e8402820513a0c0d8"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -977,6 +992,66 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45a9c21f8042b9857bda93f6c1910b9f9f24100187a3d3d52f214a34e3dc5818"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7853f77a6e4a33c67a69c40f5e1bb982bd2dc5c4a22e17e67b65bbccf9b33b2e"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"cranelift-bforest",
|
||||
"cranelift-codegen-meta",
|
||||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
"gimli 0.20.0",
|
||||
"log",
|
||||
"smallvec 1.4.2",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "084cd6d5fb0d1da28acd72c199471bfb09acc703ec8f3bf07b1699584272a3b9"
|
||||
dependencies = [
|
||||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "701b599783305a58c25027a4d73f2d6b599b2d8ef3f26677275f480b4d51e05d"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b88e792b28e1ebbc0187b72ba5ba880dad083abe9231a99d19604d10c9e73f38"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-native"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32daf082da21c0c05d93394ff4842c2ab7c4991b1f3186a1d952f8ac660edd0b"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"raw-cpuid",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.2.0"
|
||||
@ -1208,6 +1283,16 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-mac"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.1.3"
|
||||
@ -1237,7 +1322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
|
||||
dependencies = [
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1267,10 +1352,10 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"strsim 0.9.3",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1281,7 +1366,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1317,9 +1402,9 @@ version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1345,9 +1430,9 @@ version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1360,6 +1445,24 @@ dependencies = [
|
||||
"migrations_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
|
||||
dependencies = [
|
||||
"generic-array 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "directories-next"
|
||||
version = "2.0.0"
|
||||
@ -1483,9 +1586,30 @@ version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e94aa31f7c0dc764f57896dc615ddd76fc13b0d5dca7eb6cc5e018a5a09ec06"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
|
||||
dependencies = [
|
||||
"gcc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1540,9 +1664,9 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccb5acb1045ebbfa222e2c50679e392a71dd77030b78fb0189f2d9c5974400f9"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1714,9 +1838,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1777,6 +1901,31 @@ dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check 0.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.15"
|
||||
@ -1864,6 +2013,16 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81dd6190aad0f05ddbbf3245c54ed14ca4aa6dd32f22312b70d8f168c3e3e633"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.22.0"
|
||||
@ -2105,6 +2264,12 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
|
||||
|
||||
[[package]]
|
||||
name = "hibitset"
|
||||
version = "0.6.3"
|
||||
@ -2324,6 +2489,7 @@ checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"hashbrown 0.9.1",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2753,9 +2919,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c"
|
||||
dependencies = [
|
||||
"migrations_internals",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2930,9 +3096,9 @@ checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3106,9 +3272,9 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f09b9841adb6b5e1f89ef7087ea636e0fd94b2851f887c1e3eb5d5f8228fab3"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3200,9 +3366,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3390,6 +3556,16 @@ dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "page_size"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.9.0"
|
||||
@ -3508,9 +3684,9 @@ version = "0.4.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24c6d293bdd3ca5a1697997854c6cf7855e43fb6a0ba1c47af57a5bcafd158ae"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3612,9 +3788,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
"version_check 0.9.2",
|
||||
]
|
||||
|
||||
@ -3624,7 +3800,7 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"version_check 0.9.2",
|
||||
]
|
||||
@ -3652,9 +3828,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.23"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
@ -3697,7 +3873,7 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3876,6 +4052,17 @@ dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-cpuid"
|
||||
version = "7.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.3.3"
|
||||
@ -4210,13 +4397,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.116"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-bench"
|
||||
version = "0.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_bytes"
|
||||
version = "0.11.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_cbor"
|
||||
version = "0.11.1"
|
||||
@ -4229,13 +4435,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.116"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4267,9 +4473,9 @@ version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4333,9 +4539,9 @@ version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1f37080f2751fbf091dbdebaa95bd6cf9dbf74ad1d50396b1908518a1747fdf"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4548,11 +4754,11 @@ version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4562,13 +4768,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
|
||||
dependencies = [
|
||||
"base-x",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4623,11 +4829,17 @@ checksum = "c92e775028122a4b3dd55d58f14fc5120289c69bee99df1d117ae30f84b225c9"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
|
||||
|
||||
[[package]]
|
||||
name = "sum_type"
|
||||
version = "0.2.0"
|
||||
@ -4653,11 +4865,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.42"
|
||||
version = "1.0.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228"
|
||||
checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
@ -4680,6 +4892,12 @@ dependencies = [
|
||||
"xattr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
@ -4713,9 +4931,9 @@ version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4922,9 +5140,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
|
||||
checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -4958,9 +5176,9 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5104,6 +5322,12 @@ dependencies = [
|
||||
"nom 5.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.4"
|
||||
@ -5307,7 +5531,8 @@ dependencies = [
|
||||
"uvth 3.1.1",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
"veloren_common_sys",
|
||||
"veloren-common-net",
|
||||
"veloren-common-sys",
|
||||
"veloren_network",
|
||||
]
|
||||
|
||||
@ -5316,7 +5541,6 @@ name = "veloren-common"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"arraygen",
|
||||
"authc",
|
||||
"criterion",
|
||||
"crossbeam",
|
||||
"csv",
|
||||
@ -5331,7 +5555,6 @@ dependencies = [
|
||||
"num-derive",
|
||||
"num-traits 0.2.12",
|
||||
"ordered-float 2.0.0",
|
||||
"parking_lot 0.11.0",
|
||||
"rand 0.7.3",
|
||||
"rayon",
|
||||
"ron",
|
||||
@ -5345,10 +5568,75 @@ dependencies = [
|
||||
"specs-idvs",
|
||||
"spin_sleep",
|
||||
"structopt",
|
||||
"tracing",
|
||||
"tracy-client",
|
||||
"uuid",
|
||||
"vek 0.12.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-common-net"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"authc",
|
||||
"hashbrown 0.7.2",
|
||||
"serde",
|
||||
"specs",
|
||||
"sum_type",
|
||||
"tracing",
|
||||
"tracy-client",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-common-sys"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hashbrown 0.7.2",
|
||||
"indexmap",
|
||||
"rand 0.7.3",
|
||||
"rayon",
|
||||
"serde",
|
||||
"slab",
|
||||
"specs",
|
||||
"tar",
|
||||
"toml",
|
||||
"tracing",
|
||||
"tracy-client",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
"veloren-common-net",
|
||||
"veloren-plugin-api",
|
||||
"wasmer-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-plugin-api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"veloren-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-plugin-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.54",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-plugin-rt"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"serde",
|
||||
"veloren-plugin-api",
|
||||
"veloren-plugin-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5384,8 +5672,10 @@ dependencies = [
|
||||
"uvth 3.1.1",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
"veloren-common-net",
|
||||
"veloren-common-sys",
|
||||
"veloren-plugin-api",
|
||||
"veloren-world",
|
||||
"veloren_common_sys",
|
||||
"veloren_network",
|
||||
]
|
||||
|
||||
@ -5406,6 +5696,7 @@ dependencies = [
|
||||
"tracing-tracy",
|
||||
"tui",
|
||||
"veloren-common",
|
||||
"veloren-common-net",
|
||||
"veloren-server",
|
||||
]
|
||||
|
||||
@ -5465,10 +5756,11 @@ dependencies = [
|
||||
"vek 0.12.0",
|
||||
"veloren-client",
|
||||
"veloren-common",
|
||||
"veloren-common-net",
|
||||
"veloren-common-sys",
|
||||
"veloren-server",
|
||||
"veloren-voxygen-anim",
|
||||
"veloren-world",
|
||||
"veloren_common_sys",
|
||||
"window_clipboard",
|
||||
"winit",
|
||||
"winres",
|
||||
@ -5515,23 +5807,7 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren_common_sys"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"hashbrown 0.7.2",
|
||||
"indexmap",
|
||||
"rand 0.7.3",
|
||||
"rayon",
|
||||
"serde",
|
||||
"slab",
|
||||
"specs",
|
||||
"tracing",
|
||||
"tracy-client",
|
||||
"vek 0.12.0",
|
||||
"veloren-common",
|
||||
"veloren-common-net",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5638,9 +5914,9 @@ dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -5672,9 +5948,9 @@ version = "0.2.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.42",
|
||||
"syn 1.0.54",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@ -5685,6 +5961,119 @@ version = "0.2.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-clif-backend"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a2fae69b1c7429316cad6743f3d2ca83cf8957924c477c5a4eff036ec0097a9"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"cranelift-codegen",
|
||||
"cranelift-entity",
|
||||
"cranelift-native",
|
||||
"libc",
|
||||
"nix 0.15.0",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde-bench",
|
||||
"serde_bytes",
|
||||
"serde_derive",
|
||||
"target-lexicon",
|
||||
"wasmer-clif-fork-frontend",
|
||||
"wasmer-clif-fork-wasm",
|
||||
"wasmer-runtime-core",
|
||||
"wasmer-win-exception-handler",
|
||||
"wasmparser",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-clif-fork-frontend"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c23f2824f354a00a77e4b040eef6e1d4c595a8a3e9013bad65199cc8dade9a5a"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
"smallvec 1.4.2",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-clif-fork-wasm"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a35e21d3aebc51cc6ebc0e830cf8458a9891c3482fb3c65ad18d408102929ae5"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-entity",
|
||||
"log",
|
||||
"thiserror",
|
||||
"wasmer-clif-fork-frontend",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-runtime"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c92a9ae96b193c35c47fc829265198322cf980edc353a9de32bc87a1545d44f3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memmap",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"wasmer-clif-backend",
|
||||
"wasmer-runtime-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-runtime-core"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "740161245998752cf1a567e860fd6355df0336fedca6be1940ec7aaa59643220"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"blake3",
|
||||
"cc",
|
||||
"digest 0.8.1",
|
||||
"errno",
|
||||
"hex 0.4.2",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"nix 0.15.0",
|
||||
"page_size",
|
||||
"parking_lot 0.10.2",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"serde-bench",
|
||||
"serde_bytes",
|
||||
"serde_derive",
|
||||
"smallvec 1.4.2",
|
||||
"target-lexicon",
|
||||
"wasmparser",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-win-exception-handler"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd39f3b2bd7964b28ea6f944a7eaa445cfbc91c4f2695d188103f2689bb37d9"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"wasmer-runtime-core",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.51.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.27.0"
|
||||
@ -5803,7 +6192,7 @@ version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "030f56009d932bd9400bb472764fea8109be1b0fc482d9cd75496c943ac30328"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"xml-rs",
|
||||
]
|
||||
@ -5814,7 +6203,7 @@ version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cc091af4b05a435312f7cefe3a26824d2017966a58362ca913f72c3d68e5e2"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.23",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.7",
|
||||
"xml-rs",
|
||||
]
|
||||
|
@ -3,8 +3,12 @@ cargo-features = ["named-profiles","profile-overrides"]
|
||||
[workspace]
|
||||
members = [
|
||||
"common",
|
||||
"common/net",
|
||||
"common/sys",
|
||||
"client",
|
||||
"plugin/api",
|
||||
"plugin/derive",
|
||||
"plugin/rt",
|
||||
"server",
|
||||
"server-cli",
|
||||
"voxygen",
|
||||
@ -75,6 +79,6 @@ inherits = 'release'
|
||||
debug = 1
|
||||
|
||||
[patch.crates-io]
|
||||
# macos CI fix isn't merged yet
|
||||
# macos CI fix isn't merged yet
|
||||
winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" }
|
||||
vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics" }
|
||||
|
@ -11,7 +11,8 @@ default = ["simd"]
|
||||
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
||||
common_sys = { package = "veloren_common_sys", path = "../common/sys", default-features = false }
|
||||
common-sys = { package = "veloren-common-sys", path = "../common/sys", default-features = false }
|
||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
network = { package = "veloren_network", path = "../network", features = ["compression"], default-features = false }
|
||||
|
||||
byteorder = "1.3.2"
|
||||
|
@ -25,19 +25,22 @@ use common::{
|
||||
},
|
||||
event::{EventBus, LocalEvent},
|
||||
grid::Grid,
|
||||
msg::{
|
||||
validate_chat_msg, world_msg::SiteInfo, ChatMsgValidationError, ClientGeneral, ClientMsg,
|
||||
ClientRegister, ClientType, DisconnectReason, InviteAnswer, Notification, PingMsg,
|
||||
PlayerInfo, PlayerListUpdate, PresenceKind, RegisterError, ServerGeneral, ServerInfo,
|
||||
ServerInit, ServerRegisterAnswer, MAX_BYTES_CHAT_MSG,
|
||||
},
|
||||
outcome::Outcome,
|
||||
recipe::RecipeBook,
|
||||
span,
|
||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
||||
terrain::{block::Block, neighbors, BiomeKind, SitesKind, TerrainChunk, TerrainChunkSize},
|
||||
uid::{Uid, UidAllocator},
|
||||
vol::RectVolSize,
|
||||
};
|
||||
use common_net::{
|
||||
msg::{
|
||||
self, validate_chat_msg, world_msg::SiteInfo, ChatMsgValidationError, ClientGeneral,
|
||||
ClientMsg, ClientRegister, ClientType, DisconnectReason, InviteAnswer, Notification,
|
||||
PingMsg, PlayerInfo, PlayerListUpdate, PresenceKind, RegisterError, ServerGeneral,
|
||||
ServerInfo, ServerInit, ServerRegisterAnswer, MAX_BYTES_CHAT_MSG,
|
||||
},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use comp::BuffKind;
|
||||
use futures_executor::block_on;
|
||||
@ -222,7 +225,7 @@ impl Client {
|
||||
ability_map,
|
||||
} => {
|
||||
// Initialize `State`
|
||||
let mut state = State::default();
|
||||
let mut state = State::client();
|
||||
// Client-only components
|
||||
state
|
||||
.ecs_mut()
|
||||
@ -1247,7 +1250,7 @@ impl Client {
|
||||
ServerGeneral::PlayerListUpdate(PlayerListUpdate::LevelChange(uid, next_level)) => {
|
||||
if let Some(player_info) = self.player_list.get_mut(&uid) {
|
||||
player_info.character = match &player_info.character {
|
||||
Some(character) => Some(common::msg::CharacterInfo {
|
||||
Some(character) => Some(msg::CharacterInfo {
|
||||
name: character.name.to_string(),
|
||||
level: next_level,
|
||||
}),
|
||||
|
@ -20,14 +20,13 @@ lazy_static = "1.4.0"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
ordered-float = { version = "2.0.0", default-features = false }
|
||||
parking_lot = "0.11.0"
|
||||
rand = "0.7"
|
||||
rayon = "1.3.0"
|
||||
roots = "0.0.6"
|
||||
spin_sleep = "1.0"
|
||||
sum_type = "0.2.0"
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
vek = { version = "0.12.0", features = ["serde"] }
|
||||
uuid = { version = "0.8.1", default-features = false, features = ["serde", "v4"] }
|
||||
|
||||
# Assets
|
||||
directories-next = "2.0"
|
||||
@ -35,9 +34,6 @@ dot_vox = "4.0"
|
||||
image = { version = "0.23.8", default-features = false, features = ["png"] }
|
||||
notify = "5.0.0-pre.3"
|
||||
|
||||
# Auth
|
||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" }
|
||||
|
||||
# Data structures
|
||||
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
|
||||
slotmap = { version = "0.4.0", features = ["serde", "unstable"] }
|
||||
|
33
common/net/Cargo.toml
Normal file
33
common/net/Cargo.toml
Normal file
@ -0,0 +1,33 @@
|
||||
[package]
|
||||
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
||||
edition = "2018"
|
||||
name = "veloren-common-net"
|
||||
version = "0.8.0"
|
||||
|
||||
[features]
|
||||
tracy = ["tracy-client"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
|
||||
default = ["simd"]
|
||||
|
||||
[dependencies]
|
||||
common = {package = "veloren-common", path = "../../common"}
|
||||
|
||||
sum_type = "0.2.0"
|
||||
vek = { version = "0.12.0", features = ["serde"] }
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
|
||||
# Data structures
|
||||
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
|
||||
|
||||
# Auth
|
||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" }
|
||||
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "7a2e348ab2223818bad487695c66c43db88050a5" }
|
||||
|
||||
# Serde
|
||||
serde = { version = "1.0.110", features = ["derive"] }
|
||||
|
||||
# Tracy
|
||||
tracy-client = { version = "0.9.0", optional = true }
|
2
common/net/src/lib.rs
Normal file
2
common/net/src/lib.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod msg;
|
||||
pub mod sync;
|
@ -1,5 +1,5 @@
|
||||
use super::PingMsg;
|
||||
use crate::{
|
||||
use common::{
|
||||
character::CharacterId,
|
||||
comp,
|
||||
comp::{Skill, SkillGroupType},
|
@ -1,4 +1,5 @@
|
||||
use crate::{comp, sync};
|
||||
use crate::sync;
|
||||
use common::comp;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::marker::PhantomData;
|
||||
use sum_type::sum_type;
|
@ -13,7 +13,7 @@ pub use self::{
|
||||
},
|
||||
world_msg::WorldMapMsg,
|
||||
};
|
||||
use crate::character::CharacterId;
|
||||
use common::character::CharacterId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
@ -1,15 +1,15 @@
|
||||
use super::{ClientType, EcsCompPacket, PingMsg};
|
||||
use crate::{
|
||||
character::CharacterItem,
|
||||
use crate::sync;
|
||||
use authc::AuthClientError;
|
||||
use common::{
|
||||
character::{self, CharacterItem},
|
||||
comp,
|
||||
outcome::Outcome,
|
||||
recipe::RecipeBook,
|
||||
resources::TimeOfDay,
|
||||
sync,
|
||||
sync::Uid,
|
||||
terrain::{Block, TerrainChunk},
|
||||
uid::Uid,
|
||||
};
|
||||
use authc::AuthClientError;
|
||||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
@ -55,7 +55,7 @@ pub enum ServerInit {
|
||||
client_timeout: Duration,
|
||||
world_map: crate::msg::world_msg::WorldMapMsg,
|
||||
recipe_book: RecipeBook,
|
||||
ability_map: crate::comp::item::tool::AbilityMap,
|
||||
ability_map: comp::item::tool::AbilityMap,
|
||||
},
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ pub enum ServerGeneral {
|
||||
/// An error occurred while creating or deleting a character
|
||||
CharacterActionError(String),
|
||||
/// A new character was created
|
||||
CharacterCreated(crate::character::CharacterId),
|
||||
CharacterCreated(character::CharacterId),
|
||||
CharacterSuccess,
|
||||
//Ingame related
|
||||
GroupUpdate(comp::group::ChangeNotification<sync::Uid>),
|
||||
@ -121,6 +121,15 @@ pub enum ServerGeneral {
|
||||
Notification(Notification),
|
||||
}
|
||||
|
||||
impl ServerGeneral {
|
||||
pub fn server_msg<S>(chat_type: comp::ChatType<String>, msg: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
ServerGeneral::ChatMsg(chat_type.chat_msg(msg))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
end of 2nd level Enums
|
||||
*/
|
@ -1,4 +1,4 @@
|
||||
use crate::grid::Grid;
|
||||
use common::grid::Grid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use vek::*;
|
||||
|
@ -3,13 +3,12 @@
|
||||
mod packet;
|
||||
mod sync_ext;
|
||||
mod track;
|
||||
mod uid;
|
||||
|
||||
// Reexports
|
||||
pub use common::uid::{Uid, UidAllocator};
|
||||
pub use packet::{
|
||||
handle_insert, handle_modify, handle_remove, CompPacket, CompSyncPackage, EntityPackage,
|
||||
EntitySyncPackage, StatePackage,
|
||||
};
|
||||
pub use sync_ext::WorldSyncExt;
|
||||
pub use track::UpdateTracker;
|
||||
pub use uid::{Uid, UidAllocator};
|
@ -1,4 +1,5 @@
|
||||
use super::{track::UpdateTracker, uid::Uid};
|
||||
use super::track::UpdateTracker;
|
||||
use common::uid::Uid;
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use specs::{Component, Entity, Join, ReadStorage, World, WorldExt};
|
||||
use std::{
|
@ -3,8 +3,8 @@ use super::{
|
||||
CompPacket, CompSyncPackage, CompUpdateKind, EntityPackage, EntitySyncPackage, StatePackage,
|
||||
},
|
||||
track::UpdateTracker,
|
||||
uid::{Uid, UidAllocator},
|
||||
};
|
||||
use common::uid::{Uid, UidAllocator};
|
||||
use specs::{
|
||||
saveload::{MarkedBuilder, MarkerAllocator},
|
||||
world::Builder,
|
@ -1,7 +1,5 @@
|
||||
use super::{
|
||||
packet::{CompPacket, CompUpdateKind},
|
||||
uid::Uid,
|
||||
};
|
||||
use super::packet::{CompPacket, CompUpdateKind};
|
||||
use common::uid::Uid;
|
||||
use specs::{BitSet, Component, Entity, Join, ReadStorage, World, WorldExt};
|
||||
use std::{
|
||||
convert::{TryFrom, TryInto},
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{HealthChange, HealthSource, Loadout},
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
util::Dir,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
comp::{humanoid, quadruped_low, quadruped_medium, quadruped_small, Body},
|
||||
path::Chaser,
|
||||
rtsim::RtSimController,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use specs::{Component, Entity as EcsEntity};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{sync::Uid, Damage, GroupTarget};
|
||||
use crate::{uid::Uid, Damage, GroupTarget};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::sync::Uid;
|
||||
use crate::uid::Uid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{comp::group::Group, msg::ServerGeneral, sync::Uid};
|
||||
use crate::{comp::group::Group, uid::Uid};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
@ -118,14 +118,7 @@ impl<G> ChatType<G> {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ChatType<String> {
|
||||
pub fn server_msg<S>(self, msg: S) -> ServerGeneral
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
ServerGeneral::ChatMsg(self.chat_msg(msg))
|
||||
}
|
||||
}
|
||||
|
||||
// Stores chat text, type
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct GenericChatMsg<G> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{inventory::slot::Slot, BuffKind},
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
util::Dir,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{comp::Alignment, sync::Uid};
|
||||
use crate::{comp::Alignment, uid::Uid};
|
||||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slab::Slab;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{comp::Body, sync::Uid, DamageSource};
|
||||
use crate::{comp::Body, uid::Uid, DamageSource};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::item::Reagent;
|
||||
use crate::sync::Uid;
|
||||
use crate::uid::Uid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{sync::Uid, util::Dir};
|
||||
use crate::{uid::Uid, util::Dir};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage, NullStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use authc::Uuid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage, NullStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use uuid::Uuid;
|
||||
|
||||
const MAX_ALIAS_LEN: usize = 32;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
comp::buff::{BuffCategory, BuffData, BuffKind},
|
||||
effect::{self, BuffEffect},
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
Damage, DamageSource, Explosion, GroupTarget, Knockback, RadiusEffect,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{sync::Uid, Damage, GroupTarget, Knockback};
|
||||
use crate::{uid::Uid, Damage, GroupTarget, Knockback};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
|
@ -1,11 +1,10 @@
|
||||
use crate::{character::CharacterId, comp, rtsim::RtSimEntity, sync::Uid, util::Dir, Explosion};
|
||||
use crate::{character::CharacterId, comp, rtsim::RtSimEntity, uid::Uid, util::Dir, Explosion};
|
||||
use comp::{
|
||||
item::{Item, Reagent},
|
||||
Ori, Pos,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use specs::Entity as EcsEntity;
|
||||
use std::{collections::VecDeque, ops::DerefMut};
|
||||
use std::{collections::VecDeque, ops::DerefMut, sync::Mutex};
|
||||
use vek::*;
|
||||
|
||||
pub enum LocalEvent {
|
||||
@ -150,10 +149,10 @@ impl<E> EventBus<E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn emit_now(&self, event: E) { self.queue.lock().push_back(event); }
|
||||
pub fn emit_now(&self, event: E) { self.queue.lock().unwrap().push_back(event); }
|
||||
|
||||
pub fn recv_all(&self) -> impl ExactSizeIterator<Item = E> {
|
||||
std::mem::replace(self.queue.lock().deref_mut(), VecDeque::new()).into_iter()
|
||||
std::mem::replace(self.queue.lock().unwrap().deref_mut(), VecDeque::new()).into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,5 +168,5 @@ impl<'a, E> Emitter<'a, E> {
|
||||
}
|
||||
|
||||
impl<'a, E> Drop for Emitter<'a, E> {
|
||||
fn drop(&mut self) { self.bus.queue.lock().append(&mut self.events); }
|
||||
fn drop(&mut self) { self.bus.queue.lock().unwrap().append(&mut self.events); }
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ pub mod grid;
|
||||
pub mod loadout_builder;
|
||||
pub mod lottery;
|
||||
pub mod metrics;
|
||||
pub mod msg;
|
||||
pub mod npc;
|
||||
pub mod outcome;
|
||||
pub mod path;
|
||||
@ -46,10 +45,10 @@ pub mod rtsim;
|
||||
pub mod spiral;
|
||||
pub mod states;
|
||||
pub mod store;
|
||||
pub mod sync;
|
||||
pub mod terrain;
|
||||
pub mod time;
|
||||
pub mod typed;
|
||||
pub mod uid;
|
||||
pub mod util;
|
||||
pub mod vol;
|
||||
pub mod volumes;
|
||||
|
@ -11,3 +11,18 @@ pub struct Time(pub f64);
|
||||
/// A resource that stores the time since the previous tick.
|
||||
#[derive(Default)]
|
||||
pub struct DeltaTime(pub f32);
|
||||
|
||||
/// A resource that indicates what mode the local game is being played in.
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum GameMode {
|
||||
/// The game is being played in server mode (i.e: the code is running
|
||||
/// server-side)
|
||||
Server,
|
||||
/// The game is being played in client mode (i.e: the code is running
|
||||
/// client-side)
|
||||
Client,
|
||||
/// The game is being played in singleplayer mode (i.e: both client and
|
||||
/// server at once)
|
||||
// To be used later when we no longer start up an entirely new server for singleplayer
|
||||
Singleplayer,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::*,
|
||||
},
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
Damage, DamageSource, GroupTarget,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
Health, Loadout, Ori, PhysicsState, Pos, StateUpdate, Vel,
|
||||
},
|
||||
resources::DeltaTime,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use specs::{
|
||||
hibitset,
|
||||
|
@ -147,7 +147,7 @@ impl MapSizeLg {
|
||||
// not technically been stabilized yet, Clippy probably doesn't check for this
|
||||
// case yet. When it can, or when is_some() is stabilized as a `const fn`,
|
||||
// we should deal with this.
|
||||
#[allow(clippy::redundant_pattern_matching)]
|
||||
#[allow(clippy::redundant_pattern_matching, clippy::result_unit_err)]
|
||||
/// Construct a new `MapSizeLg`, returning an error if the needed invariants
|
||||
/// do not hold and the vector otherwise.
|
||||
///
|
||||
|
@ -1,12 +1,9 @@
|
||||
[package]
|
||||
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
||||
edition = "2018"
|
||||
name = "veloren_common_sys"
|
||||
name = "veloren-common-sys"
|
||||
version = "0.8.0"
|
||||
|
||||
[lib]
|
||||
name = "common_sys"
|
||||
|
||||
[features]
|
||||
tracy = ["tracy-client"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
@ -14,7 +11,8 @@ simd = ["vek/platform_intrinsics"]
|
||||
default = ["simd"]
|
||||
|
||||
[dependencies]
|
||||
common = {package = "veloren-common", path = "../../common"}
|
||||
common = { package = "veloren-common", path = ".." }
|
||||
common-net = { package = "veloren-common-net", path = "../net" }
|
||||
|
||||
rand = "0.7"
|
||||
rayon = "1.3.0"
|
||||
@ -34,3 +32,10 @@ serde = { version = "1.0.110", features = ["derive"] }
|
||||
|
||||
# Tracy
|
||||
tracy-client = { version = "0.9.0", optional = true }
|
||||
|
||||
# Plugins
|
||||
toml = "0.5.7"
|
||||
tar = "0.4.30"
|
||||
wasmer-runtime = "0.17.1"
|
||||
bincode = "1.3.1"
|
||||
plugin-api = { package = "veloren-plugin-api", path = "../../plugin/api"}
|
||||
|
@ -17,9 +17,9 @@ use common::{
|
||||
path::{Chaser, TraversalConfig},
|
||||
resources::{DeltaTime, Time, TimeOfDay},
|
||||
span,
|
||||
sync::{Uid, UidAllocator},
|
||||
terrain::{Block, TerrainGrid},
|
||||
time::DayPeriod,
|
||||
uid::{Uid, UidAllocator},
|
||||
util::Dir,
|
||||
vol::ReadVol,
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ use common::{
|
||||
},
|
||||
event::{EventBus, ServerEvent},
|
||||
resources::{DeltaTime, Time},
|
||||
sync::{Uid, UidAllocator},
|
||||
uid::{Uid, UidAllocator},
|
||||
GroupTarget,
|
||||
};
|
||||
use specs::{saveload::MarkerAllocator, Entities, Join, Read, ReadStorage, System, WriteStorage};
|
||||
|
@ -11,7 +11,7 @@ use common::{
|
||||
self,
|
||||
behavior::{CharacterBehavior, JoinData, JoinTuple},
|
||||
},
|
||||
sync::{Uid, UidAllocator},
|
||||
uid::{Uid, UidAllocator},
|
||||
};
|
||||
|
||||
use specs::{Entities, Join, LazyUpdate, Read, ReadExpect, ReadStorage, System, WriteStorage};
|
||||
|
@ -7,7 +7,7 @@ use common::{
|
||||
metrics::SysMetrics,
|
||||
resources::DeltaTime,
|
||||
span,
|
||||
sync::{Uid, UidAllocator},
|
||||
uid::{Uid, UidAllocator},
|
||||
};
|
||||
use specs::{
|
||||
saveload::{Marker, MarkerAllocator},
|
||||
|
@ -9,6 +9,7 @@ pub mod controller;
|
||||
pub mod melee;
|
||||
mod mount;
|
||||
pub mod phys;
|
||||
pub mod plugin;
|
||||
mod projectile;
|
||||
mod shockwave;
|
||||
pub mod state;
|
||||
|
@ -3,7 +3,7 @@ use common::{
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
metrics::SysMetrics,
|
||||
span,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
util::Dir,
|
||||
GroupTarget,
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ use common::{
|
||||
comp::{Controller, MountState, Mounting, Ori, Pos, Vel},
|
||||
metrics::SysMetrics,
|
||||
span,
|
||||
sync::UidAllocator,
|
||||
uid::UidAllocator,
|
||||
};
|
||||
use specs::{
|
||||
saveload::{Marker, MarkerAllocator},
|
||||
|
@ -8,8 +8,8 @@ use common::{
|
||||
metrics::{PhysicsMetrics, SysMetrics},
|
||||
resources::DeltaTime,
|
||||
span,
|
||||
sync::Uid,
|
||||
terrain::{Block, TerrainGrid},
|
||||
uid::Uid,
|
||||
vol::ReadVol,
|
||||
};
|
||||
use rayon::iter::ParallelIterator;
|
||||
|
21
common/sys/src/plugin/errors.rs
Normal file
21
common/sys/src/plugin/errors.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use bincode::ErrorKind;
|
||||
use wasmer_runtime::error::{ResolveError, RuntimeError};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum PluginError {
|
||||
Io(std::io::Error),
|
||||
Toml(toml::de::Error),
|
||||
NoConfig,
|
||||
NoSuchModule,
|
||||
PluginModuleError(PluginModuleError),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum PluginModuleError {
|
||||
FindFunction(String),
|
||||
FunctionGet(ResolveError),
|
||||
Compile(wasmer_runtime::error::CompileError),
|
||||
Instantiate(wasmer_runtime::error::Error),
|
||||
RunFunction(RuntimeError),
|
||||
Encoding(Box<ErrorKind>),
|
||||
}
|
176
common/sys/src/plugin/mod.rs
Normal file
176
common/sys/src/plugin/mod.rs
Normal file
@ -0,0 +1,176 @@
|
||||
pub mod errors;
|
||||
pub mod module;
|
||||
|
||||
use common::assets::ASSETS_PATH;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
fs,
|
||||
io::Read,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use tracing::{error, info};
|
||||
|
||||
use plugin_api::Event;
|
||||
|
||||
use self::{
|
||||
errors::PluginError,
|
||||
module::{PluginModule, PreparedEventQuery},
|
||||
};
|
||||
|
||||
use rayon::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct PluginData {
|
||||
name: String,
|
||||
modules: HashSet<PathBuf>,
|
||||
dependencies: HashSet<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Plugin {
|
||||
data: PluginData,
|
||||
modules: Vec<PluginModule>,
|
||||
files: HashMap<PathBuf, Vec<u8>>,
|
||||
}
|
||||
|
||||
impl Plugin {
|
||||
pub fn from_reader<R: Read>(mut reader: R) -> Result<Self, PluginError> {
|
||||
let mut buf = Vec::new();
|
||||
reader.read_to_end(&mut buf).map_err(PluginError::Io)?;
|
||||
|
||||
let mut files = tar::Archive::new(&*buf)
|
||||
.entries()
|
||||
.map_err(PluginError::Io)?
|
||||
.map(|e| {
|
||||
e.and_then(|e| {
|
||||
Ok((e.path()?.into_owned(), {
|
||||
let offset = e.raw_file_position() as usize;
|
||||
buf[offset..offset + e.size() as usize].to_vec()
|
||||
}))
|
||||
})
|
||||
})
|
||||
.collect::<Result<HashMap<_, _>, _>>()
|
||||
.map_err(PluginError::Io)?;
|
||||
|
||||
let data = toml::de::from_slice::<PluginData>(
|
||||
&files
|
||||
.get(Path::new("plugin.toml"))
|
||||
.ok_or(PluginError::NoConfig)?,
|
||||
)
|
||||
.map_err(PluginError::Toml)?;
|
||||
|
||||
let modules = data
|
||||
.modules
|
||||
.iter()
|
||||
.map(|path| {
|
||||
let wasm_data = files.remove(path).ok_or(PluginError::NoSuchModule)?;
|
||||
PluginModule::new(&wasm_data).map_err(PluginError::PluginModuleError)
|
||||
})
|
||||
.collect::<Result<_, _>>()?;
|
||||
|
||||
Ok(Plugin {
|
||||
data,
|
||||
modules,
|
||||
files,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn execute_prepared<T>(
|
||||
&self,
|
||||
event_name: &str,
|
||||
event: &PreparedEventQuery<T>,
|
||||
) -> Result<Vec<T::Response>, PluginError>
|
||||
where
|
||||
T: Event,
|
||||
{
|
||||
self.modules
|
||||
.iter()
|
||||
.flat_map(|module| {
|
||||
module
|
||||
.try_execute(event_name, event)
|
||||
.map(|x| x.map_err(PluginError::PluginModuleError))
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct PluginMgr {
|
||||
plugins: Vec<Plugin>,
|
||||
}
|
||||
|
||||
impl PluginMgr {
|
||||
pub fn from_assets() -> Result<Self, PluginError> {
|
||||
let mut assets_path = (&*ASSETS_PATH).clone();
|
||||
assets_path.push("plugins");
|
||||
info!("Searching {:?} for assets...", assets_path);
|
||||
Self::from_dir(assets_path)
|
||||
}
|
||||
|
||||
pub fn execute_prepared<T>(
|
||||
&self,
|
||||
event_name: &str,
|
||||
event: &PreparedEventQuery<T>,
|
||||
) -> Result<Vec<T::Response>, PluginError>
|
||||
where
|
||||
T: Event,
|
||||
{
|
||||
Ok(self
|
||||
.plugins
|
||||
.par_iter()
|
||||
.map(|plugin| plugin.execute_prepared(event_name, event))
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn execute_event<T>(
|
||||
&self,
|
||||
event_name: &str,
|
||||
event: &T,
|
||||
) -> Result<Vec<T::Response>, PluginError>
|
||||
where
|
||||
T: Event,
|
||||
{
|
||||
self.execute_prepared(event_name, &PreparedEventQuery::new(event)?)
|
||||
}
|
||||
|
||||
pub fn from_dir<P: AsRef<Path>>(path: P) -> Result<Self, PluginError> {
|
||||
let plugins = fs::read_dir(path)
|
||||
.map_err(PluginError::Io)?
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|entry| {
|
||||
if entry.file_type().map(|ft| ft.is_file()).unwrap_or(false)
|
||||
&& entry
|
||||
.path()
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.map(|s| s.ends_with(".plugin.tar"))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
info!("Loading plugin at {:?}", entry.path());
|
||||
Plugin::from_reader(fs::File::open(entry.path()).map_err(PluginError::Io)?)
|
||||
.map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
})
|
||||
.filter_map(Result::transpose)
|
||||
.inspect(|p| {
|
||||
let _ = p.as_ref().map_err(|e| error!(?e, "Failed to load plugin"));
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
for plugin in &plugins {
|
||||
info!(
|
||||
"Loaded plugin '{}' with {} module(s)",
|
||||
plugin.data.name,
|
||||
plugin.modules.len()
|
||||
);
|
||||
}
|
||||
|
||||
Ok(Self { plugins })
|
||||
}
|
||||
}
|
158
common/sys/src/plugin/module.rs
Normal file
158
common/sys/src/plugin/module.rs
Normal file
@ -0,0 +1,158 @@
|
||||
use std::{
|
||||
cell::Cell,
|
||||
collections::HashSet,
|
||||
marker::PhantomData,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use error::RuntimeError;
|
||||
use wasmer_runtime::*;
|
||||
|
||||
use super::errors::{PluginError, PluginModuleError};
|
||||
use plugin_api::{Action, Event};
|
||||
|
||||
// This represent a WASM function interface
|
||||
pub type Function<'a> = Func<'a, (i32, u32), i32>;
|
||||
|
||||
#[derive(Clone)]
|
||||
// This structure represent the WASM State of the plugin.
|
||||
pub struct PluginModule {
|
||||
wasm_instance: Arc<Mutex<Instance>>,
|
||||
events: HashSet<String>,
|
||||
}
|
||||
|
||||
impl PluginModule {
|
||||
// This function takes bytes from a WASM File and compile them
|
||||
pub fn new(wasm_data: &[u8]) -> Result<Self, PluginModuleError> {
|
||||
let module = compile(&wasm_data).map_err(PluginModuleError::Compile)?;
|
||||
let instance = module
|
||||
.instantiate(&imports! {"env" => {
|
||||
"raw_emit_actions" => func!(read_action),
|
||||
}})
|
||||
.map_err(PluginModuleError::Instantiate)?;
|
||||
|
||||
Ok(Self {
|
||||
events: instance.exports.into_iter().map(|(name, _)| name).collect(),
|
||||
wasm_instance: Arc::new(Mutex::new(instance)),
|
||||
})
|
||||
}
|
||||
|
||||
// This function tries to execute an event for the current module. Will return
|
||||
// None if the event doesn't exists
|
||||
pub fn try_execute<T>(
|
||||
&self,
|
||||
event_name: &str,
|
||||
request: &PreparedEventQuery<T>,
|
||||
) -> Option<Result<T::Response, PluginModuleError>>
|
||||
where
|
||||
T: Event,
|
||||
{
|
||||
if !self.events.contains(event_name) {
|
||||
return None;
|
||||
}
|
||||
let bytes = {
|
||||
let instance = self.wasm_instance.lock().unwrap();
|
||||
let func = match instance
|
||||
.exports
|
||||
.get(event_name)
|
||||
.map_err(PluginModuleError::FunctionGet)
|
||||
{
|
||||
Ok(e) => e,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
let mem = instance.context().memory(0);
|
||||
match execute_raw(&mem, &func, &request.bytes).map_err(PluginModuleError::RunFunction) {
|
||||
Ok(e) => e,
|
||||
Err(e) => return Some(Err(e)),
|
||||
}
|
||||
};
|
||||
Some(bincode::deserialize(&bytes).map_err(PluginModuleError::Encoding))
|
||||
}
|
||||
}
|
||||
|
||||
// This structure represent a Pre-encoded event object (Useful to avoid
|
||||
// reencoding for each module in every plugin)
|
||||
pub struct PreparedEventQuery<T> {
|
||||
bytes: Vec<u8>,
|
||||
_phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: Event> PreparedEventQuery<T> {
|
||||
// Create a prepared query from an event reference (Encode to bytes the struct)
|
||||
// This Prepared Query is used by the `try_execute` method in `PluginModule`
|
||||
pub fn new(event: &T) -> Result<Self, PluginError>
|
||||
where
|
||||
T: Event,
|
||||
{
|
||||
Ok(Self {
|
||||
bytes: bincode::serialize(&event)
|
||||
.map_err(|e| PluginError::PluginModuleError(PluginModuleError::Encoding(e)))?,
|
||||
_phantom: PhantomData::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const MEMORY_POS: usize = 100000;
|
||||
|
||||
// This function is not public because this function should not be used without
|
||||
// an interface to limit unsafe behaviours
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
fn execute_raw(
|
||||
memory: &Memory,
|
||||
function: &Function,
|
||||
bytes: &[u8],
|
||||
) -> Result<Vec<u8>, RuntimeError> {
|
||||
let view = memory.view::<u8>();
|
||||
let len = bytes.len();
|
||||
for (cell, byte) in view[MEMORY_POS..len + MEMORY_POS].iter().zip(bytes.iter()) {
|
||||
cell.set(*byte)
|
||||
}
|
||||
let start = function.call(MEMORY_POS as i32, len as u32)? as usize;
|
||||
let view = memory.view::<u8>();
|
||||
let mut new_len_bytes = [0u8; 4];
|
||||
// TODO: It is probably better to dirrectly make the new_len_bytes
|
||||
for i in 0..4 {
|
||||
new_len_bytes[i] = view.get(i + 1).map(Cell::get).unwrap_or(0);
|
||||
}
|
||||
let new_len = u32::from_ne_bytes(new_len_bytes) as usize;
|
||||
Ok(view[start..start + new_len]
|
||||
.iter()
|
||||
.map(|c| c.get())
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn read_action(ctx: &mut Ctx, ptr: u32, len: u32) {
|
||||
let memory = ctx.memory(0);
|
||||
|
||||
let memory = memory.view::<u8>();
|
||||
|
||||
let str_slice = &memory[ptr as usize..(ptr + len) as usize];
|
||||
|
||||
let bytes: Vec<u8> = str_slice.iter().map(|x| x.get()).collect();
|
||||
|
||||
let e: Vec<Action> = match bincode::deserialize(&bytes) {
|
||||
Ok(e) => e,
|
||||
Err(e) => {
|
||||
tracing::error!(?e, "Can't decode action");
|
||||
return;
|
||||
},
|
||||
};
|
||||
|
||||
for action in e {
|
||||
match action {
|
||||
Action::ServerClose => {
|
||||
tracing::info!("Server closed by plugin");
|
||||
std::process::exit(-1);
|
||||
},
|
||||
Action::Print(e) => {
|
||||
tracing::info!("{}", e);
|
||||
},
|
||||
Action::PlayerSendMessage(a, b) => {
|
||||
tracing::info!("SendMessage {} -> {}", a, b);
|
||||
},
|
||||
Action::KillEntity(e) => {
|
||||
tracing::info!("Kill Entity {}", e);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ use common::{
|
||||
metrics::SysMetrics,
|
||||
resources::DeltaTime,
|
||||
span,
|
||||
sync::UidAllocator,
|
||||
uid::UidAllocator,
|
||||
GroupTarget,
|
||||
};
|
||||
use rand::{thread_rng, Rng};
|
||||
|
@ -5,7 +5,7 @@ use common::{
|
||||
},
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
resources::{DeltaTime, Time},
|
||||
sync::{Uid, UidAllocator},
|
||||
uid::{Uid, UidAllocator},
|
||||
util::Dir,
|
||||
GroupTarget,
|
||||
};
|
||||
|
@ -1,15 +1,17 @@
|
||||
use crate::plugin::PluginMgr;
|
||||
use common::{
|
||||
comp,
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
metrics::{PhysicsMetrics, SysMetrics},
|
||||
region::RegionMap,
|
||||
resources,
|
||||
resources::{DeltaTime, Time, TimeOfDay},
|
||||
span,
|
||||
sync::WorldSyncExt,
|
||||
terrain::{Block, TerrainChunk, TerrainGrid},
|
||||
time::DayPeriod,
|
||||
vol::{ReadVol, WriteVol},
|
||||
};
|
||||
use common_net::sync::WorldSyncExt;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use rayon::{ThreadPool, ThreadPoolBuilder};
|
||||
use specs::{
|
||||
@ -18,6 +20,7 @@ use specs::{
|
||||
Component, DispatcherBuilder, Entity as EcsEntity, WorldExt,
|
||||
};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use tracing::info;
|
||||
use vek::*;
|
||||
|
||||
/// How much faster should an in-game day be compared to a real day?
|
||||
@ -68,6 +71,13 @@ impl TerrainChanges {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ExecMode {
|
||||
Server,
|
||||
Client,
|
||||
Singleplayer,
|
||||
}
|
||||
|
||||
/// A type used to represent game state stored on both the client and the
|
||||
/// server. This includes things like entity components, terrain data, and
|
||||
/// global states like weather, time of day, etc.
|
||||
@ -77,21 +87,24 @@ pub struct State {
|
||||
thread_pool: Arc<ThreadPool>,
|
||||
}
|
||||
|
||||
impl Default for State {
|
||||
/// Create a new `State`.
|
||||
fn default() -> Self {
|
||||
impl State {
|
||||
/// Create a new `State` in client mode.
|
||||
pub fn client() -> Self { Self::new(resources::GameMode::Client) }
|
||||
|
||||
/// Create a new `State` in server mode.
|
||||
pub fn server() -> Self { Self::new(resources::GameMode::Server) }
|
||||
|
||||
pub fn new(game_mode: resources::GameMode) -> Self {
|
||||
Self {
|
||||
ecs: Self::setup_ecs_world(),
|
||||
ecs: Self::setup_ecs_world(game_mode),
|
||||
thread_pool: Arc::new(ThreadPoolBuilder::new().build().unwrap()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl State {
|
||||
/// Creates ecs world and registers all the common components and resources
|
||||
// TODO: Split up registering into server and client (e.g. move
|
||||
// EventBus<ServerEvent> to the server)
|
||||
fn setup_ecs_world() -> specs::World {
|
||||
fn setup_ecs_world(game_mode: resources::GameMode) -> specs::World {
|
||||
let mut ecs = specs::World::new();
|
||||
// Uids for sync
|
||||
ecs.register_sync_marker();
|
||||
@ -169,6 +182,7 @@ impl State {
|
||||
ecs.insert(BlockChange::default());
|
||||
ecs.insert(TerrainChanges::default());
|
||||
ecs.insert(EventBus::<LocalEvent>::default());
|
||||
ecs.insert(game_mode);
|
||||
// TODO: only register on the server
|
||||
ecs.insert(EventBus::<ServerEvent>::default());
|
||||
ecs.insert(comp::group::GroupManager::default());
|
||||
@ -176,6 +190,27 @@ impl State {
|
||||
ecs.insert(SysMetrics::default());
|
||||
ecs.insert(PhysicsMetrics::default());
|
||||
|
||||
// Load plugins from asset directory
|
||||
ecs.insert(match PluginMgr::from_assets() {
|
||||
Ok(plugin_mgr) => {
|
||||
if let Err(e) = plugin_mgr
|
||||
.execute_event("on_load", &plugin_api::event::PluginLoadEvent { game_mode })
|
||||
{
|
||||
tracing::error!(?e, "Failed to run plugin init");
|
||||
info!("Error occurred when loading plugins. Running without plugins instead.");
|
||||
PluginMgr::default()
|
||||
} else {
|
||||
plugin_mgr
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
info!("Error occurred when loading plugins. Running without plugins instead.");
|
||||
PluginMgr::default()
|
||||
},
|
||||
});
|
||||
|
||||
//manager.execute_event("on_load", &);
|
||||
|
||||
ecs
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ impl RemoteInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_info(&self, id: u32) -> Option<FileInfo> { self.infos.get(&id).map(|fi| fi.clone()) }
|
||||
pub fn get_info(&self, id: u32) -> Option<FileInfo> { self.infos.get(&id).cloned() }
|
||||
|
||||
pub fn insert_infos(&mut self, mut fi: Vec<FileInfo>) {
|
||||
for fi in fi.drain(..) {
|
||||
|
@ -71,7 +71,7 @@ fn file_exists(file: String) -> Result<(), String> {
|
||||
if file.exists() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(format!("File does not exist"))
|
||||
Err("File does not exist".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ async fn client(mut cmd_sender: mpsc::UnboundedSender<LocalCommand>) {
|
||||
// this 100 ms is because i am super lazy, and i want to appear the logs before
|
||||
// the next '==>' appears...
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
println!("");
|
||||
println!();
|
||||
}
|
||||
thread::sleep(Duration::from_millis(30)); // TODO: still needed for correct shutdown
|
||||
}
|
||||
|
@ -58,22 +58,16 @@ impl Server {
|
||||
command_receiver
|
||||
.for_each_concurrent(None, async move |cmd| {
|
||||
match cmd {
|
||||
LocalCommand::Shutdown => {
|
||||
println!("Shutting down service");
|
||||
return;
|
||||
},
|
||||
LocalCommand::Shutdown => println!("Shutting down service"),
|
||||
LocalCommand::Disconnect => {
|
||||
self.remotes.write().await.clear();
|
||||
println!("Disconnecting all connections");
|
||||
return;
|
||||
},
|
||||
LocalCommand::Connect(addr) => {
|
||||
println!("Trying to connect to: {:?}", &addr);
|
||||
match self.network.connect(addr.clone()).await {
|
||||
Ok(p) => self.loop_participant(p).await,
|
||||
Err(e) => {
|
||||
println!("Failed to connect to {:?}, err: {:?}", &addr, e);
|
||||
},
|
||||
Err(e) => println!("Failed to connect to {:?}, err: {:?}", &addr, e),
|
||||
}
|
||||
},
|
||||
LocalCommand::Serve(fileinfo) => {
|
||||
@ -188,7 +182,7 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_fileinfos(infos: &Vec<FileInfo>) {
|
||||
fn print_fileinfos(infos: &[FileInfo]) {
|
||||
let mut i = 0;
|
||||
for info in infos {
|
||||
let bytes = info.size;
|
||||
|
@ -151,7 +151,7 @@ fn client(address: ProtocolAddr) {
|
||||
std::thread::spawn(f);
|
||||
metrics.run("0.0.0.0:59111".parse().unwrap()).unwrap();
|
||||
|
||||
let p1 = block_on(client.connect(address.clone())).unwrap(); //remote representation of p1
|
||||
let p1 = block_on(client.connect(address)).unwrap(); //remote representation of p1
|
||||
let mut s1 = block_on(p1.open(16, Promises::ORDERED | Promises::CONSISTENCY)).unwrap(); //remote representation of s1
|
||||
let mut last = Instant::now();
|
||||
let mut id = 0u64;
|
||||
|
@ -8,7 +8,6 @@ use std::{
|
||||
},
|
||||
thread,
|
||||
};
|
||||
use tiny_http;
|
||||
use tracing::*;
|
||||
|
||||
pub struct SimpleMetrics {
|
||||
@ -68,12 +67,11 @@ impl SimpleMetrics {
|
||||
let response = tiny_http::Response::from_string(
|
||||
String::from_utf8(buffer).expect("Failed to parse bytes as a string."),
|
||||
);
|
||||
match request.respond(response) {
|
||||
Err(e) => error!(
|
||||
if let Err(e) = request.respond(response) {
|
||||
error!(
|
||||
?e,
|
||||
"The metrics HTTP server had encountered and error with answering"
|
||||
),
|
||||
_ => (),
|
||||
)
|
||||
}
|
||||
}
|
||||
debug!("Stopping tiny_http server to serve metrics");
|
||||
|
@ -24,7 +24,7 @@ fn setup() -> Result<SocketAddr, u32> {
|
||||
}
|
||||
let a: SocketAddr = format!("{}:{}", args[1], args[2]).parse().unwrap();
|
||||
println!("You provided address: {}", &a);
|
||||
return Ok(a);
|
||||
Ok(a)
|
||||
}
|
||||
/// This example file is not running veloren-network at all,
|
||||
/// instead it's just trying to create 4 threads and pump as much bytes as
|
||||
|
9
plugin/api/Cargo.toml
Normal file
9
plugin/api/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "veloren-plugin-api"
|
||||
version = "0.1.0"
|
||||
authors = ["ccgauche <gaucheron.laurent@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = "../../common", features = ["no-assets"] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
75
plugin/api/src/lib.rs
Normal file
75
plugin/api/src/lib.rs
Normal file
@ -0,0 +1,75 @@
|
||||
use common::uid::Uid;
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub enum Action {
|
||||
ServerClose,
|
||||
Print(String),
|
||||
PlayerSendMessage(Uid, String),
|
||||
KillEntity(Uid),
|
||||
}
|
||||
|
||||
pub trait Event: Serialize + DeserializeOwned + Send + Sync {
|
||||
type Response: Serialize + DeserializeOwned + Send + Sync;
|
||||
}
|
||||
|
||||
pub use common::resources::GameMode;
|
||||
|
||||
pub mod event {
|
||||
use super::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct ChatCommandEvent {
|
||||
pub command: String,
|
||||
pub command_args: Vec<String>,
|
||||
pub player: Player,
|
||||
}
|
||||
|
||||
impl Event for ChatCommandEvent {
|
||||
type Response = Result<Vec<String>, String>;
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Player {
|
||||
pub id: Uid,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PlayerJoinEvent {
|
||||
pub player_name: String,
|
||||
pub player_id: Uid,
|
||||
}
|
||||
|
||||
impl Event for PlayerJoinEvent {
|
||||
type Response = PlayerJoinResult;
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub enum PlayerJoinResult {
|
||||
CloseConnection,
|
||||
None,
|
||||
}
|
||||
|
||||
impl Default for PlayerJoinResult {
|
||||
fn default() -> Self { Self::None }
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PluginLoadEvent {
|
||||
pub game_mode: GameMode,
|
||||
}
|
||||
|
||||
impl Event for PluginLoadEvent {
|
||||
type Response = ();
|
||||
}
|
||||
|
||||
// #[derive(Serialize, Deserialize, Debug)]
|
||||
// pub struct EmptyResult;
|
||||
|
||||
// impl Default for PlayerJoinResult {
|
||||
// fn default() -> Self {
|
||||
// Self::None
|
||||
// }
|
||||
// }
|
||||
}
|
15
plugin/derive/Cargo.toml
Normal file
15
plugin/derive/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "veloren-plugin-derive"
|
||||
version = "0.1.0"
|
||||
authors = ["ccgauche <gaucheron.laurent@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0.24"
|
||||
syn = { version = "1.0.54", features = ["full","extra-traits"]}
|
||||
quote = "1.0.7"
|
32
plugin/derive/src/lib.rs
Normal file
32
plugin/derive/src/lib.rs
Normal file
@ -0,0 +1,32 @@
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::quote;
|
||||
use syn::{parse_macro_input, ItemFn};
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn event_handler(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let parsed = parse_macro_input!(item as ItemFn);
|
||||
let fn_body = parsed.block; // function body
|
||||
let sig = parsed.sig; // function signature
|
||||
let fn_name = sig.ident; // function name/identifier
|
||||
let fn_args = sig.inputs; // comma separated args
|
||||
let fn_return = sig.output; // comma separated args
|
||||
|
||||
let out: proc_macro2::TokenStream = quote! {
|
||||
#[no_mangle]
|
||||
pub fn #fn_name(intern__ptr: i32, intern__len: u32) -> i32 {
|
||||
let input = ::veloren_plugin_rt::read_input(intern__ptr,intern__len).unwrap();
|
||||
#[inline]
|
||||
fn inner(#fn_args) #fn_return {
|
||||
#fn_body
|
||||
}
|
||||
// Artificially force the event handler to be type-correct
|
||||
fn force_event<E: ::veloren_plugin_rt::api::Event>(event: E, inner: fn(E) -> E::Response) -> E::Response {
|
||||
inner(event)
|
||||
}
|
||||
::veloren_plugin_rt::write_output(&force_event(input, inner))
|
||||
}
|
||||
};
|
||||
out.into()
|
||||
}
|
18
plugin/rt/Cargo.toml
Normal file
18
plugin/rt/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "veloren-plugin-rt"
|
||||
version = "0.1.0"
|
||||
authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
plugin-api = { package = "veloren-plugin-api", path = "../api" }
|
||||
plugin-derive = { package = "veloren-plugin-derive", path = "../derive"}
|
||||
serde = {version = "1.0.118", features = ["derive"]}
|
||||
bincode = "1.3.1"
|
||||
|
||||
[[example]]
|
||||
name = "hello"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dev-dependencies]
|
||||
plugin-derive = { package = "veloren-plugin-derive", path = "../derive"}
|
34
plugin/rt/examples/hello.rs
Normal file
34
plugin/rt/examples/hello.rs
Normal file
@ -0,0 +1,34 @@
|
||||
use veloren_plugin_rt::{
|
||||
api::{event::*, Action, GameMode},
|
||||
*,
|
||||
};
|
||||
|
||||
#[veloren_plugin_rt::event_handler]
|
||||
pub fn on_load(load: PluginLoadEvent) {
|
||||
match load.game_mode {
|
||||
GameMode::Server => emit_action(Action::Print("Hello, server!".to_owned())),
|
||||
GameMode::Client => emit_action(Action::Print("Hello, client!".to_owned())),
|
||||
GameMode::Singleplayer => emit_action(Action::Print("Hello, singleplayer!".to_owned())),
|
||||
}
|
||||
}
|
||||
|
||||
#[event_handler]
|
||||
pub fn on_command_testplugin(command: ChatCommandEvent) -> Result<Vec<String>, String> {
|
||||
Ok(vec![format!(
|
||||
"Player of id {:?} sended command with args {:?}",
|
||||
command.player, command.command_args
|
||||
)])
|
||||
}
|
||||
|
||||
#[event_handler]
|
||||
pub fn on_player_join(input: PlayerJoinEvent) -> PlayerJoinResult {
|
||||
emit_action(Action::PlayerSendMessage(
|
||||
input.player_id,
|
||||
format!("Welcome {} on our server", input.player_name),
|
||||
));
|
||||
if input.player_name == "Cheater123" {
|
||||
PlayerJoinResult::CloseConnection
|
||||
} else {
|
||||
PlayerJoinResult::None
|
||||
}
|
||||
}
|
38
plugin/rt/src/lib.rs
Normal file
38
plugin/rt/src/lib.rs
Normal file
@ -0,0 +1,38 @@
|
||||
#![feature(const_fn)]
|
||||
|
||||
pub extern crate plugin_derive;
|
||||
|
||||
pub use plugin_api as api;
|
||||
pub use plugin_derive::*;
|
||||
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
|
||||
extern "C" {
|
||||
fn raw_emit_actions(ptr: *const u8, len: usize);
|
||||
}
|
||||
|
||||
pub fn emit_action(action: api::Action) { emit_actions(vec![action]) }
|
||||
|
||||
pub fn emit_actions(actions: Vec<api::Action>) {
|
||||
let ret = bincode::serialize(&actions).unwrap();
|
||||
unsafe {
|
||||
raw_emit_actions(ret.as_ptr(), ret.len());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_input<T>(ptr: i32, len: u32) -> Result<T, &'static str>
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
{
|
||||
let slice = unsafe { ::std::slice::from_raw_parts(ptr as _, len as _) };
|
||||
bincode::deserialize(slice).map_err(|_| "Failed to deserialize function input")
|
||||
}
|
||||
|
||||
pub fn write_output(value: impl Serialize) -> i32 {
|
||||
let ret = bincode::serialize(&value).unwrap();
|
||||
let len = ret.len() as u32;
|
||||
unsafe {
|
||||
::std::ptr::write(1 as _, len);
|
||||
}
|
||||
ret.as_ptr() as _
|
||||
}
|
@ -12,6 +12,7 @@ tracy = ["common/tracy", "tracing-tracy"]
|
||||
[dependencies]
|
||||
server = { package = "veloren-server", path = "../server", default-features = false }
|
||||
common = { package = "veloren-common", path = "../common" }
|
||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
|
||||
ansi-parser = "0.6"
|
||||
clap = "2.33"
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::settings::Settings;
|
||||
use common::comp::chat::ChatType;
|
||||
use common_net::msg::ServerGeneral;
|
||||
use server::Server;
|
||||
use std::{
|
||||
ops::Add,
|
||||
@ -155,7 +156,7 @@ impl ShutdownCoordinator {
|
||||
/// Logs and sends a message to all connected clients
|
||||
fn send_msg(server: &mut Server, msg: String) {
|
||||
info!("{}", &msg);
|
||||
server.notify_players(ChatType::CommandError.server_msg(msg));
|
||||
server.notify_players(ServerGeneral::server_msg(ChatType::CommandError, msg));
|
||||
}
|
||||
|
||||
/// Converts a `Duration` into text in the format XsXm for example 1 minute
|
||||
|
@ -12,7 +12,8 @@ default = ["worldgen", "simd"]
|
||||
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = "../common" }
|
||||
common_sys = { package = "veloren_common_sys", path = "../common/sys" }
|
||||
common-sys = { package = "veloren-common-sys", path = "../common/sys" }
|
||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
world = { package = "veloren-world", path = "../world" }
|
||||
network = { package = "veloren_network", path = "../network", features = ["metrics", "compression"], default-features = false }
|
||||
|
||||
@ -45,3 +46,6 @@ diesel = { version = "1.4.3", features = ["sqlite"] }
|
||||
diesel_migrations = "1.4.0"
|
||||
dotenv = "0.15.0"
|
||||
slab = "0.4"
|
||||
|
||||
# Plugins
|
||||
plugin-api = { package = "veloren-plugin-api", path = "../plugin/api"}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use common::msg::{ClientType, ServerGeneral, ServerMsg};
|
||||
use common_net::msg::{ClientType, ServerGeneral, ServerMsg};
|
||||
use network::{Message, Participant, Stream, StreamError};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use specs::Component;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,14 +14,17 @@ use common::{
|
||||
},
|
||||
effect::Effect,
|
||||
lottery::Lottery,
|
||||
msg::{PlayerListUpdate, ServerGeneral},
|
||||
outcome::Outcome,
|
||||
rtsim::RtSimEntity,
|
||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
||||
terrain::{Block, TerrainGrid},
|
||||
uid::{Uid, UidAllocator},
|
||||
vol::ReadVol,
|
||||
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||
};
|
||||
use common_net::{
|
||||
msg::{PlayerListUpdate, ServerGeneral},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::BlockChange;
|
||||
use comp::item::Reagent;
|
||||
use rand::prelude::*;
|
||||
@ -224,8 +227,10 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
| HealthSource::Heal { by: _ }
|
||||
| HealthSource::Unknown => KillSource::Other,
|
||||
};
|
||||
state
|
||||
.notify_players(comp::ChatType::Kill(kill_source, *uid).server_msg("".to_string()));
|
||||
state.notify_players(ServerGeneral::server_msg(
|
||||
comp::ChatType::Kill(kill_source, *uid),
|
||||
"".to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,10 @@ use common::{
|
||||
group::{self, Group, GroupManager, Invite, PendingInvites},
|
||||
ChatType, GroupManip,
|
||||
},
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::{
|
||||
msg::{InviteAnswer, ServerGeneral},
|
||||
sync,
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use specs::world::WorldExt;
|
||||
@ -31,16 +33,16 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
None => {
|
||||
// Inform of failure
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("Invite failed, target does not exist.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Invite failed, target does not exist.",
|
||||
));
|
||||
}
|
||||
return;
|
||||
},
|
||||
};
|
||||
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
|
||||
// Check if entity is trying to invite themselves to a group
|
||||
if uids
|
||||
@ -63,8 +65,9 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
if already_in_same_group {
|
||||
// Inform of failure
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(ChatType::Meta.server_msg(
|
||||
"Invite failed, can't invite someone already in your group".to_owned(),
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Invite failed, can't invite someone already in your group",
|
||||
));
|
||||
}
|
||||
return;
|
||||
@ -93,13 +96,12 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
if group_size_limit_reached {
|
||||
// Inform inviter that they have reached the group size limit
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta.server_msg(
|
||||
"Invite failed, pending invites plus current group size have reached \
|
||||
the group size limit"
|
||||
.to_owned(),
|
||||
),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Invite failed, pending invites plus current group size have reached the \
|
||||
group size limit"
|
||||
.to_owned(),
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -110,10 +112,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
if invites.contains(invitee) {
|
||||
// Inform inviter that there is already an invite
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("This player already has a pending invite.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"This player already has a pending invite.",
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -162,9 +164,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
} else if agents.contains(invitee) {
|
||||
send_invite();
|
||||
} else if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta.server_msg("Can't invite, not a player or npc".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Can't invite, not a player or npc",
|
||||
));
|
||||
}
|
||||
|
||||
// Notify inviter that the invite is pending
|
||||
@ -176,7 +179,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
},
|
||||
GroupManip::Accept => {
|
||||
let clients = state.ecs().read_storage::<Client>();
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let mut invites = state.ecs().write_storage::<Invite>();
|
||||
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
||||
let inviter = invite.0;
|
||||
@ -223,7 +226,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
},
|
||||
GroupManip::Decline => {
|
||||
let clients = state.ecs().read_storage::<Client>();
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let mut invites = state.ecs().write_storage::<Invite>();
|
||||
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
||||
let inviter = invite.0;
|
||||
@ -252,7 +255,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
},
|
||||
GroupManip::Leave => {
|
||||
let clients = state.ecs().read_storage::<Client>();
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let mut group_manager = state.ecs().write_resource::<GroupManager>();
|
||||
group_manager.leave_group(
|
||||
entity,
|
||||
@ -274,7 +277,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
},
|
||||
GroupManip::Kick(uid) => {
|
||||
let clients = state.ecs().read_storage::<Client>();
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let alignments = state.ecs().read_storage::<comp::Alignment>();
|
||||
|
||||
let target = match state.ecs().entity_from_uid(uid.into()) {
|
||||
@ -282,10 +285,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
None => {
|
||||
// Inform of failure
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("Kick failed, target does not exist.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Kick failed, target does not exist.",
|
||||
));
|
||||
}
|
||||
return;
|
||||
},
|
||||
@ -295,19 +298,20 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
if matches!(alignments.get(target), Some(comp::Alignment::Owned(owner)) if uids.get(target).map_or(true, |u| u != owner))
|
||||
{
|
||||
if let Some(general_stream) = clients.get(entity) {
|
||||
general_stream.send_fallible(
|
||||
ChatType::Meta.server_msg("Kick failed, you can't kick pets.".to_owned()),
|
||||
);
|
||||
general_stream.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Kick failed, you can't kick pets.",
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Can't kick yourself
|
||||
if uids.get(entity).map_or(false, |u| *u == uid) {
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("Kick failed, you can't kick yourself.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Kick failed, you can't kick yourself.",
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -341,47 +345,50 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
|
||||
// Tell them the have been kicked
|
||||
if let Some(client) = clients.get(target) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("You were removed from the group.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"You were removed from the group.",
|
||||
));
|
||||
}
|
||||
// Tell kicker that they were succesful
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client
|
||||
.send_fallible(ChatType::Meta.server_msg("Player kicked.".to_owned()));
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Player kicked.",
|
||||
));
|
||||
}
|
||||
},
|
||||
Some(_) => {
|
||||
// Inform kicker that they are not the leader
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(ChatType::Meta.server_msg(
|
||||
"Kick failed: You are not the leader of the target's group.".to_owned(),
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Kick failed: You are not the leader of the target's group.",
|
||||
));
|
||||
}
|
||||
},
|
||||
None => {
|
||||
// Inform kicker that the target is not in a group
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta.server_msg(
|
||||
"Kick failed: Your target is not in a group.".to_owned(),
|
||||
),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Kick failed: Your target is not in a group.",
|
||||
));
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
GroupManip::AssignLeader(uid) => {
|
||||
let clients = state.ecs().read_storage::<Client>();
|
||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let target = match state.ecs().entity_from_uid(uid.into()) {
|
||||
Some(t) => t,
|
||||
None => {
|
||||
// Inform of failure
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(ChatType::Meta.server_msg(
|
||||
"Leadership transfer failed, target does not exist".to_owned(),
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Leadership transfer failed, target does not exist",
|
||||
));
|
||||
}
|
||||
return;
|
||||
@ -415,34 +422,34 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
);
|
||||
// Tell them they are the leader
|
||||
if let Some(client) = clients.get(target) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta.server_msg("You are the group leader now.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"You are the group leader now.",
|
||||
));
|
||||
}
|
||||
// Tell the old leader that the transfer was succesful
|
||||
if let Some(client) = clients.get(target) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta
|
||||
.server_msg("You are no longer the group leader.".to_owned()),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"You are no longer the group leader.",
|
||||
));
|
||||
}
|
||||
},
|
||||
Some(_) => {
|
||||
// Inform transferer that they are not the leader
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(
|
||||
ChatType::Meta.server_msg(
|
||||
"Transfer failed: You are not the leader of the target's group."
|
||||
.to_owned(),
|
||||
),
|
||||
);
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Transfer failed: You are not the leader of the target's group.",
|
||||
));
|
||||
}
|
||||
},
|
||||
None => {
|
||||
// Inform transferer that the target is not in a group
|
||||
if let Some(client) = clients.get(entity) {
|
||||
client.send_fallible(ChatType::Meta.server_msg(
|
||||
"Transfer failed: Your target is not in a group.".to_owned(),
|
||||
client.send_fallible(ServerGeneral::server_msg(
|
||||
ChatType::Meta,
|
||||
"Transfer failed: Your target is not in a group.",
|
||||
));
|
||||
}
|
||||
},
|
||||
|
@ -10,9 +10,9 @@ use common::{
|
||||
Pos,
|
||||
},
|
||||
consts::MAX_MOUNT_RANGE,
|
||||
msg::ServerGeneral,
|
||||
sync::{Uid, WorldSyncExt},
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||
use specs::{world::WorldExt, Entity as EcsEntity};
|
||||
use tracing::error;
|
||||
|
||||
|
@ -5,12 +5,12 @@ use common::{
|
||||
slot::{self, Slot},
|
||||
},
|
||||
consts::MAX_PICKUP_RANGE,
|
||||
msg::ServerGeneral,
|
||||
recipe::default_recipe_book,
|
||||
sync::{Uid, WorldSyncExt},
|
||||
uid::Uid,
|
||||
util::find_dist::{self, FindDist},
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||
use common_sys::state::State;
|
||||
use comp::LightEmitter;
|
||||
use rand::Rng;
|
||||
|
@ -6,10 +6,10 @@ use crate::{
|
||||
use common::{
|
||||
comp,
|
||||
comp::{group, Player},
|
||||
msg::{PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||
span,
|
||||
sync::{Uid, UidAllocator},
|
||||
uid::{Uid, UidAllocator},
|
||||
};
|
||||
use common_net::msg::{PlayerListUpdate, PresenceKind, ServerGeneral};
|
||||
use common_sys::state::State;
|
||||
use futures_executor::block_on;
|
||||
use specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
||||
@ -137,7 +137,7 @@ pub fn handle_client_disconnect(server: &mut Server, entity: EcsEntity) -> Event
|
||||
state.read_storage::<Uid>().get(entity),
|
||||
state.read_storage::<comp::Player>().get(entity),
|
||||
) {
|
||||
state.notify_players(comp::ChatType::Offline(*uid).server_msg(""));
|
||||
state.notify_players(ServerGeneral::server_msg(comp::ChatType::Offline(*uid), ""));
|
||||
|
||||
state.notify_players(ServerGeneral::PlayerListUpdate(PlayerListUpdate::Remove(
|
||||
*uid,
|
||||
|
@ -51,18 +51,21 @@ use common::{
|
||||
cmd::ChatCommand,
|
||||
comp::{self, ChatType},
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::{
|
||||
ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerInit, ServerMsg, WorldMapMsg,
|
||||
},
|
||||
outcome::Outcome,
|
||||
recipe::default_recipe_book,
|
||||
resources::TimeOfDay,
|
||||
rtsim::RtSimEntity,
|
||||
sync::WorldSyncExt,
|
||||
terrain::TerrainChunkSize,
|
||||
uid::Uid,
|
||||
vol::{ReadVol, RectVolSize},
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_net::{
|
||||
msg::{
|
||||
ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerInit, ServerMsg, WorldMapMsg,
|
||||
},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::{plugin::PluginMgr, state::State};
|
||||
use futures_executor::block_on;
|
||||
use metrics::{PhysicsMetrics, ServerMetrics, StateTickMetrics, TickMetrics};
|
||||
use network::{Network, Pid, ProtocolAddr};
|
||||
@ -144,7 +147,7 @@ impl Server {
|
||||
metrics::NetworkRequestMetrics::new().unwrap();
|
||||
let (player_metrics, registry_player) = metrics::PlayerMetrics::new().unwrap();
|
||||
|
||||
let mut state = State::default();
|
||||
let mut state = State::server();
|
||||
state.ecs_mut().insert(settings.clone());
|
||||
state.ecs_mut().insert(editable_settings);
|
||||
state.ecs_mut().insert(DataDir {
|
||||
@ -1008,13 +1011,78 @@ impl Server {
|
||||
if let Ok(command) = kwd.parse::<ChatCommand>() {
|
||||
command.execute(self, entity, args);
|
||||
} else {
|
||||
self.notify_client(
|
||||
entity,
|
||||
ChatType::CommandError.server_msg(format!(
|
||||
"Unknown command '/{}'.\nType '/help' for available commands",
|
||||
kwd
|
||||
)),
|
||||
let plugin_manager = self.state.ecs().read_resource::<PluginMgr>();
|
||||
let rs = plugin_manager.execute_event(
|
||||
&format!("on_command_{}", &kwd),
|
||||
&plugin_api::event::ChatCommandEvent {
|
||||
command: kwd.clone(),
|
||||
command_args: args.split(' ').map(|x| x.to_owned()).collect(),
|
||||
player: plugin_api::event::Player {
|
||||
id: *(self
|
||||
.state
|
||||
.ecs()
|
||||
.read_storage::<Uid>()
|
||||
.get(entity)
|
||||
.expect("Can't get player UUID [This should never appen]")),
|
||||
},
|
||||
},
|
||||
);
|
||||
match rs {
|
||||
Ok(e) => {
|
||||
if e.is_empty() {
|
||||
self.notify_client(
|
||||
entity,
|
||||
ServerGeneral::server_msg(
|
||||
ChatType::CommandError,
|
||||
format!(
|
||||
"Unknown command '/{}'.\nType '/help' for available commands",
|
||||
kwd
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
e.into_iter().for_each(|e| match e {
|
||||
Ok(e) => {
|
||||
if !e.is_empty() {
|
||||
self.notify_client(
|
||||
entity,
|
||||
ServerGeneral::server_msg(
|
||||
ChatType::CommandInfo,
|
||||
e.join("\n"),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
self.notify_client(
|
||||
entity,
|
||||
ServerGeneral::server_msg(
|
||||
ChatType::CommandError,
|
||||
format!(
|
||||
"Error occurred while executing command '/{}'.\n{}",
|
||||
kwd, e
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!(?e, "Can't execute command {} {}", kwd, args);
|
||||
self.notify_client(
|
||||
entity,
|
||||
ServerGeneral::server_msg(
|
||||
ChatType::CommandError,
|
||||
format!(
|
||||
"Internal error while executing '/{}'.\nContact the server \
|
||||
administrator",
|
||||
kwd
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::settings::BanRecord;
|
||||
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
||||
use common::msg::RegisterError;
|
||||
use common_net::msg::RegisterError;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use std::str::FromStr;
|
||||
use tracing::{error, info};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use common::msg::PresenceKind;
|
||||
use common_net::msg::PresenceKind;
|
||||
use hashbrown::HashSet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, FlaggedStorage};
|
||||
|
@ -6,10 +6,13 @@ use common::{
|
||||
character::CharacterId,
|
||||
comp,
|
||||
effect::Effect,
|
||||
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
||||
uid::{Uid, UidAllocator},
|
||||
util::Dir,
|
||||
};
|
||||
use common_net::{
|
||||
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use rand::prelude::*;
|
||||
use specs::{
|
||||
|
@ -9,15 +9,15 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
comp::{ForceUpdate, Inventory, InventoryUpdate, Last, Ori, Pos, Vel},
|
||||
msg::ServerGeneral,
|
||||
outcome::Outcome,
|
||||
region::{Event as RegionEvent, RegionMap},
|
||||
resources::TimeOfDay,
|
||||
span,
|
||||
sync::{CompSyncPackage, Uid},
|
||||
terrain::TerrainChunkSize,
|
||||
uid::Uid,
|
||||
vol::RectVolSize,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::CompSyncPackage};
|
||||
use specs::{
|
||||
Entities, Entity as EcsEntity, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage,
|
||||
};
|
||||
|
@ -2,10 +2,10 @@ use super::SysTimer;
|
||||
use crate::client::Client;
|
||||
use common::{
|
||||
comp::group::{Invite, PendingInvites},
|
||||
msg::{InviteAnswer, ServerGeneral},
|
||||
span,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::msg::{InviteAnswer, ServerGeneral};
|
||||
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
|
||||
|
||||
/// This system removes timed out group invites
|
||||
|
@ -6,10 +6,10 @@ use crate::{
|
||||
use common::{
|
||||
comp::{item::tool::AbilityMap, ChatType, Player, UnresolvedChatMsg},
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::{ClientGeneral, ServerGeneral},
|
||||
span,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::msg::{ClientGeneral, ServerGeneral};
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||
use std::sync::atomic::Ordering;
|
||||
use tracing::{debug, warn};
|
||||
@ -62,9 +62,10 @@ impl Sys {
|
||||
|
||||
// Give the player a welcome message
|
||||
if !editable_settings.server_description.is_empty() {
|
||||
client.send(ChatType::CommandInfo.server_msg(String::from(
|
||||
client.send(ServerGeneral::server_msg(
|
||||
ChatType::CommandInfo,
|
||||
&*editable_settings.server_description,
|
||||
)))?;
|
||||
))?;
|
||||
}
|
||||
|
||||
if !client.login_msg_sent.load(Ordering::Relaxed) {
|
||||
|
@ -3,10 +3,12 @@ use crate::{client::Client, metrics::PlayerMetrics};
|
||||
use common::{
|
||||
comp::{ChatMode, Player, UnresolvedChatMsg},
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::{validate_chat_msg, ChatMsgValidationError, ClientGeneral, MAX_BYTES_CHAT_MSG},
|
||||
resources::Time,
|
||||
span,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::msg::{
|
||||
validate_chat_msg, ChatMsgValidationError, ClientGeneral, MAX_BYTES_CHAT_MSG,
|
||||
};
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
@ -3,11 +3,11 @@ use crate::{client::Client, metrics::NetworkRequestMetrics, presence::Presence,
|
||||
use common::{
|
||||
comp::{CanBuild, ControlEvent, Controller, ForceUpdate, Health, Ori, Pos, Stats, Vel},
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::{ClientGeneral, PresenceKind, ServerGeneral},
|
||||
span,
|
||||
terrain::{TerrainChunkSize, TerrainGrid},
|
||||
vol::{ReadVol, RectVolSize},
|
||||
};
|
||||
use common_net::msg::{ClientGeneral, PresenceKind, ServerGeneral};
|
||||
use common_sys::state::BlockChange;
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
||||
use tracing::{debug, trace};
|
||||
|
@ -2,10 +2,10 @@ use super::super::SysTimer;
|
||||
use crate::{client::Client, metrics::PlayerMetrics, Settings};
|
||||
use common::{
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::PingMsg,
|
||||
resources::Time,
|
||||
span,
|
||||
};
|
||||
use common_net::msg::PingMsg;
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||
use std::sync::atomic::Ordering;
|
||||
use tracing::{debug, info};
|
||||
|
@ -4,12 +4,12 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
comp::{Admin, Player, Stats},
|
||||
msg::{
|
||||
CharacterInfo, ClientRegister, PlayerInfo, PlayerListUpdate, RegisterError, ServerGeneral,
|
||||
ServerRegisterAnswer,
|
||||
},
|
||||
span,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::msg::{
|
||||
CharacterInfo, ClientRegister, PlayerInfo, PlayerListUpdate, RegisterError, ServerGeneral,
|
||||
ServerRegisterAnswer,
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
use specs::{Entities, Join, ReadExpect, ReadStorage, System, Write, WriteExpect, WriteStorage};
|
||||
|
@ -5,9 +5,9 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
comp::{Inventory, Loadout, Stats, Waypoint},
|
||||
msg::PresenceKind,
|
||||
span,
|
||||
};
|
||||
use common_net::msg::PresenceKind;
|
||||
use specs::{Join, ReadExpect, ReadStorage, System, Write};
|
||||
|
||||
pub struct Sys;
|
||||
|
@ -5,9 +5,12 @@ use common::{
|
||||
Group, Health, Item, LightEmitter, Loadout, Mass, MountState, Mounting, Ori, Player, Pos,
|
||||
Scale, Shockwave, Stats, Sticky, Vel,
|
||||
},
|
||||
msg::EcsCompPacket,
|
||||
span,
|
||||
sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, Uid, UpdateTracker, WorldSyncExt},
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::{
|
||||
msg::EcsCompPacket,
|
||||
sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, UpdateTracker, WorldSyncExt},
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
use specs::{
|
||||
|
@ -8,13 +8,13 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
comp::{Ori, Pos, Vel},
|
||||
msg::ServerGeneral,
|
||||
region::{region_in_vd, regions_in_vd, Event as RegionEvent, RegionMap},
|
||||
span,
|
||||
sync::Uid,
|
||||
terrain::TerrainChunkSize,
|
||||
uid::Uid,
|
||||
vol::RectVolSize,
|
||||
};
|
||||
use common_net::msg::ServerGeneral;
|
||||
use specs::{
|
||||
Entities, Join, ReadExpect, ReadStorage, System, SystemData, World, WorldExt, Write,
|
||||
WriteStorage,
|
||||
|
@ -6,12 +6,12 @@ use common::{
|
||||
comp::{self, bird_medium, item::tool::AbilityMap, Alignment, Pos},
|
||||
event::{EventBus, ServerEvent},
|
||||
generation::get_npc_name,
|
||||
msg::ServerGeneral,
|
||||
npc::NPC_NAMES,
|
||||
span,
|
||||
terrain::TerrainGrid,
|
||||
LoadoutBuilder,
|
||||
};
|
||||
use common_net::msg::ServerGeneral;
|
||||
use common_sys::state::TerrainChanges;
|
||||
use rand::Rng;
|
||||
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write, WriteExpect};
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::SysTimer;
|
||||
use crate::{client::Client, presence::Presence};
|
||||
use common::{comp::Pos, msg::ServerGeneral, span, terrain::TerrainGrid};
|
||||
use common::{comp::Pos, span, terrain::TerrainGrid};
|
||||
use common_net::msg::ServerGeneral;
|
||||
use common_sys::state::TerrainChanges;
|
||||
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||
|
||||
|
@ -2,10 +2,10 @@ use super::SysTimer;
|
||||
use crate::client::Client;
|
||||
use common::{
|
||||
comp::{Player, Pos, Waypoint, WaypointArea},
|
||||
msg::{Notification, ServerGeneral},
|
||||
resources::Time,
|
||||
span,
|
||||
};
|
||||
use common_net::msg::{Notification, ServerGeneral};
|
||||
use specs::{Entities, Join, Read, ReadStorage, System, Write, WriteStorage};
|
||||
|
||||
/// Cooldown time (in seconds) for "Waypoint Saved" notifications
|
||||
|
@ -21,7 +21,8 @@ default = ["gl", "singleplayer", "native-dialog", "simd"]
|
||||
[dependencies]
|
||||
client = {package = "veloren-client", path = "../client"}
|
||||
common = {package = "veloren-common", path = "../common"}
|
||||
common_sys = {package = "veloren_common_sys", path = "../common/sys"}
|
||||
common-net = {package = "veloren-common-net", path = "../common/net"}
|
||||
common-sys = {package = "veloren-common-sys", path = "../common/sys"}
|
||||
|
||||
anim = {package = "veloren-voxygen-anim", path = "anim", default-features = false}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use crate::ecs::{
|
||||
use common::{
|
||||
comp::{Health, HealthSource, Pos, Stats},
|
||||
resources::DeltaTime,
|
||||
sync::Uid,
|
||||
uid::Uid,
|
||||
};
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
||||
|
||||
|
@ -4,13 +4,11 @@ use super::{
|
||||
};
|
||||
use crate::{i18n::Localization, ui::fonts::Fonts, GlobalState};
|
||||
use client::{cmd, Client};
|
||||
use common::{
|
||||
comp::{
|
||||
chat::{KillSource, KillType},
|
||||
ChatMsg, ChatType,
|
||||
},
|
||||
msg::validate_chat_msg,
|
||||
use common::comp::{
|
||||
chat::{KillSource, KillType},
|
||||
ChatMsg, ChatType,
|
||||
};
|
||||
use common_net::msg::validate_chat_msg;
|
||||
use conrod_core::{
|
||||
input::Key,
|
||||
position::Dimension,
|
||||
|
@ -15,8 +15,9 @@ use crate::{
|
||||
use client::{self, Client};
|
||||
use common::{
|
||||
comp::{group::Role, BuffKind, Stats},
|
||||
sync::{Uid, WorldSyncExt},
|
||||
uid::{Uid, UidAllocator},
|
||||
};
|
||||
use common_net::sync::WorldSyncExt;
|
||||
use conrod_core::{
|
||||
color,
|
||||
position::{Place, Relative},
|
||||
@ -327,9 +328,7 @@ impl<'a> Widget for Group<'a> {
|
||||
let healths = client_state.ecs().read_storage::<common::comp::Health>();
|
||||
let energy = client_state.ecs().read_storage::<common::comp::Energy>();
|
||||
let buffs = client_state.ecs().read_storage::<common::comp::Buffs>();
|
||||
let uid_allocator = client_state
|
||||
.ecs()
|
||||
.read_resource::<common::sync::UidAllocator>();
|
||||
let uid_allocator = client_state.ecs().read_resource::<UidAllocator>();
|
||||
|
||||
// Keep track of the total number of widget ids we are using for buffs
|
||||
let mut total_buff_count = 0;
|
||||
|
@ -9,7 +9,8 @@ use crate::{
|
||||
GlobalState,
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::{comp, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||
use common_net::msg::world_msg::SiteKind;
|
||||
use conrod_core::{
|
||||
color, position,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
|
@ -5,7 +5,8 @@ use super::{
|
||||
};
|
||||
use crate::ui::{fonts::Fonts, img_ids};
|
||||
use client::{self, Client};
|
||||
use common::{comp, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||
use common_net::msg::world_msg::SiteKind;
|
||||
use conrod_core::{
|
||||
color, position,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
|
@ -61,13 +61,13 @@ use common::{
|
||||
item::{ItemDesc, Quality},
|
||||
BuffKind,
|
||||
},
|
||||
msg::PresenceKind,
|
||||
span,
|
||||
sync::Uid,
|
||||
terrain::TerrainChunk,
|
||||
uid::Uid,
|
||||
util::srgba_to_linear,
|
||||
vol::RectRasterableVol,
|
||||
};
|
||||
use common_net::msg::{Notification, PresenceKind};
|
||||
use conrod_core::{
|
||||
text::cursor::Index,
|
||||
widget::{self, Button, Image, Text},
|
||||
@ -365,12 +365,12 @@ pub enum Event {
|
||||
ChangeAutoWalkBehavior(PressBehavior),
|
||||
ChangeStopAutoWalkOnInput(bool),
|
||||
CraftRecipe(String),
|
||||
InviteMember(common::sync::Uid),
|
||||
InviteMember(Uid),
|
||||
AcceptInvite,
|
||||
DeclineInvite,
|
||||
KickMember(common::sync::Uid),
|
||||
KickMember(Uid),
|
||||
LeaveGroup,
|
||||
AssignLeader(common::sync::Uid),
|
||||
AssignLeader(Uid),
|
||||
RemoveBuff(BuffKind),
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ pub struct Hud {
|
||||
fonts: Fonts,
|
||||
rot_imgs: ImgsRot,
|
||||
new_messages: VecDeque<comp::ChatMsg>,
|
||||
new_notifications: VecDeque<common::msg::Notification>,
|
||||
new_notifications: VecDeque<Notification>,
|
||||
speech_bubbles: HashMap<Uid, comp::SpeechBubble>,
|
||||
show: Show,
|
||||
//never_show: bool,
|
||||
@ -767,7 +767,7 @@ impl Hud {
|
||||
let buffs = ecs.read_storage::<comp::Buffs>();
|
||||
let energy = ecs.read_storage::<comp::Energy>();
|
||||
let hp_floater_lists = ecs.read_storage::<vcomp::HpFloaterList>();
|
||||
let uids = ecs.read_storage::<common::sync::Uid>();
|
||||
let uids = ecs.read_storage::<Uid>();
|
||||
let interpolated = ecs.read_storage::<vcomp::Interpolated>();
|
||||
let scales = ecs.read_storage::<comp::Scale>();
|
||||
let bodies = ecs.read_storage::<comp::Body>();
|
||||
@ -2439,9 +2439,7 @@ impl Hud {
|
||||
|
||||
pub fn new_message(&mut self, msg: comp::ChatMsg) { self.new_messages.push_back(msg); }
|
||||
|
||||
pub fn new_notification(&mut self, msg: common::msg::Notification) {
|
||||
self.new_notifications.push_back(msg);
|
||||
}
|
||||
pub fn new_notification(&mut self, msg: Notification) { self.new_notifications.push_back(msg); }
|
||||
|
||||
pub fn scale_change(&mut self, scale_change: ScaleChange) -> ScaleMode {
|
||||
let scale_mode = match scale_change {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user