mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
TGUI Civilian
UI's Converted: - Aurora Cooking - Chaplain Book Selection - ColorMate - Cryo Storage - Holodeck - Jukebox - Looking Glass - Microwave - Newscasters - Timeclock - Vending Machine Improvements
This commit is contained in:
@@ -81,6 +81,30 @@
|
||||
else
|
||||
to_chat(user, "<span class='notice>'It is empty.</span>")
|
||||
|
||||
/obj/machinery/appliance/proc/report_progress_tgui(datum/cooking_item/CI)
|
||||
if(!CI || !CI.max_cookwork)
|
||||
return list("average", "Not Cooking.")
|
||||
|
||||
if(!CI.cookwork)
|
||||
return list("blue", "Cold.")
|
||||
|
||||
var/progress = CI.cookwork / CI.max_cookwork
|
||||
|
||||
if (progress < 0.25)
|
||||
return list("blue", "It's barely started cooking.")
|
||||
if (progress < 0.75)
|
||||
return list("average", "It's cooking away nicely.")
|
||||
if (progress < 1)
|
||||
return list("good", "It's almost ready!")
|
||||
|
||||
var/half_overcook = (CI.overcook_mult - 1)*0.5
|
||||
if (progress < 1+half_overcook)
|
||||
return list("good", "It's done!")
|
||||
if (progress < CI.overcook_mult)
|
||||
return list("bad", "It looks overcooked, get it out!")
|
||||
else
|
||||
return list("bad", "It is burning!")
|
||||
|
||||
/obj/machinery/appliance/proc/report_progress(var/datum/cooking_item/CI)
|
||||
if (!CI || !CI.max_cookwork)
|
||||
return null
|
||||
@@ -240,28 +264,28 @@
|
||||
/obj/machinery/appliance/attackby(var/obj/item/I, var/mob/user)
|
||||
if(!cook_type || (stat & (BROKEN)))
|
||||
to_chat(user, "<span class='warning'>\The [src] is not working.</span>")
|
||||
return
|
||||
return FALSE
|
||||
|
||||
var/result = can_insert(I, user)
|
||||
if(!result)
|
||||
if(!(default_deconstruction_screwdriver(user, I)))
|
||||
default_part_replacement(user, I)
|
||||
return
|
||||
return FALSE
|
||||
|
||||
if(result == 2)
|
||||
var/obj/item/weapon/grab/G = I
|
||||
if (G && istype(G) && G.affecting)
|
||||
cook_mob(G.affecting, user)
|
||||
return
|
||||
return FALSE
|
||||
|
||||
//From here we can start cooking food
|
||||
add_content(I, user)
|
||||
. = add_content(I, user)
|
||||
update_icon()
|
||||
|
||||
//Override for container mechanics
|
||||
/obj/machinery/appliance/proc/add_content(var/obj/item/I, var/mob/user)
|
||||
if(!user.unEquip(I))
|
||||
return
|
||||
return FALSE
|
||||
|
||||
var/datum/cooking_item/CI = has_space(I)
|
||||
if (istype(I, /obj/item/weapon/reagent_containers/cooking_container) && CI == 1)
|
||||
@@ -271,13 +295,13 @@
|
||||
cooking_objs.Add(CI)
|
||||
user.visible_message("<span class='notice'>\The [user] puts \the [I] into \the [src].</span>")
|
||||
if (CC.check_contents() == 0)//If we're just putting an empty container in, then dont start any processing.
|
||||
return
|
||||
return TRUE
|
||||
else
|
||||
if (CI && istype(CI))
|
||||
I.forceMove(CI.container)
|
||||
|
||||
else //Something went wrong
|
||||
return
|
||||
return FALSE
|
||||
|
||||
if (selected_option)
|
||||
CI.combine_target = selected_option
|
||||
@@ -549,11 +573,11 @@
|
||||
FA.alarm()
|
||||
|
||||
/obj/machinery/appliance/attack_hand(var/mob/user)
|
||||
if (cooking_objs.len)
|
||||
if (removal_menu(user))
|
||||
return
|
||||
else
|
||||
..()
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(cooking_objs.len)
|
||||
removal_menu(user)
|
||||
|
||||
/obj/machinery/appliance/proc/removal_menu(var/mob/user)
|
||||
if (can_remove_items(user))
|
||||
@@ -571,7 +595,7 @@
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/appliance/proc/can_remove_items(var/mob/user)
|
||||
/obj/machinery/appliance/proc/can_remove_items(var/mob/user, show_warning = TRUE)
|
||||
if (!Adjacent(user))
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -14,6 +14,63 @@
|
||||
mobdamagetype = BURN
|
||||
can_burn_food = TRUE
|
||||
|
||||
/obj/machinery/appliance/cooker/attack_hand(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/appliance/cooker/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "CookingAppliance", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/appliance/cooker/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
|
||||
var/list/data = ..()
|
||||
|
||||
data["temperature"] = round(temperature - T0C, 0.1)
|
||||
data["optimalTemp"] = round(optimal_temp - T0C, 0.1)
|
||||
data["temperatureEnough"] = temperature >= min_temp
|
||||
data["efficiency"] = round(get_efficiency(), 0.1)
|
||||
data["containersRemovable"] = can_remove_items(user, show_warning = FALSE)
|
||||
|
||||
var/list/our_contents = list()
|
||||
for(var/i in 1 to max_contents)
|
||||
our_contents += list(list("empty" = TRUE))
|
||||
if(i <= LAZYLEN(cooking_objs))
|
||||
var/datum/cooking_item/CI = cooking_objs[i]
|
||||
if(istype(CI))
|
||||
our_contents[i] = list()
|
||||
our_contents[i]["progress"] = 0
|
||||
our_contents[i]["progressText"] = report_progress_tgui(CI)
|
||||
if(CI.max_cookwork)
|
||||
our_contents[i]["progress"] = CI.cookwork / CI.max_cookwork
|
||||
if(CI.container)
|
||||
our_contents[i]["container"] = CI.container.label(i)
|
||||
else
|
||||
our_contents[i]["container"] = null
|
||||
data["our_contents"] = our_contents
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/appliance/cooker/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("slot")
|
||||
var/slot = params["slot"]
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(slot <= LAZYLEN(cooking_objs)) // Inserting
|
||||
var/datum/cooking_item/CI = cooking_objs[slot]
|
||||
|
||||
if(istype(I) && can_insert(I)) // Why do hard work when we can just make them smack us?
|
||||
attackby(I, usr)
|
||||
else if(istype(CI))
|
||||
eject(CI, usr)
|
||||
return TRUE
|
||||
if(istype(I)) // Why do hard work when we can just make them smack us?
|
||||
attackby(I, usr)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/appliance/cooker/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(.) //no need to duplicate adjacency check
|
||||
@@ -141,6 +198,6 @@
|
||||
|
||||
/obj/machinery/appliance/cooker/add_content(var/obj/item/I, var/mob/user)
|
||||
var/datum/cooking_item/CI = ..()
|
||||
if (CI && CI.combine_target)
|
||||
if(istype(CI) && CI.combine_target)
|
||||
to_chat(user, "\The [I] will be used to make a [selected_option]. Output selection is returned to default for future items.")
|
||||
selected_option = null
|
||||
@@ -68,11 +68,13 @@ fundamental differences
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/appliance/mixer/can_remove_items(var/mob/user)
|
||||
if (stat)
|
||||
/obj/machinery/appliance/mixer/can_remove_items(var/mob/user, show_warning = TRUE)
|
||||
if(stat)
|
||||
return 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You can't remove ingredients while it's turned on! Turn it off first or wait for it to finish.</span>")
|
||||
if(show_warning)
|
||||
to_chat(user, "<span class='warning'>You can't remove ingredients while it's turned on! Turn it off first or wait for it to finish.</span>")
|
||||
return 0
|
||||
|
||||
//Container is not removable
|
||||
/obj/machinery/appliance/mixer/removal_menu(var/mob/user)
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
cooking = FALSE
|
||||
|
||||
playsound(src, 'sound/machines/hatch_open.ogg', 20, 1)
|
||||
to_chat(user, "<span class='notice'>You [open? "close":"open"] the oven door</span>")
|
||||
to_chat(user, "<span class='notice'>You [open ? "open" : "close"] the oven door.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/appliance/cooker/oven/proc/manip(var/obj/item/I)
|
||||
@@ -133,9 +133,10 @@
|
||||
if(temperature > T.temperature)
|
||||
equalize_temperature()
|
||||
|
||||
/obj/machinery/appliance/cooker/oven/can_remove_items(var/mob/user)
|
||||
/obj/machinery/appliance/cooker/oven/can_remove_items(var/mob/user, show_warning = TRUE)
|
||||
if(!open)
|
||||
to_chat(user, "<span class='warning'>You can't take anything out while the door is closed!</span>")
|
||||
if(show_warning)
|
||||
to_chat(user, "<span class='warning'>You can't take anything out while the door is closed!</span>")
|
||||
return 0
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user