From 0a0d598a226c84367809e915dcf168e7ba2a8111 Mon Sep 17 00:00:00 2001 From: JohnM <234386938+treuenten@users.noreply.github.com> Date: Sat, 10 Oct 2026 00:14:22 +0800 Subject: [PATCH] Lay a dropped riot shield flat on the ground The riot shield's world model stands upright, as it is carried, with its origin at the grip. A dropped item gets only the dropper's yaw, so a dropped shield stood on edge with half of it in the floor: a thin upright sliver beside the body. A dropped shield, recognised by its weapon type, is now pitched onto its back. Guns keep pitch 0 as before. A gun dropped by a swap now keeps only the yaw of the item it replaces, so a gun swapped for a shield does not inherit the shield's tilt. To see it: on Rust, die holding a riot shield after the start grace period. Co-Authored-By: Claude Opus 5.5 --- crates/sim/src/item.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/sim/src/item.rs b/crates/sim/src/item.rs index e067955..56043f3 100644 --- a/crates/sim/src/item.rs +++ b/crates/sim/src/item.rs @@ -33,6 +33,8 @@ pub const ITEM_USE_HOLD_MS: i32 = 250; pub const PLAYER_DROP_Z: f32 = (PLAYER_MAXS[2] - PLAYER_MINS[2]) * 0.5; +const SHIELD_DROP_PITCH: f32 = -90.0; + #[derive(Clone, Copy, Debug, PartialEq)] pub struct DroppedItem { pub state: entity_iw4::EntityState, @@ -326,13 +328,21 @@ fn launch_dropped_from_ps( tr_time: 0, tr_duration: 0, tr_delta: [0.0; 3], - tr_base: [0.0, ps.viewangles[1], 0.0], + tr_base: dropped_angles(world, weapon, ps.viewangles[1]), }; push_dropped_item( world, weapon, origin, pos, apos, owner, clip_r, clip_l, stock, true, scavenger, ) } +fn dropped_angles(world: &FrameWorld, weapon: u32, yaw: f32) -> [f32; 3] { + let shield = world + .combat_facts_for(weapon) + .is_some_and(|facts| facts.weap_type == weapon_iw4::WEAPTYPE_SHIELD); + let pitch = if shield { SHIELD_DROP_PITCH } else { 0.0 }; + [pitch, yaw, 0.0] +} + pub(crate) fn drop_weapon( world: &mut FrameWorld, tick: Tick, @@ -771,7 +781,7 @@ fn drop_current_primary_at( tr_time: 0, tr_duration: 0, tr_delta: [0.0; 3], - tr_base: angles, + tr_base: dropped_angles(world, weapon, angles[1]), }; let entnum = push_dropped_item( world,