Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||
{
|
||||
var metabolismAmount = MetabolismRate * tickTime;
|
||||
if (solutionEntity.TryGetComponent(out ThirstComponent thirst))
|
||||
if (solutionEntity.TryGetComponent(out ThirstComponent? thirst))
|
||||
thirst.UpdateThirst(metabolismAmount.Float() * HydrationFactor);
|
||||
|
||||
//Return amount of reagent to be removed, remove reagent regardless of ThirstComponent presence
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||
{
|
||||
var metabolismAmount = MetabolismRate * tickTime;
|
||||
if (solutionEntity.TryGetComponent(out HungerComponent hunger))
|
||||
if (solutionEntity.TryGetComponent(out HungerComponent? hunger))
|
||||
hunger.UpdateFood(metabolismAmount.Float() * NutritionFactor);
|
||||
|
||||
//Return amount of reagent to be removed, remove reagent regardless of HungerComponent presence
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
/// </summary>
|
||||
[DataField("maxScale")] private float _maxScale = 1;
|
||||
|
||||
public void React(IEntity solutionEntity, double intensity)
|
||||
public void React(IEntity? solutionEntity, double intensity)
|
||||
{
|
||||
var floatIntensity = (float)intensity;
|
||||
var floatIntensity = (float) intensity;
|
||||
if (solutionEntity == null)
|
||||
return;
|
||||
if(!solutionEntity.TryGetComponent(out SolutionContainerComponent solution))
|
||||
if (!solutionEntity.HasComponent<SolutionContainerComponent>())
|
||||
return;
|
||||
|
||||
//Handle scaling
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
var amount = ReagentUnit.Zero;
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity.TryGetComponent(out CleanableComponent cleanable))
|
||||
if (entity.TryGetComponent(out CleanableComponent? cleanable))
|
||||
{
|
||||
var next = amount + cleanable.CleanAmount;
|
||||
// Nothing left?
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
||||
var tileAtmos = tile.GridIndices.GetTileAtmosphere(tile.GridIndex);
|
||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid || tileAtmos.Air == null) return ReagentUnit.Zero;
|
||||
tileAtmos.Air.Temperature =
|
||||
MathF.Max(MathF.Min(tileAtmos.Air.Temperature - (_coolingTemperature * 1000f),
|
||||
tileAtmos.Air.Temperature / _coolingTemperature),
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
||||
var tileAtmos = tile.GridIndices.GetTileAtmosphere(tile.GridIndex);
|
||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
||||
if (tileAtmos?.Air == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
||||
tileAtmos.Air.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
||||
tileAtmos.Air.React(tileAtmos);
|
||||
return reactVolume;
|
||||
|
||||
Reference in New Issue
Block a user