New chem dispenser interface, by Tobba.

Some sanity checking in power.dm, by Tobba.

Updated changelog, by PETE YEAAAH.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2532 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
petethegoat@gmail.com
2011-11-19 21:18:11 +00:00
parent c5043cdb78
commit 9840c44b4e
8 changed files with 453 additions and 42 deletions
@@ -336,6 +336,7 @@ datum
D.cure(0)
*/
handle_reactions()
return 0
for(var/A in typesof(/datum/reagent) - /datum/reagent)
@@ -352,8 +353,11 @@ datum
//debug
update_total()
my_atom.on_reagent_change()
handle_reactions()
return 0
handle_reactions()
return 1
remove_reagent(var/reagent, var/amount, var/safety)//Added a safety check for the trans_id_to
+83 -36
View File
@@ -9,15 +9,17 @@
icon = 'chemical.dmi'
icon_state = "dispenser"
var/energy = 25
var/max_energy = 25
var/max_energy = 75
var/amount = 30
var/beaker = null
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","acid",)
proc
recharge()
if(stat & BROKEN) return
if(energy != max_energy)
energy++
use_power(50)
spawn(600) recharge()
use_power(2000) // This thing uses up alot of power (this is still low as shit for creating reagents from thin air)
spawn(200) recharge()
New()
recharge()
@@ -40,41 +42,91 @@
del(src)
return
Topic(href, href_list)
proc/updateWindow(mob/user as mob)
winset(user, "chemdispenser.energy", "text=\"Energy: [src.energy]\"")
winset(user, "chemdispenser.amount", "text=\"Amount: [src.amount]\"")
if (beaker)
winset(user, "chemdispenser.eject", "text=\"Eject beaker\"")
else
winset(user, "chemdispenser.eject", "text=\"\[Insert beaker\]\"")
proc/initWindow(mob/user as mob)
var/i = 0
var list/nameparams = params2list(winget(user, "chemdispenser_reagents.template_name", "pos;size;type;image;image-mode"))
var list/buttonparams = params2list(winget(user, "chemdispenser_reagents.template_dispense", "pos;size;type;image;image-mode;text;is-flat"))
for(var/re in dispensable_reagents)
for(var/da in typesof(/datum/reagent) - /datum/reagent)
var/datum/reagent/temp = new da()
if(temp.id == re)
var list/newparams1 = nameparams.Copy()
var list/newparams2 = buttonparams.Copy()
var/posy = 8 + 40 * i
newparams1["pos"] = text("8,[posy]")
newparams2["pos"] = text("248,[posy]")
newparams1["parent"] = "chemdispenser_reagents"
newparams2["parent"] = "chemdispenser_reagents"
newparams1["text"] = temp.name
newparams2["command"] = text("skincmd \"chemdispenser;[temp.id]\"")
winset(user, "chemdispenser_reagent_name[i]", list2params(newparams1))
winset(user, "chemdispenser_reagent_dispense[i]", list2params(newparams2))
i++
winset(user, "chemdispenser_reagents", "size=340x[8 + 40 * i]")
SkinCmd(mob/user as mob, var/data as text)
if(stat & BROKEN) return
if(usr.stat || usr.restrained()) return
if(!in_range(src, usr)) return
usr.machine = src
if (href_list["dispense"])
if(!energy)
var/dat = "Not enough energy.<BR><A href='?src=\ref[src];ok=1'>OK</A>"
usr << browse("<TITLE>Chemical Dispenser</TITLE>Chemical dispenser:<BR>Energy = [energy]/[max_energy]<BR><BR>[dat]", "window=chem_dispenser")
return
var/id = href_list["dispense"]
var/obj/item/weapon/reagent_containers/glass/dispenser/G = new/obj/item/weapon/reagent_containers/glass/dispenser(src.loc)
switch(text2num(href_list["state"]))
if(LIQUID)
G.icon_state = "liquid"
if(GAS)
G.icon_state = "vapour"
if(SOLID)
G.icon_state = "solid"
G.pixel_x = rand(-7, 7)
G.pixel_y = rand(-7, 7)
G.name += " ([lowertext(href_list["name"])])"
G.reagents.add_reagent(id,30)
energy--
src.updateUsrDialog()
return
if (data == "amountc")
var/num = text2num(input("Enter desired output amount", "Amount", "30"))
if (num)
amount = text2num(num)
else if (data == "eject")
if (src.beaker)
var/obj/item/weapon/reagent_containers/glass/B = src.beaker
B.loc = src.loc
src.beaker = null
else if (copytext(data, 1, 7) == "amount")
if (text2num(copytext(data, 7)))
amount = text2num(copytext(data, 7))
else
usr << browse(null, "window=chem_dispenser")
return
if (dispensable_reagents.Find(data) && beaker != null)
var/obj/item/weapon/reagent_containers/glass/B = src.beaker
var/datum/reagents/R = B.reagents
var/space = R.maximum_volume - R.total_volume
R.add_reagent(data, min(amount, energy * 10, space))
energy = max(energy - min(amount, space) / 10, 0)
amount = round(amount, 10) // Chem dispenser doesnt really have that much prescion
if (amount < 0) // Since the user can actually type the commands himself, some sanity checking
amount = 0
if (amount > 100)
amount = 100
for(var/mob/player)
if (player.machine == src && player.client)
updateWindow(player)
src.add_fingerprint(usr)
return
attackby(var/obj/item/weapon/reagent_containers/glass/B as obj, var/mob/user as mob)
if(!istype(B, /obj/item/weapon/reagent_containers/glass))
return
if(src.beaker)
user << "A beaker is already loaded into the machine."
return
src.beaker = B
user.drop_item()
B.loc = src
user << "You add the beaker to the machine!"
for(var/mob/player)
if (player.machine == src && player.client)
updateWindow(player)
attack_ai(mob/user as mob)
return src.attack_hand(user)
@@ -85,16 +137,11 @@
if(stat & BROKEN)
return
user.machine = src
var/dat = ""
for(var/re in dispensable_reagents)
for(var/da in typesof(/datum/reagent) - /datum/reagent)
var/datum/reagent/temp = new da()
if(temp.id == re)
dat += "<A href='?src=\ref[src];dispense=[temp.id];state=[temp.reagent_state];name=[temp.name]'>[temp.name]</A><BR>"
dat += "[temp.description]<BR><BR>"
user << browse("<TITLE>Chemical Dispenser</TITLE>Chemical dispenser:<BR>Energy = [energy]/[max_energy]<BR><BR>[dat]", "window=chem_dispenser")
onclose(user, "chem_dispenser")
initWindow(user)
updateWindow(user)
winshow(user, "chemdispenser", 1)
user.skincmds["chemdispenser"] = src
return
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+2 -1
View File
@@ -601,6 +601,7 @@
var/list/can_be_placed_into = list(
/obj/machinery/chem_master/,
/obj/machinery/chem_dispenser/,
/obj/machinery/reagentgrinder,
/obj/structure/table,
/obj/structure/secure_closet,
@@ -3163,4 +3164,4 @@
icon_state = "jar"
name = "empty jar"
desc = "A jar. You're not sure what it's supposed to hold."
return
return
+2 -2
View File
@@ -28,7 +28,7 @@
return 0
var/area/A = src.loc.loc // make sure it's in an area
if(!A || !isarea(A))
if(!A || !isarea(A) || !A.master)
return 0 // if not, then not powered
return A.master.powered(chan) // return power status of the area
@@ -37,7 +37,7 @@
/obj/machinery/proc/use_power(var/amount, var/chan=EQUIP) // defaults to Equipment channel
var/area/A = src.loc.loc // make sure it's in an area
if(!A || !isarea(A))
if(!A || !isarea(A) || !A.master)
return
A.master.use_power(amount, chan)
+6 -1
View File
@@ -61,6 +61,11 @@ should be listed in the changelog upon commit tho. Thanks. -->
<li>Toggling admin midis will now <b><font color=red>DISABLE THE CURRENT MIDI OH MY GOSH!</b></font color></li>
</ul>
</li>
<li><b>Tobba updated:</b>
<ul>
<li>We're looking for feedback on the updated chem dispenser! It no longer dispenses beakers of the reagent, and instead places a variable amount of the reagent into the beaker of your choosing.</li>
</ul>
</li>
</ul>
<b><font color='blue'>16 November 2011</font><b>
@@ -76,7 +81,7 @@ should be listed in the changelog upon commit tho. Thanks. -->
<ul>
<li><b>Petethegoat updated:</b>
<ul>
<li>Security, Engineer, Medical, and Janitor borgs no longer get a choice of module. This is for purposes of quick recognition, and is the first part of a series of upcoming cyborg updates.</li>
<li>Security, Engineer, Medical, and Janitor borgs no longer get a choice of skin. This is for purposes of quick recognition, and is the first part of a series of upcoming cyborg updates.</li>
</ul>
</li>
</ul>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+356 -2
View File
@@ -291,6 +291,360 @@ menu "menu"
saved-params = "is-checked"
window "chemdispenser"
elem "chemdispenser"
type = MAIN
pos = 281,0
size = 340x480
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = false
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "pos;size;is-minimized;is-maximized"
on-size = ""
title = "Chem Dispenser"
titlebar = true
statusbar = false
can-close = true
can-minimize = true
can-resize = true
is-pane = false
is-minimized = false
is-maximized = false
can-scroll = none
icon = ""
image = ""
image-mode = stretch
keep-aspect = false
transparent-color = none
alpha = 255
macro = ""
menu = ""
on-close = ""
elem "energy"
type = LABEL
pos = 8,24
size = 56x16
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = ""
on-size = ""
text = "Energy: 25"
image = ""
image-mode = center
keep-aspect = false
align = center
text-wrap = false
elem "eject"
type = BUTTON
pos = 264,4
size = 72x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "[Insert beaker]"
image = ""
command = "skincmd \"chemdispenser;eject\""
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "amountc"
type = BUTTON
pos = 208,4
size = 48x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "[Other]"
image = ""
command = "skincmd \"chemdispenser;amountc\""
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "amount3"
type = BUTTON
pos = 176,4
size = 24x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "[30]"
image = ""
command = "skincmd \"chemdispenser;amount30\""
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "amount2"
type = BUTTON
pos = 144,4
size = 24x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "[20]"
image = ""
command = "skincmd \"chemdispenser;amount20\""
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "amount1"
type = BUTTON
pos = 112,4
size = 24x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "[10]"
image = ""
command = "skincmd \"chemdispenser;amount10\""
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "amount"
type = LABEL
pos = 4,4
size = 100x20
anchor1 = none
anchor2 = none
font-family = ""
font-size = 12
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = ""
on-size = ""
text = "Amount: 30"
image = ""
image-mode = center
keep-aspect = false
align = center
text-wrap = false
elem "child1"
type = CHILD
pos = 0,40
size = 340x440
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "splitter"
on-size = ""
left = "chemdispenser_reagents"
right = ""
is-vert = false
splitter = 50
show-splitter = true
lock = none
window "chemdispenser_reagents"
elem "chemdispenser_reagents"
type = MAIN
pos = 281,0
size = 340x448
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "pos;size;is-minimized;is-maximized"
on-size = ""
title = ""
titlebar = false
statusbar = false
can-close = false
can-minimize = false
can-resize = false
is-pane = true
is-minimized = false
is-maximized = false
can-scroll = vertical
icon = ""
image = ""
image-mode = stretch
keep-aspect = false
transparent-color = none
alpha = 255
macro = ""
menu = ""
on-close = ""
elem "template_dispense"
type = BUTTON
pos = 256,8
size = 64x32
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = false
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "Dispense"
image = 'icons\\dispensebutton_bg.png'
command = ""
is-flat = true
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "template_name"
type = LABEL
pos = 18,8
size = 230x32
anchor1 = none
anchor2 = none
font-family = ""
font-size = 15
font-style = ""
text-color = #000000
background-color = none
is-visible = false
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = ""
on-size = ""
text = "Chloral Hydrate"
image = 'icons\\reagentname_bg.png'
image-mode = stretch
keep-aspect = false
align = center
text-wrap = false
window "mainwindow"
elem "mainwindow"
type = MAIN
@@ -920,7 +1274,7 @@ window "vendingslot"
is-maximized = false
can-scroll = none
icon = ""
image = 'icons\\vending_icons\\vendingslot_bg.png'
image = 'icons\\vendingslot_bg.png'
image-mode = stretch
keep-aspect = false
transparent-color = none
@@ -1012,7 +1366,7 @@ window "vendingslot"
window "vendingwindow"
elem "vendingwindow"
type = MAIN
pos = 758,177
pos = 281,0
size = 300x470
anchor1 = none
anchor2 = none