copypaste phase complete, major:vendies

This commit is contained in:
Letter N
2020-07-30 14:17:35 +08:00
parent 10fefca674
commit 782e3c2ffb
7 changed files with 139 additions and 89 deletions

View File

@@ -35,21 +35,25 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new)
QDEL_NULL(ev) QDEL_NULL(ev)
return ..() return ..()
/obj/machinery/keycard_auth/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ /obj/machinery/keycard_auth/ui_state(mob/user)
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) return GLOB.physical_state
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/keycard_auth/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
ui = new(user, src, ui_key, "KeycardAuth", name, ui_x, ui_y, master_ui, state) ui = new(user, src, "KeycardAuth", name)
ui.open() ui.open()
/obj/machinery/keycard_auth/ui_data() /obj/machinery/keycard_auth/ui_data()
var/list/data = list() var/list/data = list()
data["waiting"] = waiting data["waiting"] = waiting
data["auth_required"] = event_source ? event_source.event : 0 data["auth_required"] = event_source ? event_source.event : 0
data["red_alert"] = (SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level)) >= SEC_LEVEL_RED) ? 1 : 0 data["red_alert"] = (seclevel2num(get_security_level()) >= SEC_LEVEL_RED) ? 1 : 0
data["emergency_maint"] = GLOB.emergency_access data["emergency_maint"] = GLOB.emergency_access
data["bsa_unlock"] = GLOB.bsa_unlock data["bsa_unlock"] = GLOB.bsa_unlock
return data return data
= GLOB.bsa_unlock
return data
/obj/machinery/keycard_auth/ui_status(mob/user) /obj/machinery/keycard_auth/ui_status(mob/user)
if(isanimal(user)) if(isanimal(user))

View File

@@ -45,11 +45,14 @@
say("Please equip your ID card into your ID slot to authenticate.") say("Please equip your ID card into your ID slot to authenticate.")
. = ..() . = ..()
/obj/machinery/computer/emergency_shuttle/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.human_adjacent_state) /obj/machinery/computer/emergency_shuttle/ui_state(mob/user)
return GLOB.human_adjacent_state
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) /obj/machinery/computer/emergency_shuttle/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
ui = new(user, src, ui_key, "EmergencyShuttleConsole", name, ui_x, ui_y, master_ui, state) ui = new(user, src, "EmergencyShuttleConsole", name)
ui.open() ui.open()
/obj/machinery/computer/emergency_shuttle/ui_data() /obj/machinery/computer/emergency_shuttle/ui_data()
@@ -65,8 +68,8 @@
var/job = ID.assignment var/job = ID.assignment
if(obj_flags & EMAGGED) if(obj_flags & EMAGGED)
name = Gibberish(name, 0) name = Gibberish(name)
job = Gibberish(job, 0) job = Gibberish(job)
A += list(list("name" = name, "job" = job)) A += list(list("name" = name, "job" = job))
data["authorizations"] = A data["authorizations"] = A

View File

@@ -210,20 +210,23 @@
/obj/machinery/computer/bsa_control /obj/machinery/computer/bsa_control
name = "bluespace artillery control" name = "bluespace artillery control"
var/obj/machinery/bsa/full/cannon
var/notice
var/target
use_power = NO_POWER_USE use_power = NO_POWER_USE
circuit = /obj/item/circuitboard/computer/bsa_control circuit = /obj/item/circuitboard/computer/bsa_control
icon = 'icons/obj/machines/particle_accelerator.dmi' icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "control_boxp" icon_state = "control_boxp"
var/obj/machinery/bsa/full/cannon
var/notice
var/target
var/area_aim = FALSE //should also show areas for targeting var/area_aim = FALSE //should also show areas for targeting
/obj/machinery/computer/bsa_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ /obj/machinery/computer/bsa_control/ui_state(mob/user)
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) return GLOB.physical_state
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/computer/bsa_control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
ui = new(user, src, ui_key, "BluespaceArtillery", name, ui_x, ui_y, master_ui, state) ui = new(user, src, "BluespaceArtillery", name)
ui.open() ui.open()
/obj/machinery/computer/bsa_control/ui_data() /obj/machinery/computer/bsa_control/ui_data()

View File

@@ -174,14 +174,13 @@
. = ..() . = ..()
/obj/machinery/dna_vault/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) /obj/machinery/dna_vault/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
roll_powers(user) roll_powers(user)
ui = new(user, src, ui_key, "DnaVault", name, ui_x, ui_y, master_ui, state) ui = new(user, src, "DnaVault", name)
ui.open() ui.open()
/obj/machinery/dna_vault/proc/roll_powers(mob/user) /obj/machinery/dna_vault/proc/roll_powers(mob/user)
if(user in power_lottery) if(user in power_lottery)
return return

View File

@@ -42,10 +42,10 @@
circuit = /obj/item/circuitboard/computer/sat_control circuit = /obj/item/circuitboard/computer/sat_control
var/notice var/notice
/obj/machinery/computer/sat_control/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) /obj/machinery/computer/sat_control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
ui = new(user, src, ui_key, "SatelliteControl", name, ui_x, ui_y, master_ui, state) ui = new(user, src, "SatelliteControl", name)
ui.open() ui.open()
/obj/machinery/computer/sat_control/ui_act(action, params) /obj/machinery/computer/sat_control/ui_act(action, params)

View File

@@ -658,21 +658,21 @@ GLOBAL_LIST_EMPTY(vending_products)
return return
return ..() return ..()
/obj/machinery/vending/ui_base_html(html) /obj/machinery/vending/ui_assets(mob/user)
var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/vending) return list(
. = replacetext(html, "<!--customheadhtml-->", assets.css_tag()) get_asset_datum(/datum/asset/spritesheet/vending),
)
/obj/machinery/vending/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) /obj/machinery/vending/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) ui = SStgui.try_update_ui(user, src, ui)
if(!ui) if(!ui)
var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending) ui = new(user, src, "Vending")
assets.send(user)
ui = new(user, src, ui_key, "Vending", ui_key, 450, 600, master_ui, state)
ui.open() ui.open()
/obj/machinery/vending/ui_static_data(mob/user) /obj/machinery/vending/ui_static_data(mob/user)
. = list() . = list()
.["onstation"] = onstation .["onstation"] = onstation
.["department"] = payment_department
.["product_records"] = list() .["product_records"] = list()
for (var/datum/data/vending_product/R in product_records) for (var/datum/data/vending_product/R in product_records)
var/list/data = list( var/list/data = list(
@@ -699,7 +699,7 @@ GLOBAL_LIST_EMPTY(vending_products)
var/list/data = list( var/list/data = list(
path = replacetext(replacetext("[R.product_path]", "/obj/item/", ""), "/", "-"), path = replacetext(replacetext("[R.product_path]", "/obj/item/", ""), "/", "-"),
name = R.name, name = R.name,
price = R.custom_price || default_price, price = R.custom_premium_price || extra_price, //may cause breakage. please note
max_amount = R.max_amount, max_amount = R.max_amount,
ref = REF(R), ref = REF(R),
premium = TRUE premium = TRUE
@@ -708,28 +708,24 @@ GLOBAL_LIST_EMPTY(vending_products)
/obj/machinery/vending/ui_data(mob/user) /obj/machinery/vending/ui_data(mob/user)
. = list() . = list()
var/obj/item/card/id/C = user.get_idcard(TRUE) var/mob/living/carbon/human/H
.["cost_mult"] = 1 var/obj/item/card/id/C
.["cost_text"] = "" if(ishuman(user))
if(C && C.registered_account) H = user
.["user"] = list() C = H.get_idcard(TRUE)
.["user"]["name"] = C.registered_account.account_holder if(C?.registered_account)
.["user"]["cash"] = C.registered_account.account_balance .["user"] = list()
if(C.registered_account.account_job) .["user"]["name"] = C.registered_account.account_holder
.["user"]["job"] = C.registered_account.account_job.title .["user"]["cash"] = C.registered_account.account_balance
else if(C.registered_account.account_job)
.["user"]["job"] = "No Job" .["user"]["job"] = C.registered_account.account_job.title
var/cost_mult = get_best_discount(C) .["user"]["department"] = C.registered_account.account_job.paycheck_department
if(cost_mult != 1)
.["cost_mult"] = cost_mult
if(cost_mult < 1)
.["cost_text"] = " ([(1 - cost_mult) * 100]% OFF)"
else else
.["cost_text"] = " ([(cost_mult - 1) * 100]% EXTRA)" .["user"]["job"] = "No Job"
.["user"]["department"] = "No Department"
.["stock"] = list() .["stock"] = list()
for (var/datum/data/vending_product/R in product_records + coin_records + hidden_records) for (var/datum/data/vending_product/R in product_records + coin_records + hidden_records)
.["stock"][R.name] = R.amount .["stock"][R.name] = R.amount
.
.["extended_inventory"] = extended_inventory .["extended_inventory"] = extended_inventory
/obj/machinery/vending/ui_act(action, params) /obj/machinery/vending/ui_act(action, params)
@@ -752,7 +748,9 @@ GLOBAL_LIST_EMPTY(vending_products)
if(!R || !istype(R) || !R.product_path) if(!R || !istype(R) || !R.product_path)
vend_ready = TRUE vend_ready = TRUE
return return
var/price_to_use = R.custom_price || default_price var/price_to_use = default_price
if(R.custom_price)
price_to_use = R.custom_price
if(R in hidden_records) if(R in hidden_records)
if(!extended_inventory) if(!extended_inventory)
vend_ready = TRUE vend_ready = TRUE
@@ -766,8 +764,10 @@ GLOBAL_LIST_EMPTY(vending_products)
flick(icon_deny,src) flick(icon_deny,src)
vend_ready = TRUE vend_ready = TRUE
return return
if(onstation && price_to_use >= 0) if(onstation && ishuman(usr))
var/obj/item/card/id/C = usr.get_idcard(TRUE) var/mob/living/carbon/human/H = usr
var/obj/item/card/id/C = H.get_idcard(TRUE)
if(!C) if(!C)
say("No card found.") say("No card found.")
flick(icon_deny,src) flick(icon_deny,src)
@@ -778,11 +778,20 @@ GLOBAL_LIST_EMPTY(vending_products)
flick(icon_deny,src) flick(icon_deny,src)
vend_ready = TRUE vend_ready = TRUE
return return
// else if(age_restrictions && R.age_restricted && (!C.registered_age || C.registered_age < AGE_MINOR))
// say("You are not of legal age to purchase [R.name].")
// if(!(usr in GLOB.narcd_underages))
// Radio.set_frequency(FREQ_SECURITY)
// Radio.talk_into(src, "SECURITY ALERT: Underaged crewmember [H] recorded attempting to purchase [R.name] in [get_area(src)]. Please watch for substance abuse.", FREQ_SECURITY)
// GLOB.narcd_underages += H
// flick(icon_deny,src)
// vend_ready = TRUE
// return
var/datum/bank_account/account = C.registered_account var/datum/bank_account/account = C.registered_account
if(coin_records.Find(R)) if(account.account_job && account.account_job.paycheck_department == payment_department)
price_to_use = R.custom_premium_price || extra_price price_to_use = 0
else if(!hidden_records.Find(R)) if(coin_records.Find(R) || hidden_records.Find(R))
price_to_use = round(price_to_use * get_best_discount(C)) price_to_use = R.custom_premium_price ? R.custom_premium_price : extra_price
if(price_to_use && !account.adjust_money(-price_to_use)) if(price_to_use && !account.adjust_money(-price_to_use))
say("You do not possess the funds to purchase [R.name].") say("You do not possess the funds to purchase [R.name].")
flick(icon_deny,src) flick(icon_deny,src)
@@ -791,6 +800,8 @@ GLOBAL_LIST_EMPTY(vending_products)
var/datum/bank_account/D = SSeconomy.get_dep_account(payment_department) var/datum/bank_account/D = SSeconomy.get_dep_account(payment_department)
if(D) if(D)
D.adjust_money(price_to_use) D.adjust_money(price_to_use)
SSblackbox.record_feedback("amount", "vending_spent", price_to_use)
log_econ("[price_to_use] credits were inserted into [src] by [D.account_holder] to buy [R].")
if(last_shopper != usr || purchase_message_cooldown < world.time) if(last_shopper != usr || purchase_message_cooldown < world.time)
say("Thank you for shopping with [src]!") say("Thank you for shopping with [src]!")
purchase_message_cooldown = world.time + 5 SECONDS purchase_message_cooldown = world.time + 5 SECONDS
@@ -799,12 +810,8 @@ GLOBAL_LIST_EMPTY(vending_products)
if(icon_vend) //Show the vending animation if needed if(icon_vend) //Show the vending animation if needed
flick(icon_vend,src) flick(icon_vend,src)
playsound(src, 'sound/machines/machine_vend.ogg', 50, TRUE, extrarange = -3) playsound(src, 'sound/machines/machine_vend.ogg', 50, TRUE, extrarange = -3)
var/obj/item/vended = new R.product_path(get_turf(src)) new R.product_path(get_turf(src))
R.amount-- R.amount--
if(usr.CanReach(src) && usr.put_in_hands(vended))
to_chat(usr, "<span class='notice'>You take [R.name] out of the slot.</span>")
else
to_chat(usr, "<span class='warning'>[capitalize(R.name)] falls onto the floor!</span>")
SSblackbox.record_feedback("nested tally", "vending_machine_usage", 1, list("[type]", "[R.product_path]")) SSblackbox.record_feedback("nested tally", "vending_machine_usage", 1, list("[type]", "[R.product_path]"))
vend_ready = TRUE vend_ready = TRUE

View File

@@ -5,51 +5,85 @@ import { Window } from '../layouts';
export const ChemPress = (props, context) => { export const ChemPress = (props, context) => {
const { act, data } = useBackend(context); const { act, data } = useBackend(context);
const { const {
pill_size, current_volume,
pill_name, product_name,
pill_style, pill_style,
pill_styles = [], pill_styles = [],
product,
min_volume,
max_volume,
} = data; } = data;
return ( return (
<Window> <Window
width={300}
height={227}>
<Window.Content> <Window.Content>
<Section> <Section>
<LabeledList> <LabeledList>
<LabeledList.Item label="Pill Volume"> <LabeledList.Item label="Product">
<Button.Checkbox
content="Pills"
checked={product === "pill"}
onClick={() => act('change_product', {
product: "pill",
})}
/>
<Button.Checkbox
content="Patches"
checked={product === "patch"}
onClick={() => act('change_product', {
product: "patch",
})}
/>
<Button.Checkbox
content="Bottles"
checked={product === "bottle"}
onClick={() => act('change_product', {
product: "bottle",
})}
/>
</LabeledList.Item>
<LabeledList.Item label="Volume">
<NumberInput <NumberInput
value={pill_size} value={current_volume}
unit="u" unit="u"
width="43px" width="43px"
minValue={5} minValue={min_volume}
maxValue={50} maxValue={max_volume}
step={1} step={1}
stepPixelSize={2} stepPixelSize={2}
onChange={(e, value) => act('change_pill_size', { onChange={(e, value) => act('change_current_volume', {
volume: value, volume: value,
})} /> })} />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Pill Name"> <LabeledList.Item label="Name">
<Input <Input
value={pill_name} value={product_name}
onChange={(e, value) => act('change_pill_name', { placeholder={product_name}
onChange={(e, value) => act('change_product_name', {
name: value, name: value,
})} /> })} />
<Box as="span">
{product}
</Box>
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Pill Style"> {product === "pill" && (
{pill_styles.map(pill => ( <LabeledList.Item label="Style">
<Button {pill_styles.map(pill => (
key={pill.id} <Button
width="30px" key={pill.id}
selected={pill.id === pill_style} width="30px"
textAlign="center" selected={pill.id === pill_style}
color="transparent" textAlign="center"
onClick={() => act('change_pill_style', { color="transparent"
id: pill.id, onClick={() => act('change_pill_style', {
})}> id: pill.id,
<Box mx={-1} className={pill.class_name} /> })}>
</Button> <Box mx={-1} className={pill.class_name} />
))} </Button>
</LabeledList.Item> ))}
</LabeledList.Item>
)}
</LabeledList> </LabeledList>
</Section> </Section>
</Window.Content> </Window.Content>