fixes a bunch of warnings

This commit is contained in:
Paul
2021-12-20 13:58:30 +01:00
parent 21174366b7
commit d4d85b663f
68 changed files with 113 additions and 168 deletions

View File

@@ -280,8 +280,7 @@ namespace Content.Server.Botany
public IEnumerable<EntityUid> AutoHarvest(EntityCoordinates position, int yieldMod = 1)
{
if (position.IsValid(IoCManager.Resolve<IEntityManager>()) && ProductPrototypes != null &&
ProductPrototypes.Count > 0)
if (position.IsValid(IoCManager.Resolve<IEntityManager>()) && ProductPrototypes.Count > 0)
return GenerateProduct(position, yieldMod);
return Enumerable.Empty<EntityUid>();
@@ -291,10 +290,10 @@ namespace Content.Server.Botany
{
AddToDatabase();
if (user == null)
if (!user.Valid)
return Enumerable.Empty<EntityUid>();
if (ProductPrototypes == null || ProductPrototypes.Count == 0 || Yield <= 0)
if (ProductPrototypes.Count == 0 || Yield <= 0)
{
user.PopupMessageCursor(Loc.GetString("botany-harvest-fail-message"));
return Enumerable.Empty<EntityUid>();
@@ -312,14 +311,8 @@ namespace Content.Server.Botany
if (yieldMod < 0)
{
yieldMod = 1;
totalYield = Yield;
}
else
{
totalYield = Yield * yieldMod;
}
totalYield = Math.Max(1, totalYield);
totalYield = Math.Max(1, Yield * yieldMod);
}
var random = IoCManager.Resolve<IRobustRandom>();