Chemistry machinery fixes.

Makes Topic() calls check parent. Adds proper operable() checks where applicable.
Makes the interact_offline only affect the NOPOWER flag.
Fixes #11116. Fixes #11302.
This commit is contained in:
PsiOmegaDelta
2015-10-15 11:31:57 +02:00
parent 21fada644d
commit 2fcaaf80c7
3 changed files with 18 additions and 26 deletions

View File

@@ -195,7 +195,10 @@ Class Procs:
return (stat & (NOPOWER|BROKEN|additional_flags)) return (stat & (NOPOWER|BROKEN|additional_flags))
/obj/machinery/CanUseTopic(var/mob/user) /obj/machinery/CanUseTopic(var/mob/user)
if(!interact_offline && (stat & (NOPOWER|BROKEN))) if(stat & BROKEN)
return STATUS_CLOSE
if(!interact_offline && (stat & NOPOWER))
return STATUS_CLOSE return STATUS_CLOSE
return ..() return ..()

View File

@@ -80,13 +80,8 @@
return return
/obj/machinery/chem_master/Topic(href, href_list) /obj/machinery/chem_master/Topic(href, href_list)
if(stat & (BROKEN|NOPOWER)) return if(..())
if(usr.stat || usr.restrained()) return return 1
if(!in_range(src, usr)) return
src.add_fingerprint(usr)
usr.set_machine(src)
if (href_list["ejectp"]) if (href_list["ejectp"])
if(loaded_pill_bottle) if(loaded_pill_bottle)
@@ -236,7 +231,7 @@
return src.attack_hand(user) return src.attack_hand(user)
/obj/machinery/chem_master/attack_hand(mob/user as mob) /obj/machinery/chem_master/attack_hand(mob/user as mob)
if(stat & BROKEN) if(inoperable())
return return
user.set_machine(src) user.set_machine(src)
if(!(user.client in has_sprites)) if(!(user.client in has_sprites))
@@ -345,11 +340,8 @@
/obj/machinery/computer/pandemic/Topic(href, href_list) /obj/machinery/computer/pandemic/Topic(href, href_list)
if(stat & (NOPOWER|BROKEN)) return if(..())
if(usr.stat || usr.restrained()) return return 1
if(!in_range(src, usr)) return
usr.set_machine(src)
if(!beaker) return if(!beaker) return
if (href_list["create_vaccine"]) if (href_list["create_vaccine"])
@@ -657,10 +649,12 @@
return 0 return 0
/obj/machinery/reagentgrinder/attack_hand(mob/user as mob) /obj/machinery/reagentgrinder/attack_hand(mob/user as mob)
user.set_machine(src)
interact(user) interact(user)
/obj/machinery/reagentgrinder/interact(mob/user as mob) // The microwave Menu /obj/machinery/reagentgrinder/interact(mob/user as mob) // The microwave Menu
if(inoperable())
return
user.set_machine(src)
var/is_chamber_empty = 0 var/is_chamber_empty = 0
var/is_beaker_ready = 0 var/is_beaker_ready = 0
var/processing_chamber = "" var/processing_chamber = ""
@@ -707,8 +701,8 @@
/obj/machinery/reagentgrinder/Topic(href, href_list) /obj/machinery/reagentgrinder/Topic(href, href_list)
if(..()) if(..())
return return 1
usr.set_machine(src)
switch(href_list["action"]) switch(href_list["action"])
if ("grind") if ("grind")
grind() grind()
@@ -717,7 +711,7 @@
if ("detach") if ("detach")
detach() detach()
src.updateUsrDialog() src.updateUsrDialog()
return return 1
/obj/machinery/reagentgrinder/proc/detach() /obj/machinery/reagentgrinder/proc/detach()

View File

@@ -113,9 +113,6 @@
return ..() return ..()
/obj/machinery/chemical_dispenser/ui_interact(mob/user, ui_key = "main",var/datum/nanoui/ui = null, var/force_open = 1) /obj/machinery/chemical_dispenser/ui_interact(mob/user, ui_key = "main",var/datum/nanoui/ui = null, var/force_open = 1)
if(stat & (BROKEN|NOPOWER)) return
if(user.stat || user.restrained()) return
// this is the data which will be sent to the ui // this is the data which will be sent to the ui
var/data[0] var/data[0]
data["amount"] = amount data["amount"] = amount
@@ -148,8 +145,8 @@
ui.open() ui.open()
/obj/machinery/chemical_dispenser/Topic(href, href_list) /obj/machinery/chemical_dispenser/Topic(href, href_list)
if(stat & (NOPOWER|BROKEN)) if(..())
return 0 // don't update UIs attached to this object return 1
if(href_list["amount"]) if(href_list["amount"])
amount = round(text2num(href_list["amount"]), 1) // round to nearest 1 amount = round(text2num(href_list["amount"]), 1) // round to nearest 1
@@ -171,9 +168,7 @@
return 1 // update UIs attached to this object return 1 // update UIs attached to this object
/obj/machinery/chemical_dispenser/attack_ai(mob/user as mob) /obj/machinery/chemical_dispenser/attack_ai(mob/user as mob)
src.attack_hand(user) ui_interact(user)
/obj/machinery/chemical_dispenser/attack_hand(mob/user as mob) /obj/machinery/chemical_dispenser/attack_hand(mob/user as mob)
if(stat & BROKEN)
return
ui_interact(user) ui_interact(user)