Merge pull request #6085 from faerindel/chemdispenser_cleanup

Little cleanup on Chemistry-Machinery
This commit is contained in:
Zuhayr
2014-08-21 22:43:19 +09:30
2 changed files with 7 additions and 47 deletions

View File

@@ -14,15 +14,13 @@
var/energy = 100
var/max_energy = 100
var/amount = 30
var/accept_glass = 0
var/accept_glass = 0 //At 0 ONLY accepts glass containers. Kinda misleading varname.
var/beaker = null
var/recharged = 0
var/hackedcheck = 0
var/list/dispensable_reagents = list("hydrogen","lithium","carbon","nitrogen","oxygen","fluorine",
"sodium","aluminum","silicon","phosphorus","sulfur","chlorine","potassium","iron",
"copper","mercury","radium","water","ethanol","sugar","sacid","tungsten")
var/list/broken_requirements = list()
var/broken_on_spawn = 0
/obj/machinery/chem_dispenser/proc/recharge()
if(stat & (BROKEN|NOPOWER)) return
@@ -42,7 +40,6 @@
nanomanager.update_uis(src) // update all UIs attached to src
/obj/machinery/chem_dispenser/process()
if(recharged <= 0)
recharge()
recharged = 15
@@ -54,27 +51,6 @@
recharge()
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)
switch(severity)
@@ -105,9 +81,6 @@
* @return nothing
*/
/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(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)
if(isrobot(user))
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)
user << "Something is already loaded into the machine."
return
@@ -218,7 +178,6 @@
/obj/machinery/chem_dispenser/attack_hand(mob/user as mob)
if(stat & BROKEN)
return
ui_interact(user)
/obj/machinery/chem_dispenser/soda
@@ -245,6 +204,7 @@
dispensable_reagents -= list("thirteenloko")
hackedcheck = 0
return
/obj/machinery/chem_dispenser/beer
icon_state = "booze_dispenser"
name = "booze dispenser"

View File

@@ -2064,7 +2064,7 @@ datum
description = "This is what makes chilis hot."
reagent_state = LIQUID
color = "#B31008" // rgb: 179, 16, 8
on_mob_life(var/mob/living/M as mob)
if(!M)
M = holder.my_atom
@@ -2078,7 +2078,7 @@ datum
H << "\red <b>Your insides feel uncomfortably hot !</b>"
if(2 to 20)
if(prob(5))
H << "\red <b>Your insides feel uncomfortably hot !</b>"
H << "\red <b>Your insides feel uncomfortably hot !</b>"
if(20 to INFINITY)
H.apply_effect(2,AGONY,0)
if(prob(5))
@@ -2186,10 +2186,10 @@ datum
on_mob_life(var/mob/living/M as mob)
if(!M)
M = holder.my_atom
M.bodytemperature = max(M.bodytemperature - 10 * TEMPERATURE_DAMAGE_COEFFICIENT, 0)
M = holder.my_atom
M.bodytemperature = max(M.bodytemperature - 10 * TEMPERATURE_DAMAGE_COEFFICIENT, 0)
if(prob(1))
M.emote("shiver")
M.emote("shiver")
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature = max(M.bodytemperature - rand(10,20), 0)
holder.remove_reagent("capsaicin", 5)