Skip to content

Commit

Permalink
a small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
CMDR-Bill-Doors committed Oct 6, 2023
1 parent 18e0979 commit b49bf4a
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,11 @@ public bool StartReload(CompAmmoUser TurretMagazine, bool continued = false)
//if this is the right turret to reload
if (graphicsExt != null)
{
bool tagMatch = false;
//if def exists and match
bool tagMatch = graphicsExt.allowedTurrets.Any() && graphicsExt.allowedTurrets.Contains(turret.def.defName);

//if tag exists and match
if (graphicsExt.allowedTurretTags.Any())
if (!tagMatch && graphicsExt.allowedTurretTags.Any())
{
foreach (string loadertag in graphicsExt.allowedTurretTags)
{
Expand All @@ -363,12 +365,6 @@ public bool StartReload(CompAmmoUser TurretMagazine, bool continued = false)
}
}

//if def exists and match
if (graphicsExt.allowedTurrets.Any() && graphicsExt.allowedTurrets.Contains(turret.def.defName))
{
tagMatch = true;
}

if (!tagMatch)
{
return false;
Expand Down

0 comments on commit b49bf4a

Please sign in to comment.