From e2674d915ecf0a9828945f9eaa35b6a582977dc7 Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 08:55:55 +0100 Subject: [PATCH] Constrained weapon behavior to client side only --- include/Game/Systems/Weapon/WeaponBehaviour.h | 6 ++++-- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 11 ++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 3cda172e..a823f9dd 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -242,8 +242,10 @@ private: // Spawn the weapon(s) EntityWrapper firstPersonWeapon; EntityWrapper thirdPersonWeapon; - if (firstPersonAttachment.Valid()) { - firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); + if (IsClient) { + if (firstPersonAttachment.Valid()) { + firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); + } } if (thirdPersonAttachment.Valid()) { thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index cdb0a563..4c970500 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -117,11 +117,12 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload"); - - // Spawn explosion effect - EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); - if (reloadEffectSpawner.Valid()) { - SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + if (IsClient) { + // Spawn explosion effect + EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); + if (reloadEffectSpawner.Valid()) { + SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + } } }