Syncing StatusEffects applied by meleeweapons or using an item on self

This commit is contained in:
Regalis
2017-01-15 14:49:15 +02:00
parent f7ac98ab5f
commit 8f50cca026
4 changed files with 52 additions and 22 deletions
@@ -212,7 +212,7 @@ namespace Barotrauma.Items.Components
private bool OnCollision(Fixture f1, Fixture f2, Contact contact)
{
IDamageable target = null;
Character target = null;
Limb limb = f2.Body.UserData as Limb;
if (limb != null)
@@ -227,16 +227,23 @@ namespace Barotrauma.Items.Components
if (target == null)
{
target = f2.Body.UserData as IDamageable;
target = f2.Body.UserData as Character;
}
if (target == null) return false;
if (attack!=null) attack.DoDamage(user, target, item.WorldPosition, 1.0f);
if (attack != null) attack.DoDamage(user, target, item.WorldPosition, 1.0f);
RestoreCollision();
hitting = false;
if (GameMain.Client != null) return true;
if (GameMain.Server != null)
{
GameMain.Server.CreateEntityEvent(item, new object[] { Barotrauma.Networking.NetEntityEvent.Type.ApplyStatusEffect, target.ID });
}
ApplyStatusEffects(ActionType.OnUse, 1.0f, limb.character);
return true;