Skip to content

Commit

Permalink
fix(virology): machinery fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Filatelele authored Nov 30, 2023
1 parent ecd3f68 commit da512e0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
26 changes: 18 additions & 8 deletions code/modules/virus2/centrifuge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@
..()
if (stat & (NOPOWER|BROKEN)) return

if (curing)
if(curing)
curing -= speed
if (curing <= 0)
curing = max(curing, 0)
if(curing <= 0)
cure()

if (isolating)
if(isolating)
isolating -= speed
isolating = max(isolating, 0)
if(isolating <= 0)
isolate()

Expand All @@ -136,6 +138,9 @@
if (B)
var/datum/disease2/disease/virus = locate(href_list["isolate"])
virus2 = virus.getcopy()
if(!virus2)
return TOPIC_HANDLED

isolating = 40
update_icon()
return TOPIC_REFRESH
Expand Down Expand Up @@ -169,12 +174,15 @@
return TOPIC_REFRESH

/obj/machinery/computer/centrifuge/proc/cure()
if (!sample) return
if(!sample)
return

var/datum/reagent/blood/B = locate(/datum/reagent/blood) in sample.reagents.reagent_list
if (!B) return
if(!B)
return

var/list/data = list("antibodies" = B.data["antibodies"])
var/amt= sample.reagents.get_reagent_amount(/datum/reagent/blood)
var/amt = sample.reagents.get_reagent_amount(/datum/reagent/blood)
sample.reagents.remove_reagent(/datum/reagent/blood, amt)
sample.reagents.add_reagent(/datum/reagent/antibodies, amt, data)

Expand All @@ -183,11 +191,13 @@
ping("\The [src] pings, \"Antibody isolated.\"")

/obj/machinery/computer/centrifuge/proc/isolate()
if (!sample) return
if(!sample || !virus2)
return

var/obj/item/virusdish/dish = new /obj/item/virusdish(loc)
dish.virus2 = virus2
dish.virus2.infected = null
virus2 = null
QDEL_NULL(virus2)

SSnano.update_uis(src)
update_icon()
Expand Down
9 changes: 6 additions & 3 deletions code/modules/virus2/diseasesplicer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,22 @@
return

if(scanning)
scanning -= 1*speed
scanning -= 1 * speed
scanning = max(scanning, 0)
if(scanning <= 0)
ping("\The [src] pings, \"Analysis complete.\"")
SSnano.update_uis(src)

if(splicing)
splicing -= 1*speed
splicing -= 1 * speed
splicing = max(splicing, 0)
if(splicing <= 0)
ping("\The [src] pings, \"Splicing operation complete.\"")
SSnano.update_uis(src)

if(burning)
burning -= 1*speed
burning -= 1 * speed
burning = max(burning, 0)
if(burning <= 0)
var/obj/item/diseasedisk/d = new /obj/item/diseasedisk(src.loc)
d.analysed = analysed
Expand Down
2 changes: 1 addition & 1 deletion code/modules/virus2/items_devices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
..()
if(prob(50))
to_chat(user, "<span class='danger'>\The [src] shatters!</span>")
if(virus2.infectionchance > 0)
if(virus2?.infectionchance > 0)
for(var/mob/living/carbon/target in view(1, get_turf(src)))
if(airborne_can_reach(get_turf(src), get_turf(target)))
infect_virus2(target, src.virus2)
Expand Down

0 comments on commit da512e0

Please sign in to comment.