clickthrough: cascade raycast with custom CanTargetEntity filter bits
Replace the re-raycast approach with a priority cascade: loot > GO > NPC > normal. Each pass uses custom flag bits (0x01/02/04 in upper byte) that our CanTargetEntity hook reads to exclude non-matching objects at the raycast level. Terrain/WMO occlusion applies per pass. Hook CanTargetEntity (0x480610) for per-object filtering: strips custom bits before calling original, then checks lootable/interactable/NPC based on which pass is active. Objects that don't match the current pass return NULL (invisible to raycast, ray continues through them). Fix isLootable: UNIT_DYNAMIC_FLAGS was at wrong descriptor offset (0x96*4=0x258, should be 0x8F*4=0x23C per server UpdateFields index 143). Also add UNIT_DYNFLAG_TAPPED and UNIT_DYNFLAG_TAPPED_BY_PLAYER offsets. Fix isLootable base pointer: use getDescriptor (obj+0x08) not getUnitDescriptor (obj+0x110), consistent with getNpcFlags and all other descriptor reads in the project.
This commit is contained in:
+5
-4
@@ -42,11 +42,12 @@ pub const DESC_ENTRY: usize = 0x03 * 4;
|
||||
/// UNIT_NPC_FLAGS = OBJECT_END(0x06) + 0x8D = 0x93
|
||||
pub const DESC_NPC_FLAGS: usize = 0x93 * 4;
|
||||
|
||||
/// UNIT_DYNAMIC_FLAGS = OBJECT_END(0x06) + 0x90 = 0x96
|
||||
pub const DESC_UNIT_DYNAMIC_FLAGS: usize = 0x96 * 4;
|
||||
/// UNIT_DYNAMIC_FLAGS: server UpdateFields index 143 (0x8F), byte offset 0x23C
|
||||
pub const DESC_UNIT_DYNAMIC_FLAGS: usize = 0x8F * 4;
|
||||
|
||||
/// Bit 0: unit corpse is lootable by the local player.
|
||||
pub const UNIT_DYNFLAG_LOOTABLE: u32 = 0x01;
|
||||
pub const UNIT_DYNFLAG_LOOTABLE: u32 = 0x0001;
|
||||
pub const UNIT_DYNFLAG_TAPPED: u32 = 0x0004;
|
||||
pub const UNIT_DYNFLAG_TAPPED_BY_PLAYER: u32 = 0x0008;
|
||||
|
||||
/// GAMEOBJECT_TYPE_ID (index 0x15)
|
||||
pub const DESC_GO_TYPE: usize = 0x15 * 4;
|
||||
|
||||
Reference in New Issue
Block a user