cleans up some more update Dialog (#19208)

* cleans up some more update Dialog

* .

* pod UI

* .

* modern rcon console

* .

* no dupe tags

* .

* nbeeds a recode

* .

* .

* ice cream as tgui

* ,

* legacy drone fab

* more a POI object

* .

* missing dels

* navbeacon

* eh that is part of the default now

* del useless list

* .

* .

* .

* retail scanner

* better

* finish retail

* .

* be gone

* .

* .
This commit is contained in:
Kashargul
2026-03-02 11:43:21 +01:00
committed by GitHub
parent c1b3d2050c
commit 0fd2c24268
51 changed files with 1841 additions and 1052 deletions
+4 -1
View File
@@ -124,11 +124,14 @@
if(!selection)
return
var/mob/M = selection:mob
var/turf/target_turf = get_turf(M)
if(!target_turf)
return
log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
usr.on_mob_jump()
usr.reset_perspective(usr)
usr.forceMove(get_turf(M))
usr.forceMove(target_turf)
feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
tgui_alert_async(usr, "Admin jumping disabled")
+181 -196
View File
@@ -45,7 +45,6 @@
else
. += "It's completely empty."
/obj/machinery/cash_register/attack_hand(mob/user)
// Don't be accessible from the wrong side of the machine
if(get_dir(src, user) & GLOB.reverse_dir[src.dir]) return
@@ -55,131 +54,149 @@
spawn_money(cash_stored, loc, user)
cash_stored = 0
cut_overlay("register_cash")
else
open_cash_box()
else
user.set_machine(src)
interact(user)
return
open_cash_box(user)
return
tgui_interact(user)
/obj/machinery/cash_register/click_alt(mob/user)
if(Adjacent(user))
open_cash_box()
open_cash_box(user)
/obj/machinery/cash_register/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, custom_state)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "RetailScanner", name)
ui.open()
/obj/machinery/cash_register/interact(mob/user)
var/dat = "<html><h2>Cash Register<hr></h2>"
if (locked)
dat += "<a href='byond://?src=\ref[src];choice=toggle_lock'>Unlock</a><br>"
dat += "Linked account: " + span_bold("[linked_account ? linked_account.owner_name : "None"]") + "<br>"
dat += span_bold("[cash_locked? "Unlock" : "Lock"] Cash Box") + " | "
else
dat += "<a href='byond://?src=\ref[src];choice=toggle_lock'>Lock</a><br>"
dat += "Linked account: <a href='byond://?src=\ref[src];choice=link_account'>[linked_account ? linked_account.owner_name : "None"]</a><br>"
dat += "<a href='byond://?src=\ref[src];choice=toggle_cash_lock'>[cash_locked? "Unlock" : "Lock"] Cash Box</a> | "
dat += "<a href='byond://?src=\ref[src];choice=custom_order'>Custom Order</a><hr>"
/obj/machinery/cash_register/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
return list(
"locked" = locked,
"cash_locked" = cash_locked,
"linked_account" = linked_account?.owner_name,
"machine_id" = machine_id,
"transaction_logs" = transaction_logs,
"current_transactioon" = get_current_transaction()
)
if(item_list.len)
dat += get_current_transaction()
dat += "<br>"
for(var/i=transaction_logs.len, i>=1, i--)
dat += "[transaction_logs[i]]<br>"
if(transaction_logs.len)
dat += locked ? "<br>" : "<a href='byond://?src=\ref[src];choice=reset_log'>Reset Log</a><br>"
dat += "<br>"
dat += "<i>Device ID:</i> [machine_id]</html>"
user << browse(dat, "window=cash_register;size=350x500")
onclose(user, "cash_register")
/obj/machinery/cash_register/Topic(var/href, var/href_list)
if(..())
/obj/machinery/cash_register/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
usr.set_machine(src)
add_fingerprint(usr)
if(href_list["choice"])
switch(href_list["choice"])
if("toggle_lock")
if(allowed(usr))
locked = !locked
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("Insufficient access."))
if("toggle_cash_lock")
cash_locked = !cash_locked
if("link_account")
var/attempt_account_num = tgui_input_number(usr, "Enter account number", "New account number")
var/attempt_pin = tgui_input_number(usr, "Enter PIN", "Account PIN")
linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1)
if(linked_account)
if(linked_account.suspended)
linked_account = null
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Account has been suspended."))
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("Account not found."))
if("custom_order")
var/t_purpose = tgui_input_text(usr, "Enter purpose", "New purpose", "", MAX_MESSAGE_LEN)
if (!t_purpose || !Adjacent(usr)) return
transaction_purpose = t_purpose
item_list += t_purpose
var/t_amount = round(tgui_input_number(usr, "Enter price", "New price"))
if (!t_amount || !Adjacent(usr) || t_amount < 0) return
transaction_amount += t_amount
price_list += t_amount
playsound(src, 'sound/machines/twobeep.ogg', 25)
src.visible_message("[icon2html(src,viewers(src))][transaction_purpose]: [t_amount] Thaler\s.")
if("set_amount")
var/item_name = locate(href_list["item"])
var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount", 0, 20, 0))
n_amount = CLAMP(n_amount, 0, 20)
if (!item_list[item_name] || !Adjacent(usr)) return
transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name]
if(!n_amount)
item_list -= item_name
price_list -= item_name
else
item_list[item_name] = n_amount
if("subtract")
var/item_name = locate(href_list["item"])
if(item_name)
transaction_amount -= price_list[item_name]
item_list[item_name]--
if(item_list[item_name] <= 0)
item_list -= item_name
price_list -= item_name
if("add")
var/item_name = locate(href_list["item"])
if(item_list[item_name] >= 20) return
transaction_amount += price_list[item_name]
item_list[item_name]++
if("clear")
var/item_name = locate(href_list["item"])
if(item_name)
transaction_amount -= price_list[item_name] * item_list[item_name]
item_list -= item_name
price_list -= item_name
else
transaction_amount = 0
item_list.Cut()
price_list.Cut()
if("reset_log")
transaction_logs.Cut()
to_chat(usr, "[icon2html(src, usr.client)]" + span_notice("Transaction log reset."))
updateDialog()
switch(action)
if("toggle_lock")
if(allowed(ui.user))
locked = !locked
return TRUE
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("Insufficient access."))
return FALSE
return access_action(action, params, ui.user)
/obj/machinery/cash_register/proc/access_action(action, list/params, mob/user)
if(locked)
return FALSE
switch(action)
if("toggle_cash_lock")
cash_locked = !cash_locked
if("link_account")
var/attempt_account_num = text2num(params["name"])
if(isnull(attempt_account_num))
return FALSE
var/attempt_pin = text2num(params["pin"])
if(isnull(attempt_pin))
return FALSE
linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1)
if(linked_account)
if(linked_account.suspended)
linked_account = null
visible_message("[icon2html(src, viewers(src))]" + span_warning("Account has been suspended."))
return FALSE
return TRUE
to_chat(user, "[icon2html(src, user.client)]" + span_warning("Account not found."))
return FALSE
if("custom_order")
var/t_purpose = sanitize(params["purpose"], 200)
if (!t_purpose)
return FALSE
transaction_purpose = t_purpose
var/amount = params["amount"]
if(!isnum(amount))
return FALSE
amount = CLAMP(amount, 1, 20)
item_list[t_purpose] = amount
var/price = params["price"]
if (!price)
return FALSE
transaction_amount += amount * price
price_list[t_purpose] = price
playsound(src, 'sound/machines/twobeep.ogg', 25)
visible_message("[icon2html(src, viewers(src))][transaction_purpose][amount > 1 ? "[amount] x" : ""]: [amount * price] Thaler\s.")
return TRUE
if("set_amount")
var/item_name = params["item"]
if(!item_name)
return FALSE
var/n_amount = text2num(params["amount"])
if(!isnum(n_amount))
return FALSE
n_amount = CLAMP(n_amount, 0, 20)
if(!item_list[item_name])
return FALSE
transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name]
if(!n_amount)
item_list -= item_name
price_list -= item_name
return TRUE
item_list[item_name] = n_amount
return TRUE
if("subtract")
var/item_name = params["item"]
if(!item_name)
return FALSE
transaction_amount -= price_list[item_name]
item_list[item_name]--
if(item_list[item_name] <= 0)
item_list -= item_name
price_list -= item_name
return TRUE
if("add")
var/item_name = params["item"]
if(!item_name)
return FALSE
if(item_list[item_name] >= 20)
return FALSE
transaction_amount += price_list[item_name]
item_list[item_name]++
return TRUE
if("clear")
var/item_name = params["item"]
if(!item_name)
return FALSE
transaction_amount -= price_list[item_name] * item_list[item_name]
item_list -= item_name
price_list -= item_name
return TRUE
if("clear_entry")
transaction_amount = 0
item_list.Cut()
price_list.Cut()
return TRUE
if("reset_log")
transaction_logs.Cut()
to_chat(user, "[icon2html(src, user.client)]" + span_notice("Transaction log reset."))
return TRUE
/obj/machinery/cash_register/attackby(obj/item/O, mob/user)
// Check for a method of paying (ID, PDA, e-wallet, cash, ect.)
var/obj/item/card/id/I = O.GetID()
if(I)
scan_card(I, O)
scan_card(I, O, user)
else if (istype(O, /obj/item/spacecash/ewallet))
var/obj/item/spacecash/ewallet/E = O
scan_wallet(E)
scan_wallet(E, user)
else if (istype(O, /obj/item/spacecash))
var/obj/item/spacecash/SC = O
if(cash_open)
@@ -191,7 +208,7 @@
H.drop_from_inventory(SC)
qdel(SC)
else
scan_cash(SC)
scan_cash(SC, user)
else if(istype(O, /obj/item/card/emag))
return ..()
else if(istype(O) && O.has_tool_quality(TOOL_WRENCH))
@@ -199,7 +216,7 @@
toggle_anchors(W, user)
// Not paying: Look up price and add it to transaction_amount
else
scan_item_price(O)
scan_item_price(O, user)
/obj/machinery/cash_register/MouseDrop_T(atom/dropping, mob/user)
@@ -219,39 +236,39 @@
return 0
/obj/machinery/cash_register/proc/scan_card(obj/item/card/id/I, obj/item/ID_container)
/obj/machinery/cash_register/proc/scan_card(obj/item/card/id/I, obj/item/ID_container, mob/user)
if (!transaction_amount)
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("The cash box is open."))
to_chat(user, "[icon2html(src, user.client)]" + span_warning("The cash box is open."))
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(I))
return
if (!linked_account)
usr.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to connect to linked account."))
user.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to connect to linked account."))
return
// Access account for transaction
if(check_account())
if(check_account(user))
var/datum/money_account/D = get_account(I.associated_account_number)
var/attempt_pin = ""
if(D && D.security_level)
attempt_pin = tgui_input_number(usr, "Enter PIN", "Transaction")
attempt_pin = tgui_input_number(user, "Enter PIN", "Transaction")
D = null
D = attempt_account_access(I.associated_account_number, attempt_pin, 2)
if(!D)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to access account. Check security settings and try again."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to access account. Check security settings and try again."))
else
if(D.suspended)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Your account has been suspended."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Your account has been suspended."))
else
if(transaction_amount > D.money)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Not enough funds."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Not enough funds."))
else
// Transfer the money
D.money -= transaction_amount
@@ -283,21 +300,20 @@
// Confirm and reset
transaction_complete()
/obj/machinery/cash_register/proc/scan_wallet(obj/item/spacecash/ewallet/E)
/obj/machinery/cash_register/proc/scan_wallet(obj/item/spacecash/ewallet/E, mob/user)
if (!transaction_amount)
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("The cash box is open."))
to_chat(user, "[icon2html(src, user.client)]" + span_warning("The cash box is open."))
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(E))
return
// Access account for transaction
if(check_account())
if(check_account(user))
if(transaction_amount > E.worth)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Not enough funds."))
else
@@ -321,21 +337,20 @@
// Confirm and reset
transaction_complete()
/obj/machinery/cash_register/proc/scan_cash(obj/item/spacecash/SC)
/obj/machinery/cash_register/proc/scan_cash(obj/item/spacecash/SC, mob/user)
if (!transaction_amount)
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("The cash box is open."))
to_chat(user, "[icon2html(src, user.client)]" + span_warning("The cash box is open."))
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(SC))
return
if(transaction_amount > SC.worth)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Not enough money."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Not enough money."))
else
// Insert cash into magical slot
SC.worth -= transaction_amount
@@ -353,24 +368,23 @@
// Confirm and reset
transaction_complete()
/obj/machinery/cash_register/proc/scan_item_price(obj/O)
/obj/machinery/cash_register/proc/scan_item_price(obj/O, mob/user)
if(!istype(O)) return
if(item_list.len > 10)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Only up to ten different items allowed per purchase."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Only up to ten different items allowed per purchase."))
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("The cash box is open."))
to_chat(user, "[icon2html(src, user.client)]" + span_warning("The cash box is open."))
return
// First check if item has a valid price
var/price = O.get_item_cost()
if(isnull(price))
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to find item in database."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to find item in database."))
return
// Call out item cost
src.visible_message("[icon2html(src,viewers(src))]\A [O]: [price ? "[price] Thaler\s" : "free of charge"].")
src.visible_message("[icon2html(src, viewers(src))]\A [O]: [price ? "[price] Thaler\s" : "free of charge"].")
// Note the transaction purpose for later use
if(transaction_purpose)
transaction_purpose += "<br>"
@@ -387,74 +401,48 @@
playsound(src, 'sound/machines/twobeep.ogg', 25)
// Reset confirmation
confirm_item = null
updateDialog()
/obj/machinery/cash_register/proc/get_current_transaction()
var/dat = {"
<head><style>
.tx-title-r {text-align: center; background-color:#ffdddd; font-weight: bold}
.tx-name-r {background-color: #eebbbb}
.tx-data-r {text-align: right; background-color: #ffcccc;}
</head></style>
<table width=300>
<tr><td colspan="2" class="tx-title-r">New Entry</td></tr>
<tr></tr>"}
var/item_name
for(var/i=1, i<=item_list.len, i++)
item_name = item_list[i]
dat += "<tr><td class=\"tx-name-r\">[item_list[item_name] ? "<a href='byond://?src=\ref[src];choice=subtract;item=\ref[item_name]'>-</a> <a href='byond://?src=\ref[src];choice=set_amount;item=\ref[item_name]'>Set</a> <a href='byond://?src=\ref[src];choice=add;item=\ref[item_name]'>+</a> [item_list[item_name]] x " : ""][item_name] <a href='byond://?src=\ref[src];choice=clear;item=\ref[item_name]'>Remove</a></td><td class=\"tx-data-r\" width=50>[price_list[item_name] * item_list[item_name]] &thorn</td></tr>"
dat += "</table><table width=300>"
dat += "<tr><td class=\"tx-name-r\"><a href='byond://?src=\ref[src];choice=clear'>Clear Entry</a></td><td class=\"tx-name-r\" style='text-align: right'>" + span_bold("Total Amount: [transaction_amount] &thorn") + "</td></tr>"
dat += "</table></html>"
return dat
if(!length(item_list))
return list()
var/list/current_transactioon = list(
"items" = item_list,
"prices" = price_list,
"amount" = transaction_amount,
)
return current_transactioon
/obj/machinery/cash_register/proc/add_transaction_log(c_name, p_method, t_amount)
var/list/new_entry = list(
"log_id" = length(transaction_logs) + 1,
"customer" = c_name,
"payment_method" = p_method,
"trans_time" = stationtime2text(),
"items" = item_list,
"prices" = price_list,
"amount" = transaction_amount
)
UNTYPED_LIST_ADD(transaction_logs, new_entry)
/obj/machinery/cash_register/proc/add_transaction_log(var/c_name, var/p_method, var/t_amount)
var/dat = {"
<head><style>
.tx-title {text-align: center; background-color:#ddddff; font-weight: bold}
.tx-name {background-color: #bbbbee}
.tx-data {text-align: right; background-color: #ccccff;}
</head></style>
<table width=300>
<tr><td colspan="2" class="tx-title">Transaction #[transaction_logs.len+1]</td></tr>
<tr></tr>
<tr><td class="tx-name">Customer</td><td class="tx-data">[c_name]</td></tr>
<tr><td class="tx-name">Pay Method</td><td class="tx-data">[p_method]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[stationtime2text()]</td></tr>
</table>
<table width=300>
"}
var/item_name
for(var/i=1, i<=item_list.len, i++)
item_name = item_list[i]
dat += "<tr><td class=\"tx-name\">[item_list[item_name] ? "[item_list[item_name]] x " : ""][item_name]</td><td class=\"tx-data\" width=50>[price_list[item_name] * item_list[item_name]] &thorn</td></tr>"
dat += "<tr></tr><tr><td colspan=\"2\" class=\"tx-name\" style='text-align: right'>" + span_bold("Total Amount: [transaction_amount] &thorn") + "</td></tr>"
dat += "</table></html>"
transaction_logs += dat
/obj/machinery/cash_register/proc/check_account()
/obj/machinery/cash_register/proc/check_account(mob/user)
if (!linked_account)
usr.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to connect to linked account."))
return 0
user.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to connect to linked account."))
return FALSE
if(linked_account.suspended)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Connected account has been suspended."))
return 0
return 1
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Connected account has been suspended."))
return FALSE
return TRUE
/obj/machinery/cash_register/proc/transaction_complete()
/// Visible confirmation
playsound(src, 'sound/machines/chime.ogg', 25)
src.visible_message("[icon2html(src,viewers(src))]" + span_notice("Transaction complete."))
src.visible_message("[icon2html(src, viewers(src))]" + span_notice("Transaction complete."))
flick("register_approve", src)
reset_memory()
updateDialog()
/obj/machinery/cash_register/proc/reset_memory()
transaction_amount = null
@@ -463,14 +451,13 @@
price_list.Cut()
confirm_item = null
/obj/machinery/cash_register/verb/open_cash_box()
/obj/machinery/cash_register/verb/open_cash_box(mob/user)
set category = "Object"
set name = "Open Cash Box"
set desc = "Open/closes the register's cash box."
set src in view(1)
if(usr.stat) return
if(user.stat) return
if(cash_open)
cash_open = 0
@@ -484,7 +471,7 @@
if(cash_stored)
add_overlay("register_cash")
else
to_chat(usr, span_warning("The cash box is locked."))
to_chat(user, span_warning("The cash box is locked."))
/obj/machinery/cash_register/proc/toggle_anchors(obj/item/tool/wrench/W, mob/user)
@@ -510,9 +497,7 @@
manipulating = 0
return
/obj/machinery/cash_register/emag_act(var/remaining_charges, var/mob/user)
/obj/machinery/cash_register/emag_act(remaining_charges, mob/user)
if(!emagged)
src.visible_message(span_danger("The [src]'s cash box springs open as [user] swipes the card through the scanner!"))
playsound(src, "sparks", 50, 1)
@@ -520,7 +505,7 @@
emagged = 1
locked = 0
cash_locked = 0
open_cash_box()
open_cash_box(user)
//--Premades--//
+172 -188
View File
@@ -13,7 +13,7 @@
var/emagged = 0
var/machine_id = ""
var/transaction_amount = 0 // cumulatd amount of money to pay in a single purchase
var/transaction_purpose = null // text that gets used in ATM transaction logs
var/transaction_purpose = "" // text that gets used in ATM transaction logs
var/list/transaction_logs = list() // list of strings using html code to visualise data
var/list/item_list = list() // entities and according
var/list/price_list = list() // prices for each purchase
@@ -22,7 +22,6 @@
var/datum/money_account/linked_account
var/account_to_connect = null
// Claim machine ID
/obj/item/retail_scanner/Initialize(mapload)
. = ..()
@@ -31,7 +30,6 @@
pixel_y = 3
GLOB.transaction_devices += src // Global reference list to be properly set up by /proc/setup_economy()
/obj/item/retail_scanner/Destroy()
GLOB.transaction_devices -= src
. = ..()
@@ -50,133 +48,149 @@
src.dir = SOUTH
src.pixel_y = 0
/obj/item/retail_scanner/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
user.set_machine(src)
interact(user)
tgui_interact(user)
/obj/item/retail_scanner/click_alt(var/mob/user)
/obj/item/retail_scanner/click_alt(mob/user)
if(Adjacent(user))
user.set_machine(src)
interact(user)
tgui_interact(user)
/obj/item/retail_scanner/examine(mob/user as mob)
/obj/item/retail_scanner/examine(mob/user)
. = ..()
if(transaction_amount)
. += "It has a purchase of [transaction_amount] pending[transaction_purpose ? " for [transaction_purpose]" : ""]."
/obj/item/retail_scanner/interact(mob/user as mob)
var/dat = "<h2>Retail Scanner<hr></h2>"
if (locked)
dat += "<a href='byond://?src=\ref[src];choice=toggle_lock'>Unlock</a><br>"
dat += "Linked account: <b>[linked_account ? linked_account.owner_name : "None"]</b><br>"
else
dat += "<a href='byond://?src=\ref[src];choice=toggle_lock'>Lock</a><br>"
dat += "Linked account: <a href='byond://?src=\ref[src];choice=link_account'>[linked_account ? linked_account.owner_name : "None"]</a><br>"
dat += "<a href='byond://?src=\ref[src];choice=custom_order'>Custom Order</a><hr>"
/obj/item/retail_scanner/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, custom_state)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "RetailScanner", name)
ui.open()
if(item_list.len)
dat += get_current_transaction()
dat += "<br>"
/obj/item/retail_scanner/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
return list(
"locked" = locked,
"linked_account" = linked_account?.owner_name,
"machine_id" = machine_id,
"transaction_logs" = transaction_logs,
"current_transactioon" = get_current_transaction()
)
for(var/i=transaction_logs.len, i>=1, i--)
dat += "[transaction_logs[i]]<br>"
if(transaction_logs.len)
dat += locked ? "<br>" : "<a href='byond://?src=\ref[src];choice=reset_log'>Reset Log</a><br>"
dat += "<br>"
dat += "<i>Device ID:</i> [machine_id]"
var/datum/browser/popup = new(user, "retail", "Retail", 350, 500)
popup.add_head_content("<title>Retail Scanner</title>")
popup.set_content(dat)
popup.open()
/obj/item/retail_scanner/Topic(var/href, var/href_list)
if(..())
/obj/item/retail_scanner/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
usr.set_machine(src)
add_fingerprint(usr)
if(href_list["choice"])
switch(href_list["choice"])
if("toggle_lock")
if(allowed(usr))
locked = !locked
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("Insufficient access."))
if("link_account")
var/attempt_account_num = tgui_input_number(usr, "Enter account number", "New account number")
var/attempt_pin = tgui_input_number(usr, "Enter PIN", "Account PIN")
linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1)
if(linked_account)
if(linked_account.suspended)
linked_account = null
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Account has been suspended."))
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("Account not found."))
if("custom_order")
var/t_purpose = tgui_input_text(usr, "Enter purpose", "New purpose", "", MAX_MESSAGE_LEN)
if (!t_purpose || !Adjacent(usr)) return
transaction_purpose = t_purpose
item_list += t_purpose
var/t_amount = round(tgui_input_number(usr, "Enter price", "New price"))
if (!t_amount || !Adjacent(usr)) return
transaction_amount += t_amount
price_list += t_amount
playsound(src, 'sound/machines/twobeep.ogg', 25)
src.visible_message("[icon2html(src,viewers(src))][transaction_purpose]: [t_amount] Thaler\s.")
if("set_amount")
var/item_name = locate(href_list["item"])
var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount", 0, 20, 0))
n_amount = CLAMP(n_amount, 0, 20)
if (!item_list[item_name] || !Adjacent(usr)) return
transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name]
if(!n_amount)
item_list -= item_name
price_list -= item_name
else
item_list[item_name] = n_amount
if("subtract")
var/item_name = locate(href_list["item"])
if(item_name)
transaction_amount -= price_list[item_name]
item_list[item_name]--
if(item_list[item_name] <= 0)
item_list -= item_name
price_list -= item_name
if("add")
var/item_name = locate(href_list["item"])
if(item_list[item_name] >= 20) return
transaction_amount += price_list[item_name]
item_list[item_name]++
if("clear")
var/item_name = locate(href_list["item"])
if(item_name)
transaction_amount -= price_list[item_name] * item_list[item_name]
item_list -= item_name
price_list -= item_name
else
transaction_amount = 0
item_list.Cut()
price_list.Cut()
if("reset_log")
transaction_logs.Cut()
to_chat(usr, "[icon2html(src, usr.client)]" + span_notice("Transaction log reset."))
updateDialog()
switch(action)
if("toggle_lock")
if(allowed(ui.user))
locked = !locked
return TRUE
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("Insufficient access."))
return FALSE
return access_action(action, params, ui.user)
/obj/item/retail_scanner/proc/access_action(action, list/params, mob/user)
if(locked)
return FALSE
switch(action)
if("link_account")
var/attempt_account_num = text2num(params["name"])
if(isnull(attempt_account_num))
return FALSE
var/attempt_pin = text2num(params["pin"])
if(isnull(attempt_pin))
return FALSE
linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1)
if(linked_account)
if(linked_account.suspended)
linked_account = null
visible_message("[icon2html(src, viewers(src))]" + span_warning("Account has been suspended."))
return FALSE
return TRUE
to_chat(user, "[icon2html(src, user.client)]" + span_warning("Account not found."))
return FALSE
if("custom_order")
var/t_purpose = sanitize(params["purpose"], 200)
if (!t_purpose)
return FALSE
transaction_purpose = t_purpose
var/amount = params["amount"]
if(!isnum(amount))
return FALSE
amount = CLAMP(amount, 1, 20)
item_list[t_purpose] = amount
var/price = params["price"]
if (!price)
return FALSE
transaction_amount += amount * price
price_list[t_purpose] = price
playsound(src, 'sound/machines/twobeep.ogg', 25)
visible_message("[icon2html(src, viewers(src))][transaction_purpose][amount > 1 ? "[amount] x" : ""]: [amount * price] Thaler\s.")
return TRUE
if("set_amount")
var/item_name = params["item"]
if(!item_name)
return FALSE
var/n_amount = text2num(params["amount"])
if(!isnum(n_amount))
return FALSE
n_amount = CLAMP(n_amount, 0, 20)
if(!item_list[item_name])
return FALSE
transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name]
if(!n_amount)
item_list -= item_name
price_list -= item_name
return TRUE
item_list[item_name] = n_amount
return TRUE
if("subtract")
var/item_name = params["item"]
if(!item_name)
return FALSE
transaction_amount -= price_list[item_name]
item_list[item_name]--
if(item_list[item_name] <= 0)
item_list -= item_name
price_list -= item_name
return TRUE
if("add")
var/item_name = params["item"]
if(!item_name)
return FALSE
if(item_list[item_name] >= 20)
return FALSE
transaction_amount += price_list[item_name]
item_list[item_name]++
return TRUE
if("clear")
var/item_name = params["item"]
if(!item_name)
return FALSE
transaction_amount -= price_list[item_name] * item_list[item_name]
item_list -= item_name
price_list -= item_name
return TRUE
if("clear_entry")
transaction_amount = 0
item_list.Cut()
price_list.Cut()
return TRUE
if("reset_log")
transaction_logs.Cut()
to_chat(user, "[icon2html(src, user.client)]" + span_notice("Transaction log reset."))
return TRUE
/obj/item/retail_scanner/attackby(obj/O, mob/user)
// Check for a method of paying (ID, PDA, e-wallet, cash, ect.)
var/obj/item/card/id/I = O.GetID()
if(I)
scan_card(I, O)
scan_card(I, O, user)
else if (istype(O, /obj/item/spacecash/ewallet))
var/obj/item/spacecash/ewallet/E = O
scan_wallet(E)
@@ -187,33 +201,31 @@
return ..()
// Not paying: Look up price and add it to transaction_amount
else
scan_item_price(O)
scan_item_price(O, user)
/obj/item/retail_scanner/showoff(mob/user)
for (var/mob/M in view(user))
M.show_message("[user] holds up [src]. <a HREF='byond://?src=\ref[M];clickitem=\ref[src]'>Swipe card or item.</a>",1)
/obj/item/retail_scanner/proc/confirm(var/obj/item/I)
/obj/item/retail_scanner/proc/confirm(obj/item/I)
if(confirm_item == I)
return 1
else
confirm_item = I
src.visible_message("[icon2html(src,viewers(src))]<b>Total price:</b> [transaction_amount] Thaler\s. Swipe again to confirm.")
src.visible_message("[icon2html(src, viewers(src))]<b>Total price:</b> [transaction_amount] Thaler\s. Swipe again to confirm.")
playsound(src, 'sound/machines/twobeep.ogg', 25)
return 0
/obj/item/retail_scanner/proc/scan_card(var/obj/item/card/id/I, var/obj/item/ID_container)
/obj/item/retail_scanner/proc/scan_card(obj/item/card/id/I, obj/item/ID_container, mob/user)
if (!transaction_amount)
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(I))
if((length(item_list) > 1 || item_list[item_list[1]] > 1) && !confirm(I))
return
if (!linked_account)
usr.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to connect to linked account."))
user.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to connect to linked account."))
return
// Access account for transaction
@@ -221,18 +233,18 @@
var/datum/money_account/D = get_account(I.associated_account_number)
var/attempt_pin = ""
if(D && D.security_level)
attempt_pin = tgui_input_number(usr, "Enter PIN", "Transaction")
attempt_pin = tgui_input_number(user, "Enter PIN", "Transaction")
D = null
D = attempt_account_access(I.associated_account_number, attempt_pin, 2)
if(!D)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to access account. Check security settings and try again."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to access account. Check security settings and try again."))
else
if(D.suspended)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Your account has been suspended."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Your account has been suspended."))
else
if(transaction_amount > D.money)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Not enough funds."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Not enough funds."))
else
// Transfer the money
D.money -= transaction_amount
@@ -264,18 +276,17 @@
// Confirm and reset
transaction_complete()
/obj/item/retail_scanner/proc/scan_wallet(var/obj/item/spacecash/ewallet/E)
/obj/item/retail_scanner/proc/scan_wallet(obj/item/spacecash/ewallet/E)
if (!transaction_amount)
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(E))
if((length(item_list) > 1 || item_list[item_list[1]] > 1) && !confirm(E))
return
// Access account for transaction
if(check_account())
if(transaction_amount > E.worth)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Not enough funds."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Not enough funds."))
else
// Transfer the money
E.worth -= transaction_amount
@@ -297,20 +308,19 @@
// Confirm and reset
transaction_complete()
/obj/item/retail_scanner/proc/scan_item_price(var/obj/O)
/obj/item/retail_scanner/proc/scan_item_price(obj/O)
if(!istype(O)) return
if(item_list.len > 10)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Only up to ten different items allowed per purchase."))
if(length(item_list) > 10)
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Only up to ten different items allowed per purchase."))
return
// First check if item has a valid price
var/price = O.get_item_cost()
if(isnull(price))
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to find item in database."))
src.visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to find item in database."))
return
// Call out item cost
src.visible_message("[icon2html(src,viewers(src))]\A [O]: [price ? "[price] Thaler\s" : "free of charge"].")
src.visible_message("[icon2html(src, viewers(src))]\A [O]: [price ? "[price] Thaler\s" : "free of charge"].")
// Note the transaction purpose for later use
if(transaction_purpose)
transaction_purpose += "<br>"
@@ -329,72 +339,46 @@
// Reset confirmation
confirm_item = null
/obj/item/retail_scanner/proc/get_current_transaction()
var/dat = {"
<head><style>
.tx-title-r {text-align: center; background-color:#ffdddd; font-weight: bold}
.tx-name-r {background-color: #eebbbb}
.tx-data-r {text-align: right; background-color: #ffcccc;}
</head></style>
<table width=300>
<tr><td colspan="2" class="tx-title-r">New Entry</td></tr>
<tr></tr>"}
var/item_name
for(var/i=1, i<=item_list.len, i++)
item_name = item_list[i]
dat += "<tr><td class=\"tx-name-r\">[item_list[item_name] ? "<a href='byond://?src=\ref[src];choice=subtract;item=\ref[item_name]'>-</a> <a href='byond://?src=\ref[src];choice=set_amount;item=\ref[item_name]'>Set</a> <a href='byond://?src=\ref[src];choice=add;item=\ref[item_name]'>+</a> [item_list[item_name]] x " : ""][item_name] <a href='byond://?src=\ref[src];choice=clear;item=\ref[item_name]'>Remove</a></td><td class=\"tx-data-r\" width=50>[price_list[item_name] * item_list[item_name]] &thorn</td></tr>"
dat += "</table><table width=300>"
dat += "<tr><td class=\"tx-name-r\"><a href='byond://?src=\ref[src];choice=clear'>Clear Entry</a></td><td class=\"tx-name-r\" style='text-align: right'><b>Total Amount: [transaction_amount] &thorn</b></td></tr>"
dat += "</table></html>"
return dat
if(!length(item_list))
return list()
var/list/current_transactioon = list(
"items" = item_list,
"prices" = price_list,
"amount" = transaction_amount,
/obj/item/retail_scanner/proc/add_transaction_log(var/c_name, var/p_method, var/t_amount)
var/dat = {"
<head><style>
.tx-title {text-align: center; background-color:#ddddff; font-weight: bold}
.tx-name {background-color: #bbbbee}
.tx-data {text-align: right; background-color: #ccccff;}
</head></style>
<table width=300>
<tr><td colspan="2" class="tx-title">Transaction #[transaction_logs.len+1]</td></tr>
<tr></tr>
<tr><td class="tx-name">Customer</td><td class="tx-data">[c_name]</td></tr>
<tr><td class="tx-name">Pay Method</td><td class="tx-data">[p_method]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[stationtime2text()]</td></tr>
</table>
<table width=300>
"}
var/item_name
for(var/i=1, i<=item_list.len, i++)
item_name = item_list[i]
dat += "<tr><td class=\"tx-name\">[item_list[item_name] ? "[item_list[item_name]] x " : ""][item_name]</td><td class=\"tx-data\" width=50>[price_list[item_name] * item_list[item_name]] &thorn</td></tr>"
dat += "<tr></tr><tr><td colspan=\"2\" class=\"tx-name\" style='text-align: right'><b>Total Amount: [transaction_amount] &thorn</b></td></tr>"
dat += "</table>"
transaction_logs += dat
)
return current_transactioon
/obj/item/retail_scanner/proc/add_transaction_log(c_name, p_method, t_amount)
var/list/new_entry = list(
"log_id" = length(transaction_logs) + 1,
"customer" = c_name,
"payment_method" = p_method,
"trans_time" = stationtime2text(),
"items" = item_list,
"prices" = price_list,
"amount" = transaction_amount
)
UNTYPED_LIST_ADD(transaction_logs, new_entry)
/obj/item/retail_scanner/proc/check_account()
if (!linked_account)
usr.visible_message("[icon2html(src,viewers(src))]" + span_warning("Unable to connect to linked account."))
return 0
visible_message("[icon2html(src, viewers(src))]" + span_warning("Unable to connect to linked account."))
return FALSE
if(linked_account.suspended)
src.visible_message("[icon2html(src,viewers(src))]" + span_warning("Connected account has been suspended."))
return 0
return 1
visible_message("[icon2html(src, viewers(src))]" + span_warning("Connected account has been suspended."))
return FALSE
return TRUE
/obj/item/retail_scanner/proc/transaction_complete()
/// Visible confirmation
playsound(src, 'sound/machines/chime.ogg', 25)
src.visible_message("[icon2html(src,viewers(src))]" + span_notice("Transaction complete."))
visible_message("[icon2html(src, viewers(src))]" + span_notice("Transaction complete."))
flick("retail_approve", src)
reset_memory()
updateDialog()
/obj/item/retail_scanner/proc/reset_memory()
transaction_amount = null
@@ -403,13 +387,13 @@
price_list.Cut()
confirm_item = null
/obj/item/retail_scanner/emag_act(var/remaining_charges, var/mob/user)
if(!emagged)
to_chat(user, span_danger("You stealthily swipe the cryptographic sequencer through \the [src]."))
playsound(src, "sparks", 50, 1)
req_access = list()
emagged = 1
/obj/item/retail_scanner/emag_act(remaining_charges, mob/user)
if(emagged)
return
to_chat(user, span_danger("You stealthily swipe the cryptographic sequencer through \the [src]."))
playsound(src, "sparks", 50, 1)
req_access = list()
emagged = 1
//--Premades--//
+76 -68
View File
@@ -21,7 +21,7 @@
var/dispense_flavour = ICECREAM_VANILLA
var/flavour_name = "vanilla"
/obj/machinery/icecream_vat/proc/get_ingredient_list(var/type)
/obj/machinery/icecream_vat/proc/get_ingredient_list(type)
switch(type)
if(ICECREAM_CHOCOLATE)
return list(REAGENT_ID_MILK, REAGENT_ID_ICE, REAGENT_ID_COCO)
@@ -36,7 +36,7 @@
else
return list(REAGENT_ID_MILK, REAGENT_ID_ICE)
/obj/machinery/icecream_vat/proc/get_flavour_name(var/flavour_type)
/obj/machinery/icecream_vat/proc/get_flavour_name(flavour_type)
switch(flavour_type)
if(ICECREAM_CHOCOLATE)
return "chocolate"
@@ -61,33 +61,82 @@
reagents.add_reagent(REAGENT_ID_SUGAR, 5)
reagents.add_reagent(REAGENT_ID_ICE, 5)
/obj/machinery/icecream_vat/attack_hand(mob/user as mob)
/obj/machinery/icecream_vat/attack_hand(mob/user)
user.set_machine(src)
interact(user)
tgui_interact(user)
/obj/machinery/icecream_vat/interact(mob/user as mob)
var/dat
dat += span_bold("ICECREAM") + "<br><div class='statusDisplay'>"
dat += span_bold("Dispensing: [flavour_name] icecream ") + " <br><br>"
dat += span_bold("Vanilla icecream:") + " <a href='byond://?src=\ref[src];select=[ICECREAM_VANILLA]'>" + span_bold("Select") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_VANILLA];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_VANILLA];amount=5'>" + span_bold("x5") + "</a> [product_types[ICECREAM_VANILLA]] scoops left. (Ingredients: milk, ice)<br>"
dat += span_bold("Strawberry icecream:") + " <a href='byond://?src=\ref[src];select=[ICECREAM_STRAWBERRY]'>" + span_bold("Select") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_STRAWBERRY];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_STRAWBERRY];amount=5'>" + span_bold("x5") + "</a> [product_types[ICECREAM_STRAWBERRY]] dollops left. (Ingredients: milk, ice, berry juice)<br>"
dat += span_bold("Chocolate icecream:") + " <a href='byond://?src=\ref[src];select=[ICECREAM_CHOCOLATE]'>" + span_bold("Select") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_CHOCOLATE];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_CHOCOLATE];amount=5'>" + span_bold("x5") + "</a> [product_types[ICECREAM_CHOCOLATE]] dollops left. (Ingredients: milk, ice, coco powder)<br>"
dat += span_bold("Blue icecream:") + " <a href='byond://?src=\ref[src];select=[ICECREAM_BLUE]'>" + span_bold("Select") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_BLUE];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[ICECREAM_BLUE];amount=5'>" + span_bold("x5") + "</a> [product_types[ICECREAM_BLUE]] dollops left. (Ingredients: milk, ice, singulo)<br></div>"
dat += "<br>" + span_bold("CONES") + "<br><div class='statusDisplay'>"
dat += span_bold("Waffle cones:") + " <a href='byond://?src=\ref[src];cone=[CONE_WAFFLE]'>" + span_bold("Dispense") + "</a> <a href='byond://?src=\ref[src];make=[CONE_WAFFLE];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[CONE_WAFFLE];amount=5'>" + span_bold("x5") + "</a> [product_types[CONE_WAFFLE]] cones left. (Ingredients: flour, sugar)<br>"
dat += span_bold("Chocolate cones:") + " <a href='byond://?src=\ref[src];cone=[CONE_CHOC]'>" + span_bold("Dispense") + "</a> <a href='byond://?src=\ref[src];make=[CONE_CHOC];amount=1'>" + span_bold("Make") + "</a> <a href='byond://?src=\ref[src];make=[CONE_CHOC];amount=5'>" + span_bold("x5") + "</a> [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)<br></div>"
dat += "<br>"
dat += span_bold("VAT CONTENT") + "<br>"
for(var/datum/reagent/R in reagents.reagent_list)
dat += "[R.name]: [R.volume]"
dat += "<A href='byond://?src=\ref[src];disposeI=[R.id]'>Purge</A><BR>"
dat += "<a href='byond://?src=\ref[src];refresh=1'>Refresh</a> <a href='byond://?src=\ref[src];close=1'>Close</a>"
/obj/machinery/icecream_vat/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, custom_state)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "IcecreamVat", name)
ui.open()
var/datum/browser/popup = new(user, "icecreamvat","Icecream Vat", 700, 500, src)
popup.set_content(dat)
popup.open()
/obj/machinery/icecream_vat/proc/build_icecream_data(list/ice_types)
var/ice_data = list()
if(!length(ice_types))
return ice_data
for(var/entry in ice_types)
UNTYPED_LIST_ADD(ice_data, list("index" = entry, "name" = get_flavour_name(entry), "amount_left" = product_types[entry], "ingredients" = get_ingredient_list(entry)))
return ice_data
/obj/machinery/icecream_vat/attackby(var/obj/item/O as obj, var/mob/user as mob)
/obj/machinery/icecream_vat/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
var/list/reagent_data = list()
for(var/datum/reagent/current_reagent in reagents.reagent_list)
UNTYPED_LIST_ADD(reagent_data, list("name" = current_reagent.name, "volume" = current_reagent.volume, "id" = current_reagent.id))
return list(
"current_flavor" = flavour_name,
"icecrem_data" = build_icecream_data(list(ICECREAM_VANILLA, ICECREAM_STRAWBERRY, ICECREAM_CHOCOLATE, ICECREAM_BLUE)),
"cone_data" = build_icecream_data(list(CONE_WAFFLE, CONE_CHOC)),
"reagent_data" = reagent_data
)
/obj/machinery/icecream_vat/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
switch(action)
if("index_action")
var/index_action = text2num(params["iceIndex"])
if(index_action <= 0)
return FALSE
if(index_action < 5)
dispense_flavour = index_action
flavour_name = get_flavour_name(dispense_flavour)
visible_message(span_notice("[ui.user] sets [src] to dispense [flavour_name] flavoured icecream."))
return TRUE
if(index_action < 7)
var/cone_name = get_flavour_name(index_action)
if(product_types[index_action] >= 1)
product_types[index_action] -= 1
var/obj/item/reagent_containers/food/snacks/icecream/I = new(src.loc)
I.cone_type = cone_name
I.icon_state = "icecream_cone_[cone_name]"
I.desc = "Delicious [cone_name] cone, but no ice cream."
visible_message(span_info("[ui.user] dispenses a crunchy [cone_name] cone from [src]."))
else
to_chat(ui.user, span_warning("There are no [cone_name] cones left!"))
return TRUE
if("make_type")
var/amount = text2num(params["amount"])
if(amount <= 0 || amount > 10)
return FALSE
var/index = text2num(params["index"])
if(index <= 0 || index > 6)
return FALSE
make(ui.user, index, amount)
return TRUE
if("clear_reagent")
var/reagent_id = params["id"]
if(!reagent_id)
return FALSE
reagents.del_reagent(reagent_id)
return TRUE
/obj/machinery/icecream_vat/attackby(obj/item/O, mob/user)
if(istype(O, /obj/item/reagent_containers/food/snacks/icecream))
var/obj/item/reagent_containers/food/snacks/icecream/I = O
if(!I.ice_creamed)
@@ -109,7 +158,7 @@
else
..()
/obj/machinery/icecream_vat/proc/make(var/mob/user, var/make_type, var/amount)
/obj/machinery/icecream_vat/proc/make(mob/user, make_type, amount)
for(var/R in get_ingredient_list(make_type))
if(reagents.has_reagent(R, amount))
continue
@@ -127,47 +176,6 @@
else
to_chat(user, span_warning("You don't have the ingredients to make this."))
/obj/machinery/icecream_vat/Topic(href, href_list)
if(..())
return
if(href_list["select"])
dispense_flavour = text2num(href_list["select"])
flavour_name = get_flavour_name(dispense_flavour)
src.visible_message(span_notice("[usr] sets [src] to dispense [flavour_name] flavoured icecream."))
if(href_list["cone"])
var/dispense_cone = text2num(href_list["cone"])
var/cone_name = get_flavour_name(dispense_cone)
if(product_types[dispense_cone] >= 1)
product_types[dispense_cone] -= 1
var/obj/item/reagent_containers/food/snacks/icecream/I = new(src.loc)
I.cone_type = cone_name
I.icon_state = "icecream_cone_[cone_name]"
I.desc = "Delicious [cone_name] cone, but no ice cream."
src.visible_message(span_info("[usr] dispenses a crunchy [cone_name] cone from [src]."))
else
to_chat(usr, span_warning("There are no [cone_name] cones left!"))
if(href_list["make"])
var/amount = (text2num(href_list["amount"]))
var/C = text2num(href_list["make"])
make(usr, C, amount)
if(href_list["disposeI"])
reagents.del_reagent(href_list["disposeI"])
updateDialog()
if(href_list["refresh"])
updateDialog()
if(href_list["close"])
usr.unset_machine()
usr << browse(null,"window=icecreamvat")
return
/obj/item/reagent_containers/food/snacks/icecream
name = "ice cream cone"
desc = "Delicious waffle cone, but no ice cream."
@@ -182,7 +190,7 @@
create_reagents(20)
reagents.add_reagent(REAGENT_ID_NUTRIMENT, 5)
/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(var/flavour_name)
/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(flavour_name)
name = "[flavour_name] icecream"
add_overlay("icecream_[flavour_name]")
desc = "Delicious [cone_type] cone with a dollop of [flavour_name] ice cream."
-4
View File
@@ -115,7 +115,6 @@
current_track = null
playing = 0
update_icon()
updateDialog()
start_stop_song()
// Track/music internals
@@ -138,7 +137,6 @@
return
playing = 1
start_stop_song()
updateDialog()
// Advance to the next track - Don't start playing it unless we were already playing
/obj/item/walkpod/proc/NextTrack()
@@ -149,7 +147,6 @@
current_track = tracks[newTrackIndex]
if(playing)
start_stop_song()
updateDialog()
// Unadvance to the notnext track - Don't start playing it unless we were already playing
/obj/item/walkpod/proc/PrevTrack()
@@ -160,7 +157,6 @@
current_track = tracks[newTrackIndex]
if(playing)
start_stop_song()
updateDialog()
// UI
/obj/item/walkpod/proc/getTracksList()
-5
View File
@@ -151,11 +151,6 @@ GLOBAL_LIST_EMPTY(apcs)
var/nightshift_setting = NIGHTSHIFT_AUTO
var/last_nightshift_switch = 0
/obj/machinery/power/apc/updateDialog()
if(stat & (BROKEN|MAINT))
return
..()
/obj/machinery/power/apc/connect_to_network()
//Override because the APC does not directly connect to the network; it goes through a terminal.
//The terminal is what the power computer looks for anyway.
@@ -29,91 +29,6 @@
monitor.tgui_interact(user)
/*
/obj/machinery/computer/fusion_fuel_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/fusion_fuel_control/interact(var/mob/user)
if(stat & (BROKEN|NOPOWER))
user.unset_machine()
user << browse(null, "window=fuel_control")
return
if (!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
user.unset_machine()
user << browse(null, "window=fuel_control")
return
if(!id_tag)
to_chat(user, span_warning("This console has not been assigned an ident tag. Please contact your system administrator or conduct a manual update with a standard multitool."))
return
var/dat = span_bold("Reactor Core Fuel Control #[id_tag]") + "<BR>"
dat += {"
<hr>
<table border=1 width='100%'>
<tr>
<td><b>Contains</b></td>
<td><b>Assembly</b></td>
<td><b>Remaining</b></td>
</tr>"}
for(var/obj/machinery/fusion_fuel_injector/I in fuel_injectors)
if(!id_tag || !I.id_tag || I.id_tag != id_tag || get_dist(src, I) > scan_range)
continue
dat += "<tr>"
if(I.stat & (BROKEN|NOPOWER))
dat += "<td>" + span_danger("ERROR") + "</td>"
dat += "<td>" + span_danger("ERROR") + "</td>"
dat += "<td>" + span_danger("ERROR") + "</td>"
else
dat += "<td>[I.cur_assembly ? I.cur_assembly.fuel_type : "NONE"]</td>"
if(I.cur_assembly)
dat += "<td><a href='byond://?src=\ref[src];toggle_injecting=\ref[I]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
else
dat += "<td>None</td>"
if(I.cur_assembly)
dat += "<td>[I.cur_assembly.percent_depleted * 100]%</td>"
else
dat += "<td>NA</td>"
dat += "</tr>"
dat += {"</table><hr>
<A href='byond://?src=\ref[src];refresh=1'>Refresh</A>
<A href='byond://?src=\ref[src];close=1'>Close</A><BR>"}
var/datum/browser/popup = new(user, "fuel_control", "Fusion Fuel Control Console", 800, 400, src)
popup.set_content(dat)
popup.open()
user.set_machine(src)
/obj/machinery/computer/fusion_fuel_control/Topic(href, href_list)
if(..())
return 1
if(href_list["toggle_injecting"])
var/obj/machinery/fusion_fuel_injector/I = locate(href_list["toggle_injecting"])
if(I.id_tag != id_tag || get_dist(src, I) > scan_range)
return
if(istype(I))
if(I.injecting)
I.StopInjecting()
else
I.BeginInjecting()
if( href_list["close"] )
usr << browse(null, "window=fuel_control")
usr.unset_machine()
updateDialog()
*/
/obj/machinery/computer/fusion_fuel_control/attackby(var/obj/item/W, var/mob/user)
..()
if(istype(W, /obj/item/multitool))
@@ -121,21 +36,3 @@
if(new_ident && user.Adjacent(src))
monitor.fuel_tag = new_ident
return
/*
/obj/machinery/computer/fusion_fuel_control/update_icon()
if(stat & (BROKEN))
icon = 'icons/obj/computer.dmi'
icon_state = "broken"
set_light(0)
if(stat & (NOPOWER))
icon = 'icons/obj/computer.dmi'
icon_state = "computer"
set_light(0)
if(!stat & (BROKEN|NOPOWER))
icon = initial(icon)
icon_state = initial(icon_state)
set_light(light_range_on, light_power_on)
*/
-2
View File
@@ -96,8 +96,6 @@ GLOBAL_LIST_EMPTY(all_turbines)
stored_energy = 0
return
updateDialog()
var/datum/gas_mixture/air1 = circ1.return_transfer_air()
var/datum/gas_mixture/air2 = circ2.return_transfer_air()
@@ -353,7 +353,6 @@ GLOBAL_LIST_EMPTY(gravity_generators)
if(charge_count % 4 == 0 && prob(75)) // Let them know it is charging/discharging.
playsound(src, 'sound/effects/empulse.ogg', 100, 1)
updateDialog()
if(prob(25)) // To help stop "Your clothes feel warm." spam.
pulse_radiation()
-1
View File
@@ -236,7 +236,6 @@
var/temp_loss = (temperature - cooling_temperature)/TEMPERATURE_DIVISOR
temp_loss = between(2, round(temp_loss, 1), TEMPERATURE_CHANGE_MAX)
temperature = max(temperature - temp_loss, cooling_temperature)
updateDialog()
if(overheating)
overheating--
+8 -3
View File
@@ -340,9 +340,14 @@
// Multitool - change RCON tag
if(istype(W, /obj/item/multitool))
var/newtag = tgui_input_text(user, "Enter new RCON tag. Use \"NO_TAG\" to disable RCON or leave empty to cancel.", "SMES RCON system", "", MAX_NAME_LEN)
if(newtag)
RCon_tag = newtag
to_chat(user, span_notice("You changed the RCON tag to: [newtag]"))
if(!newtag)
return
for(var/obj/machinery/power/smes/buildable/smes in GLOB.smeses)
if(smes.RCon_tag == newtag)
to_chat(user, span_warning("The entered RCON tag [newtag] already exists. Aborting."))
return
RCon_tag = newtag
to_chat(user, span_notice("You changed the RCON tag to: [newtag]"))
return
// Charged above 1% and safeties are enabled.
if((charge > (capacity/100)) && safeties_enabled)
-3
View File
@@ -362,7 +362,6 @@ GLOBAL_LIST_EMPTY(solars_list)
connected_tracker.set_angle(SSsun.sun.angle)
set_panels(cdir)
updateDialog()
/obj/machinery/power/solar_control/update_icon()
if(stat & BROKEN)
@@ -458,8 +457,6 @@ GLOBAL_LIST_EMPTY(solars_list)
if(powernet)
add_avail(connected_power)
updateDialog()
/obj/machinery/power/solar_control/tgui_act(action, params)
if(..())
return TRUE
+26 -30
View File
@@ -273,45 +273,41 @@
if(lastgen > 100)
add_overlay(image('icons/obj/pipes.dmi', "turb-o", FLY_LAYER))
updateDialog()
/obj/machinery/power/turbine/attack_hand(var/mob/user as mob)
if((. = ..()))
return
src.interact(user)
tgui_interact(user)
/obj/machinery/power/turbine/interact(mob/user)
if(!Adjacent(user) || (stat & (NOPOWER|BROKEN)) && !issilicon(user))
user.unset_machine(src)
user << browse(null, "window=turbine")
/obj/machinery/power/turbine/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, custom_state)
. = ..()
if(!Adjacent(user) && !issilicon(user))
return
user.set_machine(src)
var/t = "<TT><B>Gas Turbine Generator</B><HR><PRE>"
t += "Generated power : [DisplayPower(lastgen)]<BR><BR>"
t += "Turbine: [round(compressor.rpm)] RPM<BR>"
t += "Starter: [ compressor.starter ? "<A href='byond://?src=\ref[src];str=1'>Off</A> " + span_bold("On") : span_bold("Off") + " <A href='byond://?src=\ref[src];str=1'>On</A>"]"
t += "</PRE><HR><A href='byond://?src=\ref[src];close=1'>Close</A>"
t += "</TT>"
var/datum/browser/popup = new(user, "turbine", name, 700, 500, src)
popup.set_content(t)
popup.open()
return
/obj/machinery/power/turbine/Topic(href, href_list)
if(..())
if(stat & (BROKEN|NOPOWER))
return
if(href_list["close"])
usr << browse(null, "window=turbine")
usr.unset_machine(src)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Turbine", name)
ui.open()
/obj/machinery/power/turbine/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
return list(
"display_power" = lastgen,
"turbine_rpm" = compressor?.rpm,
"starter" = compressor?.starter
)
/obj/machinery/power/turbine/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
else if(href_list["str"])
if(compressor)
switch(action)
if("start_stop")
if(!compressor)
return FALSE
compressor.starter = !compressor.starter
updateDialog()
return TRUE
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Turbine Computer
@@ -36,7 +36,6 @@
src.locked = !src.locked
to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]")
. = 1
updateDialog()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
@@ -48,7 +47,6 @@
if((ACCESS_CAPTAIN in C.GetAccess()) || (ACCESS_SECURITY in C.GetAccess()) || (ACCESS_ENGINE in C.GetAccess()))
src.locked = !src.locked
to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]")
updateDialog()
else
to_chat(user, span_red("Access denied."))
else if(W.has_tool_quality(TOOL_WRENCH))
@@ -62,7 +60,6 @@
if(get_dir(src, gen) == src.dir)
owned_gen = gen
owned_gen.capacitors |= src
owned_gen.updateDialog()
else
if(owned_gen && (src in owned_gen.capacitors))
owned_gen.capacitors -= src
-3
View File
@@ -53,7 +53,6 @@
src.locked = !src.locked
to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]")
. = 1
updateDialog()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
@@ -64,7 +63,6 @@
if((ACCESS_CAPTAIN in C.GetAccess()) || (ACCESS_SECURITY in C.GetAccess()) || (ACCESS_ENGINE in C.GetAccess()))
src.locked = !src.locked
to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]")
updateDialog()
else
to_chat(user, span_red("Access denied."))
else if(W.has_tool_quality(TOOL_WRENCH))
@@ -83,7 +81,6 @@
// owned_capacitor = cap
capacitors |= cap
cap.owned_gen = src
updateDialog()
// break
else
for(var/obj/machinery/shield_capacitor/capacitor in capacitors)
-10
View File
@@ -336,13 +336,3 @@
GLOB.stockExchange.add_log(/datum/stock_log/borrow, user.name, B.stock.name, B.share_amount, B.deposit)
else
to_chat(user, span_danger("Could not complete transaction. Check your account balance."))
/obj/machinery/computer/stockexchange/Topic(href, href_list)
if (..())
return 1
if (!usr || (!(usr in range(1, src)) && iscarbon(usr)))
usr.set_machine(src)
src.add_fingerprint(usr)
src.updateUsrDialog(usr)
-2
View File
@@ -58,7 +58,6 @@
crystals += W
W.forceMove(src)
user.visible_message("[user] inserts [W] into \the [src]'s crystal slot.", span_notice("You insert [W] into \the [src]'s crystal slot."))
updateDialog()
else if(istype(W, /obj/item/gps))
if(!inserted_gps)
inserted_gps = W
@@ -349,7 +348,6 @@
log_msg += "nothing"
log_msg += " [sending ? "to" : "from"] [trueX], [trueY], [z_co] ([A ? A.name : "null area"])"
investigate_log(log_msg, "telesci")
updateDialog()
/obj/machinery/computer/telescience/proc/teleport(mob/user)
if(!COOLDOWN_FINISHED(src, teleport_cooldown))
+8 -6
View File
@@ -472,6 +472,7 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
if(!command_add.Execute())
log_sql("Error while trying to add [ckey] to the [role] [kind] whitelist.")
message.text = "Error while trying to add [ckey] to the [role] [kind] whitelist. Please review SQL logs."
qdel(command_add)
return message
qdel(command_add)
@@ -499,6 +500,7 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
if(!command_remove.Execute())
log_sql("Error while trying to remove [ckey] from the [role] [kind] whitelist.")
message.text = "Error while trying to remove [ckey] from the [role] [kind] whitelist. Please review SQL logs."
qdel(command_remove)
return message
qdel(command_remove)
@@ -535,14 +537,14 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
log_sql("Error while trying to query whitelists for [ckey].")
embed.description = "Error while trying to query whitelists for [ckey]. Please review SQL logs."
embed.colour = "#FF0000"
qdel(query_list)
return message
else
while(query_list.NextRow())
var/kind_query_result = query_list.item[1]
var/entry_query_result = query_list.item[2]
while(query_list.NextRow())
var/kind_query_result = query_list.item[1]
var/entry_query_result = query_list.item[2]
embed.description += "- [kind_query_result] - [entry_query_result]\n"
found = TRUE
embed.description += "- [kind_query_result] - [entry_query_result]\n"
found = TRUE
qdel(query_list)
if(!found)
+4 -7
View File
@@ -13,15 +13,12 @@
var/number_pages = 0
/datum/tgui_module/rcon/proc/filter_smeslist(var/page)
number_pages = known_SMESs.len / SMES_PER_PAGE
if(number_pages != round(number_pages))
number_pages = round(number_pages) + 1
number_pages = (length(known_SMESs) + SMES_PER_PAGE - 1) / SMES_PER_PAGE
var/page_index = page - 1
var/lower_bound = page_index * SMES_PER_PAGE + 1
var/upper_bound = (page_index + 1) * SMES_PER_PAGE
upper_bound = min(upper_bound, known_SMESs.len)
upper_bound = min(upper_bound, length(known_SMESs))
filtered_smeslist = list()
for(var/index = lower_bound, index <= upper_bound, index++)
@@ -34,13 +31,13 @@
filter_smeslist(current_page)
// SMES DATA (simplified view)
var/list/smeslist[0]
var/list/smeslist = list()
for(var/obj/machinery/power/smes/buildable/SMES in filtered_smeslist)
var/list/smes_data = SMES.tgui_data()
smes_data["RCON_tag"] = SMES.RCon_tag
smeslist.Add(list(smes_data))
data["pages"] = number_pages + 1
data["pages"] = number_pages
data["current_page"] = current_page
data["smes_info"] = sortByKey(smeslist, "RCON_tag")
-2
View File
@@ -70,7 +70,6 @@
if(floor.ext_panel)
floor.ext_panel.reset()
queued_floors.Cut()
control_panel_interior.updateDialog()
// Update the icons of all exterior panels (after we change modes etc)
/datum/turbolift/proc/update_ext_panel_icons()
@@ -146,7 +145,6 @@
moving_upwards = 1
else
moving_upwards = 0
control_panel_interior.updateDialog()
if(doors_are_open())
if(!doors_closing)
@@ -110,7 +110,6 @@
/obj/machinery/artifact_analyser/process()
if(scan_in_progress && world.time > scan_completion_time)
scan_in_progress = 0
updateDialog()
var/results = ""
if(!owned_scanner)