commit
This commit is contained in:
@@ -142,69 +142,55 @@
|
|||||||
user.set_machine(src)
|
user.set_machine(src)
|
||||||
interact(user)
|
interact(user)
|
||||||
|
|
||||||
/*******************
|
|
||||||
* SmartFridge Menu
|
|
||||||
********************/
|
|
||||||
|
|
||||||
/obj/machinery/smartfridge/interact(mob/user)
|
|
||||||
if(stat)
|
|
||||||
return FALSE
|
|
||||||
|
|
||||||
var/dat = "<TT><b>Select an item:</b><br>"
|
/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||||
|
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||||
|
if(!ui)
|
||||||
|
ui = new(user, src, ui_key, "smartvend", name, 440, 550, master_ui, state)
|
||||||
|
ui.open()
|
||||||
|
|
||||||
if (contents.len == 0)
|
/obj/machinery/smartfridge/ui_data(mob/user)
|
||||||
dat += "<font color = 'red'>No product loaded!</font>"
|
. = list()
|
||||||
else
|
|
||||||
var/listofitems = list()
|
|
||||||
for (var/atom/movable/O in contents)
|
|
||||||
if (listofitems[O.name])
|
|
||||||
listofitems[O.name]++
|
|
||||||
else
|
|
||||||
listofitems[O.name] = 1
|
|
||||||
sortList(listofitems)
|
|
||||||
|
|
||||||
for (var/O in listofitems)
|
var/listofitems = list()
|
||||||
if(listofitems[O] <= 0)
|
for (var/I in src)
|
||||||
continue
|
var/atom/movable/O = I
|
||||||
var/N = listofitems[O]
|
if (listofitems[O.name])
|
||||||
var/itemName = url_encode(O)
|
listofitems[O.name]["amount"]++
|
||||||
dat += "<FONT color = 'blue'><B>[capitalize(O)]</B>:"
|
else
|
||||||
dat += " [N] </font>"
|
listofitems[O.name] = list("name" = O.name, "type" = O.type, "amount" = 1)
|
||||||
dat += "<a href='byond://?src=\ref[src];vend=[itemName];amount=1'>Vend</A> "
|
sortList(listofitems)
|
||||||
if(N > 5)
|
|
||||||
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=5'>x5</A>)"
|
|
||||||
if(N > 10)
|
|
||||||
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=10'>x10</A>)"
|
|
||||||
if(N > 25)
|
|
||||||
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=25'>x25</A>)"
|
|
||||||
if(N > 1)
|
|
||||||
dat += "(<a href='?src=\ref[src];vend=[itemName];amount=[N]'>All</A>)"
|
|
||||||
|
|
||||||
dat += "<br>"
|
.["contents"] = listofitems
|
||||||
|
.["name"] = name
|
||||||
|
.["isdryer"] = FALSE
|
||||||
|
|
||||||
dat += "</TT>"
|
|
||||||
user << browse("<HEAD><TITLE>[src] supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
|
|
||||||
onclose(user, "smartfridge")
|
|
||||||
return dat
|
|
||||||
|
|
||||||
/obj/machinery/smartfridge/Topic(var/href, var/list/href_list)
|
/obj/machinery/smartfridge/ui_act(action, params)
|
||||||
if(..())
|
. = ..()
|
||||||
|
if(.)
|
||||||
return
|
return
|
||||||
usr.set_machine(src)
|
switch(action)
|
||||||
|
if("Release")
|
||||||
|
var/desired = 0
|
||||||
|
|
||||||
var/N = href_list["vend"]
|
if (params["amount"])
|
||||||
var/amount = text2num(href_list["amount"])
|
desired = text2num(params["amount"])
|
||||||
|
else
|
||||||
|
desired = input("How many items?", "How many items would you like to take out?", 1) as null|num
|
||||||
|
|
||||||
var/i = amount
|
if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src)) // Sanity checkin' in case stupid stuff happens while we wait for input()
|
||||||
for(var/obj/O in contents)
|
return FALSE
|
||||||
if(i <= 0)
|
|
||||||
break
|
|
||||||
if(O.name == N)
|
|
||||||
O.loc = src.loc
|
|
||||||
i--
|
|
||||||
|
|
||||||
|
for(var/obj/item/O in src)
|
||||||
updateUsrDialog()
|
if(desired <= 0)
|
||||||
|
break
|
||||||
|
if(O.name == params["name"])
|
||||||
|
O.forceMove(drop_location())
|
||||||
|
desired--
|
||||||
|
return TRUE
|
||||||
|
return FALSE
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
@@ -240,20 +226,35 @@
|
|||||||
/obj/machinery/smartfridge/drying_rack/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 1)
|
/obj/machinery/smartfridge/drying_rack/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 1)
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/smartfridge/drying_rack/interact(mob/user)
|
/obj/machinery/smartfridge/drying_rack/ui_data(mob/user)
|
||||||
var/dat = ..()
|
. = list()
|
||||||
if(dat)
|
|
||||||
dat += "<br>"
|
|
||||||
dat += "<a href='byond://?src=\ref[src];dry=1'>Toggle Drying</A> "
|
|
||||||
user << browse("<HEAD><TITLE>[src] supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
|
|
||||||
onclose(user, "smartfridge")
|
|
||||||
|
|
||||||
/obj/machinery/smartfridge/drying_rack/Topic(href, list/href_list)
|
var/listofitems = list()
|
||||||
..()
|
for (var/I in src)
|
||||||
if(href_list["dry"])
|
var/atom/movable/O = I
|
||||||
toggle_drying(FALSE)
|
|
||||||
updateUsrDialog()
|
if (listofitems[O.name])
|
||||||
update_icon()
|
listofitems[O.name]["amount"]++
|
||||||
|
else
|
||||||
|
listofitems[O.name] = list("name" = O.name, "type" = O.type, "amount" = 1)
|
||||||
|
sortList(listofitems)
|
||||||
|
|
||||||
|
.["contents"] = listofitems
|
||||||
|
.["name"] = name
|
||||||
|
.["isdryer"] = TRUE
|
||||||
|
.["verb"] = "Take"
|
||||||
|
.["drying"] = drying
|
||||||
|
|
||||||
|
|
||||||
|
/obj/machinery/smartfridge/drying_rack/ui_act(action, params)
|
||||||
|
. = ..()
|
||||||
|
if(.)
|
||||||
|
return
|
||||||
|
switch(action)
|
||||||
|
if("Dry")
|
||||||
|
toggle_drying(FALSE)
|
||||||
|
return TRUE
|
||||||
|
return FALSE
|
||||||
|
|
||||||
/obj/machinery/smartfridge/drying_rack/power_change()
|
/obj/machinery/smartfridge/drying_rack/power_change()
|
||||||
if(powered() && anchored)
|
if(powered() && anchored)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+16
-16
File diff suppressed because one or more lines are too long
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
<ui-display title='Storage' button>
|
||||||
|
{{#partial button}}
|
||||||
|
{{#if data.isdryer}}<ui-button icon='{{data.drying ? "stop" : "tint"}}' action='Dry'>{{data.drying ? 'Stop drying' : 'Dry'}}</ui-button>{{/if}}
|
||||||
|
{{/partial}}
|
||||||
|
{{#if data.contents.length == 0}}
|
||||||
|
<ui-notice>
|
||||||
|
<span>Unfortunately, this {{data.name}} is empty.</span>
|
||||||
|
</ui-notice>
|
||||||
|
{{else}}
|
||||||
|
<div class="display tabular">
|
||||||
|
<section class="candystripe">
|
||||||
|
<section class="cell bold">
|
||||||
|
Item
|
||||||
|
</section>
|
||||||
|
<section class="cell bold">
|
||||||
|
Quantity
|
||||||
|
</section>
|
||||||
|
<section class="cell bold" align='center'>
|
||||||
|
{{#if data.verb}}{{data.verb}}{{else}}Dispense{{/if}}
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
{{#each data.contents}}
|
||||||
|
<section class="candystripe">
|
||||||
|
<section class="cell">
|
||||||
|
{{name}}
|
||||||
|
</section>
|
||||||
|
<section class="cell" align='right'>
|
||||||
|
{{amount}}
|
||||||
|
</section>
|
||||||
|
<section class="table" alight='right'>
|
||||||
|
<section class="cell"></section>
|
||||||
|
<section class="cell">
|
||||||
|
<ui-button grid action='Release' state={{(amount >= 1) ? null : 'disabled'}} params='{ "name" : {{name}}, "amount" : 1 }' >
|
||||||
|
One
|
||||||
|
</ui-button>
|
||||||
|
</section>
|
||||||
|
<section class="cell">
|
||||||
|
<ui-button grid action='Release' state={{(amount > 1) ? null : 'disabled'}} params='{ "name" : {{name}} }' >
|
||||||
|
Many
|
||||||
|
</ui-button>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</ui-display>
|
||||||
Reference in New Issue
Block a user