Added checks for character removal to a bunch of places. Some of these may not necessary, but at least MeleeWeapon, Projectile and Controller still accessed the user after the user had been removed.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
if (character == null || reloadTimer>0.0f) return false;
|
||||
if (character == null || reloadTimer > 0.0f) return false;
|
||||
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
|
||||
|
||||
//don't allow hitting if the character is already hitting with another weapon
|
||||
@@ -172,6 +172,7 @@ namespace Barotrauma.Items.Components
|
||||
private void SetUser(Character character)
|
||||
{
|
||||
if (user == character) return;
|
||||
if (user != null && user.Removed) user = null;
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
@@ -213,6 +214,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private bool OnCollision(Fixture f1, Fixture f2, Contact contact)
|
||||
{
|
||||
if (user == null || user.Removed)
|
||||
{
|
||||
RestoreCollision();
|
||||
hitting = false;
|
||||
user = null;
|
||||
}
|
||||
|
||||
Character targetCharacter = null;
|
||||
Limb targetLimb = null;
|
||||
Structure targetStructure = null;
|
||||
|
||||
Reference in New Issue
Block a user