2f107db...5202af9
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Barotrauma.Networking;
|
||||
using Lidgren.Network;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class Structure : MapEntity, IDamageable, IServerSerializable, ISerializableEntity
|
||||
{
|
||||
partial void AdjustKarma(IDamageable attacker, float amount)
|
||||
{
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
if (Submarine == null) return;
|
||||
if (attacker == null) return;
|
||||
if (attacker is Character attackerCharacter)
|
||||
{
|
||||
Client attackerClient = GameMain.Server.ConnectedClients.Find(c => c.Character == attackerCharacter);
|
||||
if (attackerClient != null)
|
||||
{
|
||||
if (attackerCharacter.TeamID == Submarine.TeamID)
|
||||
{
|
||||
attackerClient.Karma -= amount * 0.001f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null)
|
||||
{
|
||||
for (int i = 0; i < Sections.Length; i++)
|
||||
{
|
||||
msg.WriteRangedSingle(Sections[i].damage / Health, 0.0f, 1.0f, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user