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)
return ..()
/obj/machinery/keycard_auth/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)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/keycard_auth/ui_state(mob/user)
return GLOB.physical_state
/obj/machinery/keycard_auth/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, 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()
/obj/machinery/keycard_auth/ui_data()
var/list/data = list()
data["waiting"] = waiting
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["bsa_unlock"] = GLOB.bsa_unlock
return data
= GLOB.bsa_unlock
return data
/obj/machinery/keycard_auth/ui_status(mob/user)
if(isanimal(user))

View File

@@ -45,11 +45,14 @@
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)
ui = new(user, src, ui_key, "EmergencyShuttleConsole", name, ui_x, ui_y, master_ui, state)
ui = new(user, src, "EmergencyShuttleConsole", name)
ui.open()
/obj/machinery/computer/emergency_shuttle/ui_data()
@@ -65,8 +68,8 @@
var/job = ID.assignment
if(obj_flags & EMAGGED)
name = Gibberish(name, 0)
job = Gibberish(job, 0)
name = Gibberish(name)
job = Gibberish(job)
A += list(list("name" = name, "job" = job))
data["authorizations"] = A

View File

@@ -210,20 +210,23 @@
/obj/machinery/computer/bsa_control
name = "bluespace artillery control"
var/obj/machinery/bsa/full/cannon
var/notice
var/target
use_power = NO_POWER_USE
circuit = /obj/item/circuitboard/computer/bsa_control
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "control_boxp"
var/obj/machinery/bsa/full/cannon
var/notice
var/target
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, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/computer/bsa_control/ui_state(mob/user)
return GLOB.physical_state
/obj/machinery/computer/bsa_control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, 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()
/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)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/dna_vault/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
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()
/obj/machinery/dna_vault/proc/roll_powers(mob/user)
if(user in power_lottery)
return

View File

@@ -42,10 +42,10 @@
circuit = /obj/item/circuitboard/computer/sat_control
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)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/computer/sat_control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, 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()
/obj/machinery/computer/sat_control/ui_act(action, params)

View File

@@ -658,21 +658,21 @@ GLOBAL_LIST_EMPTY(vending_products)
return
return ..()
/obj/machinery/vending/ui_base_html(html)
var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/vending)
. = replacetext(html, "<!--customheadhtml-->", assets.css_tag())
/obj/machinery/vending/ui_assets(mob/user)
return list(
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)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/vending/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending)
assets.send(user)
ui = new(user, src, ui_key, "Vending", ui_key, 450, 600, master_ui, state)
ui = new(user, src, "Vending")
ui.open()
/obj/machinery/vending/ui_static_data(mob/user)
. = list()
.["onstation"] = onstation
.["department"] = payment_department
.["product_records"] = list()
for (var/datum/data/vending_product/R in product_records)
var/list/data = list(
@@ -699,7 +699,7 @@ GLOBAL_LIST_EMPTY(vending_products)
var/list/data = list(
path = replacetext(replacetext("[R.product_path]", "/obj/item/", ""), "/", "-"),
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,
ref = REF(R),
premium = TRUE
@@ -708,28 +708,24 @@ GLOBAL_LIST_EMPTY(vending_products)
/obj/machinery/vending/ui_data(mob/user)
. = list()
var/obj/item/card/id/C = user.get_idcard(TRUE)
.["cost_mult"] = 1
.["cost_text"] = ""
if(C && C.registered_account)
.["user"] = list()
.["user"]["name"] = C.registered_account.account_holder
.["user"]["cash"] = C.registered_account.account_balance
if(C.registered_account.account_job)
.["user"]["job"] = C.registered_account.account_job.title
else
.["user"]["job"] = "No Job"
var/cost_mult = get_best_discount(C)
if(cost_mult != 1)
.["cost_mult"] = cost_mult
if(cost_mult < 1)
.["cost_text"] = " ([(1 - cost_mult) * 100]% OFF)"
var/mob/living/carbon/human/H
var/obj/item/card/id/C
if(ishuman(user))
H = user
C = H.get_idcard(TRUE)
if(C?.registered_account)
.["user"] = list()
.["user"]["name"] = C.registered_account.account_holder
.["user"]["cash"] = C.registered_account.account_balance
if(C.registered_account.account_job)
.["user"]["job"] = C.registered_account.account_job.title
.["user"]["department"] = C.registered_account.account_job.paycheck_department
else
.["cost_text"] = " ([(cost_mult - 1) * 100]% EXTRA)"
.["user"]["job"] = "No Job"
.["user"]["department"] = "No Department"
.["stock"] = list()
for (var/datum/data/vending_product/R in product_records + coin_records + hidden_records)
.["stock"][R.name] = R.amount
.
.["extended_inventory"] = extended_inventory
/obj/machinery/vending/ui_act(action, params)
@@ -752,7 +748,9 @@ GLOBAL_LIST_EMPTY(vending_products)
if(!R || !istype(R) || !R.product_path)
vend_ready = TRUE
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(!extended_inventory)
vend_ready = TRUE
@@ -766,8 +764,10 @@ GLOBAL_LIST_EMPTY(vending_products)
flick(icon_deny,src)
vend_ready = TRUE
return
if(onstation && price_to_use >= 0)
var/obj/item/card/id/C = usr.get_idcard(TRUE)
if(onstation && ishuman(usr))
var/mob/living/carbon/human/H = usr
var/obj/item/card/id/C = H.get_idcard(TRUE)
if(!C)
say("No card found.")
flick(icon_deny,src)
@@ -778,11 +778,20 @@ GLOBAL_LIST_EMPTY(vending_products)
flick(icon_deny,src)
vend_ready = TRUE
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
if(coin_records.Find(R))
price_to_use = R.custom_premium_price || extra_price
else if(!hidden_records.Find(R))
price_to_use = round(price_to_use * get_best_discount(C))
if(account.account_job && account.account_job.paycheck_department == payment_department)
price_to_use = 0
if(coin_records.Find(R) || hidden_records.Find(R))
price_to_use = R.custom_premium_price ? R.custom_premium_price : extra_price
if(price_to_use && !account.adjust_money(-price_to_use))
say("You do not possess the funds to purchase [R.name].")
flick(icon_deny,src)
@@ -791,6 +800,8 @@ GLOBAL_LIST_EMPTY(vending_products)
var/datum/bank_account/D = SSeconomy.get_dep_account(payment_department)
if(D)
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)
say("Thank you for shopping with [src]!")
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
flick(icon_vend,src)
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--
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]"))
vend_ready = TRUE

View File

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