fix(inventory): nothing is used while stunned from using items, as the client

LWOInventoryComponent_Common::msgUseNonEquipmentItem (0x00cdeba0) asks
GetStunned first and uses nothing when canUseItem is false
(LWOControllablePhysComponent::msgGetStunned 0x00be0df0: stunned from
using items, or dead). The server now counts the use-item stun of every
SetStunned it sends for an entity as msgSetStunned (0x00bf1d10) does
(push/pop, never below 0, characters only, unless immune and not
bIgnoreImmunity), and checks it with IsDead before using an item. The
server never checked either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 10:54:35 -05:00
parent a538f32382
commit 02c96b08bd
6 changed files with 131 additions and 1 deletions

View File

@@ -208,6 +208,13 @@ namespace GameMessages {
return true;
}
void SetStunned::Send(const SystemAddress& sysAddr) const {
auto* const entity = Game::entityManager->GetEntity(target);
auto* const physics = entity ? entity->GetComponent<ControllablePhysicsComponent>() : nullptr;
if (physics) physics->ApplyStun(*this);
NetGameMsg::Send(sysAddr);
}
void SetStunned::Serialize(RakNet::BitStream& bitStream) const {
BitStreamUtils::WriteOptional(bitStream, Originator, LWOOBJID_EMPTY);
bitStream.Write(StateChangeType);