mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Merge pull request #6085 from faerindel/chemdispenser_cleanup
Little cleanup on Chemistry-Machinery
This commit is contained in:
@@ -14,15 +14,13 @@
|
|||||||
var/energy = 100
|
var/energy = 100
|
||||||
var/max_energy = 100
|
var/max_energy = 100
|
||||||
var/amount = 30
|
var/amount = 30
|
||||||
var/accept_glass = 0
|
var/accept_glass = 0 //At 0 ONLY accepts glass containers. Kinda misleading varname.
|
||||||
var/beaker = null
|
var/beaker = null
|
||||||
var/recharged = 0
|
var/recharged = 0
|
||||||
var/hackedcheck = 0
|
var/hackedcheck = 0
|
||||||
var/list/dispensable_reagents = list("hydrogen","lithium","carbon","nitrogen","oxygen","fluorine",
|
var/list/dispensable_reagents = list("hydrogen","lithium","carbon","nitrogen","oxygen","fluorine",
|
||||||
"sodium","aluminum","silicon","phosphorus","sulfur","chlorine","potassium","iron",
|
"sodium","aluminum","silicon","phosphorus","sulfur","chlorine","potassium","iron",
|
||||||
"copper","mercury","radium","water","ethanol","sugar","sacid","tungsten")
|
"copper","mercury","radium","water","ethanol","sugar","sacid","tungsten")
|
||||||
var/list/broken_requirements = list()
|
|
||||||
var/broken_on_spawn = 0
|
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/proc/recharge()
|
/obj/machinery/chem_dispenser/proc/recharge()
|
||||||
if(stat & (BROKEN|NOPOWER)) return
|
if(stat & (BROKEN|NOPOWER)) return
|
||||||
@@ -42,7 +40,6 @@
|
|||||||
nanomanager.update_uis(src) // update all UIs attached to src
|
nanomanager.update_uis(src) // update all UIs attached to src
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/process()
|
/obj/machinery/chem_dispenser/process()
|
||||||
|
|
||||||
if(recharged <= 0)
|
if(recharged <= 0)
|
||||||
recharge()
|
recharge()
|
||||||
recharged = 15
|
recharged = 15
|
||||||
@@ -54,27 +51,6 @@
|
|||||||
recharge()
|
recharge()
|
||||||
dispensable_reagents = sortList(dispensable_reagents)
|
dispensable_reagents = sortList(dispensable_reagents)
|
||||||
|
|
||||||
if(broken_on_spawn)
|
|
||||||
var/amount = pick(1,2,2,3,4)
|
|
||||||
var/list/options = list()
|
|
||||||
options[/obj/item/weapon/stock_parts/capacitor/adv] = "Add an advanced capacitor to fix it."
|
|
||||||
options[/obj/item/weapon/stock_parts/console_screen] = "Replace the console screen to fix it."
|
|
||||||
options[/obj/item/weapon/stock_parts/manipulator/pico] = "Upgrade to a pico manipulator to fix it."
|
|
||||||
options[/obj/item/weapon/stock_parts/matter_bin/adv] = "Give it an advanced matter bin to fix it."
|
|
||||||
options[/obj/item/stack/sheet/mineral/diamond] = "Line up a cut diamond with the nozzle to fix it."
|
|
||||||
options[/obj/item/stack/sheet/mineral/uranium] = "Position a uranium sheet inside to fix it."
|
|
||||||
options[/obj/item/stack/sheet/mineral/phoron] = "Enter a block of phoron to fix it."
|
|
||||||
options[/obj/item/stack/sheet/mineral/silver] = "Cover the internals with a silver lining to fix it."
|
|
||||||
options[/obj/item/stack/sheet/mineral/gold] = "Wire a golden filament to fix it."
|
|
||||||
options[/obj/item/stack/sheet/plasteel] = "Surround the outside with a plasteel cover to fix it."
|
|
||||||
options[/obj/item/stack/sheet/rglass] = "Insert a pane of reinforced glass to fix it."
|
|
||||||
stat |= BROKEN
|
|
||||||
while(amount > 0)
|
|
||||||
amount -= 1
|
|
||||||
|
|
||||||
var/index = pick(options)
|
|
||||||
broken_requirements[index] = options[index]
|
|
||||||
options -= index
|
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/ex_act(severity)
|
/obj/machinery/chem_dispenser/ex_act(severity)
|
||||||
switch(severity)
|
switch(severity)
|
||||||
@@ -105,9 +81,6 @@
|
|||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main",var/datum/nanoui/ui = null)
|
/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main",var/datum/nanoui/ui = null)
|
||||||
if(broken_requirements.len)
|
|
||||||
user << "<span class='warning'>[src] is broken. [broken_requirements[broken_requirements[1]]]</span>"
|
|
||||||
return
|
|
||||||
if(stat & (BROKEN|NOPOWER)) return
|
if(stat & (BROKEN|NOPOWER)) return
|
||||||
if(user.stat || user.restrained()) return
|
if(user.stat || user.restrained()) return
|
||||||
|
|
||||||
@@ -183,19 +156,6 @@
|
|||||||
/obj/machinery/chem_dispenser/attackby(var/obj/item/weapon/reagent_containers/B as obj, var/mob/user as mob)
|
/obj/machinery/chem_dispenser/attackby(var/obj/item/weapon/reagent_containers/B as obj, var/mob/user as mob)
|
||||||
if(isrobot(user))
|
if(isrobot(user))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(broken_requirements.len && B.type == broken_requirements[1])
|
|
||||||
broken_requirements -= broken_requirements[1]
|
|
||||||
user << "<span class='notice'>You fix [src].</span>"
|
|
||||||
if(istype(B,/obj/item/stack))
|
|
||||||
var/obj/item/stack/S = B
|
|
||||||
S.use(1)
|
|
||||||
else
|
|
||||||
user.drop_item()
|
|
||||||
del(B)
|
|
||||||
if(broken_requirements.len==0)
|
|
||||||
stat ^= BROKEN
|
|
||||||
return
|
|
||||||
if(src.beaker)
|
if(src.beaker)
|
||||||
user << "Something is already loaded into the machine."
|
user << "Something is already loaded into the machine."
|
||||||
return
|
return
|
||||||
@@ -218,7 +178,6 @@
|
|||||||
/obj/machinery/chem_dispenser/attack_hand(mob/user as mob)
|
/obj/machinery/chem_dispenser/attack_hand(mob/user as mob)
|
||||||
if(stat & BROKEN)
|
if(stat & BROKEN)
|
||||||
return
|
return
|
||||||
|
|
||||||
ui_interact(user)
|
ui_interact(user)
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/soda
|
/obj/machinery/chem_dispenser/soda
|
||||||
@@ -245,6 +204,7 @@
|
|||||||
dispensable_reagents -= list("thirteenloko")
|
dispensable_reagents -= list("thirteenloko")
|
||||||
hackedcheck = 0
|
hackedcheck = 0
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/beer
|
/obj/machinery/chem_dispenser/beer
|
||||||
icon_state = "booze_dispenser"
|
icon_state = "booze_dispenser"
|
||||||
name = "booze dispenser"
|
name = "booze dispenser"
|
||||||
|
|||||||
Reference in New Issue
Block a user