1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +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]
#[derive(Debug, Eq, PartialEq, Clone)]
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)]
ToggleInvisibility {
#[brw(pad_before = 2)]

View file

@ -1,8 +1,17 @@
use binrw::binrw;
use crate::common::{read_bool_from, write_bool_as};
#[binrw]
#[derive(Debug, Eq, PartialEq, Clone)]
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)]
SetTarget {
#[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);
}
}
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),
}
}