mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
switch to SharedLink and unset context
This commit is contained in:
parent
a00c0d4c0d
commit
cf1a6b1806
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -3184,6 +3184,17 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
|
||||
|
||||
[[package]]
|
||||
name = "mumble-link"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a92ff7d87d3ca752fda7a1ccfcde284ea3de84fc8b8a0c43bf434652226bd95"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.4.0"
|
||||
@ -6200,6 +6211,7 @@ dependencies = [
|
||||
"itertools 0.10.1",
|
||||
"keyboard-keynames",
|
||||
"lazy_static",
|
||||
"mumble-link",
|
||||
"naga 0.6.0",
|
||||
"native-dialog",
|
||||
"num 0.4.0",
|
||||
|
@ -84,6 +84,9 @@ vek = {version = "=0.14.1", features = ["serde"]}
|
||||
# Controller
|
||||
gilrs = {version = "0.8.0", features = ["serde-serialize"]}
|
||||
|
||||
# Mumble
|
||||
mumble-link = "0.1.0"
|
||||
|
||||
# Singleplayer
|
||||
server = { package = "veloren-server", path = "../server", optional = true, default-features = false, features = ["worldgen"] }
|
||||
|
||||
|
@ -2,6 +2,7 @@ pub mod settings_change;
|
||||
|
||||
use std::{cell::RefCell, collections::HashSet, rc::Rc, result::Result, sync::Arc, time::Duration};
|
||||
|
||||
use mumble_link::SharedLink;
|
||||
use ordered_float::OrderedFloat;
|
||||
use specs::{Join, WorldExt};
|
||||
use tracing::{error, info, warn};
|
||||
@ -77,6 +78,7 @@ pub struct SessionState {
|
||||
target_entity: Option<specs::Entity>,
|
||||
selected_entity: Option<(specs::Entity, std::time::Instant)>,
|
||||
interactable: Option<Interactable>,
|
||||
mumble_link: SharedLink,
|
||||
hitboxes: HashMap<specs::Entity, DebugShapeId>,
|
||||
}
|
||||
|
||||
@ -95,12 +97,22 @@ impl SessionState {
|
||||
scene
|
||||
.camera_mut()
|
||||
.set_fov_deg(global_state.settings.graphics.fov);
|
||||
let mut mumble_link = SharedLink::new("veloren", "veloren-voxygen");
|
||||
{
|
||||
let mut client = client.borrow_mut();
|
||||
client.request_player_physics(global_state.settings.gameplay.player_physics_behavior);
|
||||
client.request_lossy_terrain_compression(
|
||||
global_state.settings.graphics.lossy_terrain_compression,
|
||||
);
|
||||
if let Some(uid) = client.uid() {
|
||||
let identiy = if let Some(info) = client.player_list().get(&uid) {
|
||||
format!("{}-{}", info.player_alias, uid.to_string())
|
||||
} else {
|
||||
format!("unknown-{}", uid.to_string())
|
||||
};
|
||||
mumble_link.set_identity(&identiy);
|
||||
// TODO: evaluate context
|
||||
}
|
||||
}
|
||||
let hud = Hud::new(global_state, &client.borrow());
|
||||
let walk_forward_dir = scene.camera().forward_xy();
|
||||
@ -124,6 +136,7 @@ impl SessionState {
|
||||
target_entity: None,
|
||||
selected_entity: None,
|
||||
interactable: None,
|
||||
mumble_link,
|
||||
hitboxes: HashMap::new(),
|
||||
}
|
||||
}
|
||||
@ -146,6 +159,24 @@ impl SessionState {
|
||||
let mut client = self.client.borrow_mut();
|
||||
self.scene
|
||||
.maintain_debug_hitboxes(&client, &global_state.settings, &mut self.hitboxes);
|
||||
|
||||
// Update mumble positional audio
|
||||
let pos = client.position().unwrap_or_default();
|
||||
let ori = client
|
||||
.state()
|
||||
.read_storage::<comp::Ori>()
|
||||
.get(client.entity())
|
||||
.map_or_else(comp::Ori::default, |o| *o);
|
||||
let front = ori.look_dir().to_vec();
|
||||
let top = ori.up().to_vec();
|
||||
// converting from veloren z = height axis, to mumble y = height axis
|
||||
let player_pos = mumble_link::Position {
|
||||
position: [pos.x, pos.z, pos.y],
|
||||
front: [front.x, front.z, front.y],
|
||||
top: [top.x, top.z, top.y],
|
||||
};
|
||||
self.mumble_link.update(player_pos, player_pos);
|
||||
|
||||
for event in client.tick(self.inputs.clone(), dt, crate::ecs::sys::add_local_systems)? {
|
||||
match event {
|
||||
client::Event::Chat(m) => {
|
||||
|
Loading…
Reference in New Issue
Block a user