Logging when players attach items on walls or detach them, null exception fix in Throwable (picker is set to null in Item.Drop)
This commit is contained in:
@@ -191,7 +191,7 @@ namespace Barotrauma.Items.Components
|
|||||||
item.body.Enabled = true;
|
item.body.Enabled = true;
|
||||||
IsActive = true;
|
IsActive = true;
|
||||||
|
|
||||||
if (!alreadySelected) Networking.GameServer.Log(character.Name + " equipped " + item.Name, Networking.ServerLog.MessageType.ItemInteraction);
|
if (!alreadySelected) GameServer.Log(character.Name + " equipped " + item.Name, ServerLog.MessageType.ItemInteraction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
picker.DeselectItem(item);
|
picker.DeselectItem(item);
|
||||||
|
|
||||||
Networking.GameServer.Log(character.Name + " unequipped " + item.Name, Networking.ServerLog.MessageType.ItemInteraction);
|
GameServer.Log(character.Name + " unequipped " + item.Name, ServerLog.MessageType.ItemInteraction);
|
||||||
|
|
||||||
item.body.Enabled = false;
|
item.body.Enabled = false;
|
||||||
IsActive = false;
|
IsActive = false;
|
||||||
@@ -234,6 +234,10 @@ namespace Barotrauma.Items.Components
|
|||||||
if (GameMain.Server != null && attachable)
|
if (GameMain.Server != null && attachable)
|
||||||
{
|
{
|
||||||
item.CreateServerEvent(this);
|
item.CreateServerEvent(this);
|
||||||
|
if (picker != null)
|
||||||
|
{
|
||||||
|
Networking.GameServer.Log(picker.Name + " detached " + item.Name + " from a wall", ServerLog.MessageType.ItemInteraction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -284,9 +288,10 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (!character.IsKeyDown(InputType.Aim)) return false;
|
if (!character.IsKeyDown(InputType.Aim)) return false;
|
||||||
if (character.CurrentHull == null) return false;
|
if (character.CurrentHull == null) return false;
|
||||||
if (character != null && GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
item.CreateServerEvent(this);
|
item.CreateServerEvent(this);
|
||||||
|
GameServer.Log(character.Name + " attached " + item.Name+" to a wall", ServerLog.MessageType.ItemInteraction);
|
||||||
}
|
}
|
||||||
item.Drop();
|
item.Drop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,11 +93,11 @@ namespace Barotrauma.Items.Components
|
|||||||
Vector2 throwVector = picker.CursorWorldPosition - picker.WorldPosition;
|
Vector2 throwVector = picker.CursorWorldPosition - picker.WorldPosition;
|
||||||
throwVector = Vector2.Normalize(throwVector);
|
throwVector = Vector2.Normalize(throwVector);
|
||||||
|
|
||||||
|
GameServer.Log(picker.Name + " threw " + item.Name, ServerLog.MessageType.ItemInteraction);
|
||||||
|
|
||||||
item.Drop();
|
item.Drop();
|
||||||
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f);
|
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f);
|
||||||
|
|
||||||
GameServer.Log(picker.Name + " threw " + item.Name, ServerLog.MessageType.ItemInteraction);
|
|
||||||
|
|
||||||
ac.GetLimb(LimbType.Head).body.ApplyLinearImpulse(throwVector*10.0f);
|
ac.GetLimb(LimbType.Head).body.ApplyLinearImpulse(throwVector*10.0f);
|
||||||
ac.GetLimb(LimbType.Torso).body.ApplyLinearImpulse(throwVector * 10.0f);
|
ac.GetLimb(LimbType.Torso).body.ApplyLinearImpulse(throwVector * 10.0f);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user