aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/VirusManager.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/VirusManager.cs b/ShiftOS_TheReturn/VirusManager.cs
index 56767e6..f4a7fc6 100644
--- a/ShiftOS_TheReturn/VirusManager.cs
+++ b/ShiftOS_TheReturn/VirusManager.cs
@@ -96,5 +96,25 @@ namespace ShiftOS.Engine
throw new Exception("Cannot create virus.");
}
+
+ public static void Disinfect(string id)
+ {
+ foreach(var virus in ActiveInfections.ToArray())
+ {
+ var type = virus.GetType();
+ var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is VirusAttribute) as VirusAttribute;
+ if(attrib != null)
+ {
+ if (attrib.ID == id)
+ {
+ ActiveInfections.Remove(virus);
+ var inf = SaveSystem.CurrentSave.ViralInfections.FirstOrDefault(x => x.ID == id);
+ if (inf != null)
+ SaveSystem.CurrentSave.ViralInfections.Remove(inf);
+ virus.Disinfect();
+ }
+ }
+ }
+ }
}
}