Constrained weapon behavior to client side only

This commit is contained in:
Jocke
2016-03-04 08:55:55 +01:00
parent d78a7e20e2
commit e2674d915e
2 changed files with 10 additions and 7 deletions
@@ -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);
@@ -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);
}
}
}