mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 00:35:27 +00:00
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:
@@ -370,6 +370,13 @@ void ControllablePhysicsComponent::DeactivateBubbleBuff() {
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
};
|
||||
|
||||
void ControllablePhysicsComponent::ApplyStun(const GameMessages::SetStunned& stun) {
|
||||
// Only characters are stunned from using items
|
||||
if (!stun.bCantUseItem || !m_Parent->IsPlayer()) return;
|
||||
if (!stun.bIgnoreImmunity && m_ImmuneToStunUseItemCount > 0) return;
|
||||
m_StunnedUseItemCount = std::max(0, m_StunnedUseItemCount + (stun.StateChangeType == eStateChangeType::PUSH ? 1 : -1));
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::SetStunImmunity(
|
||||
const eStateChangeType state,
|
||||
const LWOOBJID originator,
|
||||
|
||||
Reference in New Issue
Block a user