1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 19:57:46 +00:00

Display unsheathed weapon to other players

It doesn't play the animation correctly, yet.
This commit is contained in:
Joshua Goins 2025-06-22 10:08:29 -04:00
parent e1b01299c9
commit b41cb478e7
3 changed files with 28 additions and 0 deletions

View file

@ -10,6 +10,13 @@ use super::OnlineStatus;
#[binrw] #[binrw]
#[derive(Debug, Eq, PartialEq, Clone)] #[derive(Debug, Eq, PartialEq, Clone)]
pub enum ActorControlCategory { pub enum ActorControlCategory {
#[brw(magic = 0x0u16)]
ToggleWeapon {
#[brw(pad_before = 2)]
#[br(map = read_bool_from::<u32>)]
#[bw(map = write_bool_as::<u32>)]
shown: bool,
},
#[brw(magic = 0x26u16)] #[brw(magic = 0x26u16)]
ToggleInvisibility { ToggleInvisibility {
#[brw(pad_before = 2)] #[brw(pad_before = 2)]

View file

@ -1,8 +1,17 @@
use binrw::binrw; use binrw::binrw;
use crate::common::{read_bool_from, write_bool_as};
#[binrw] #[binrw]
#[derive(Debug, Eq, PartialEq, Clone)] #[derive(Debug, Eq, PartialEq, Clone)]
pub enum ClientTriggerCommand { pub enum ClientTriggerCommand {
#[brw(magic = 0x1u16)]
ToggleWeapon {
#[brw(pad_before = 2)]
#[br(map = read_bool_from::<u32>)]
#[bw(map = write_bool_as::<u32>)]
shown: bool,
},
#[brw(magic = 0x3u16)] #[brw(magic = 0x3u16)]
SetTarget { SetTarget {
#[brw(pad_before = 2)] #[brw(pad_before = 2)]

View file

@ -388,6 +388,18 @@ pub async fn server_main_loop(mut recv: Receiver<ToServer>) -> Result<(), std::i
to_remove.push(id); to_remove.push(id);
} }
} }
ClientTriggerCommand::ToggleWeapon { shown } => {
let msg = FromServer::ActorControl(
from_actor_id,
ActorControl {
category: ActorControlCategory::ToggleWeapon { shown: *shown },
},
);
if handle.send(msg).is_err() {
to_remove.push(id);
}
}
_ => tracing::warn!("Server doesn't know what to do with {:#?}", trigger), _ => tracing::warn!("Server doesn't know what to do with {:#?}", trigger),
} }
} }