Merge pull request #12229 from Arturlang/TGUI-3.0

[READY]TGUI 3.0
This commit is contained in:
silicons
2020-07-16 17:28:42 -07:00
committed by GitHub
921 changed files with 33028 additions and 40339 deletions

View File

@@ -92,6 +92,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
say("<span class='danger'>Launch sequence activated! Prepare for drop!!</span>")
playsound(loc, 'sound/machines/warning-buzzer.ogg', 70, 0)
launch_warning = FALSE
log_shuttle("[key_name(usr)] has launched the auxillary base.")
else if(!shuttle_error)
say("Shuttle request uploaded. Please stand away from the doors.")
else

View File

@@ -19,7 +19,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list(
singular_name = "marker beacon"
desc = "Prism-brand path illumination devices. Used by miners to mark paths and warn of danger."
icon = 'icons/obj/lighting.dmi'
icon_state = "marker"
icon_state = "markerbronze"
merge_type = /obj/item/stack/marker_beacon
max_amount = 100
novariants = TRUE

View File

@@ -8,6 +8,9 @@ GLOBAL_LIST(labor_sheet_values)
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "console"
density = FALSE
ui_x = 315
ui_y = 430
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
var/machinedir = SOUTH
var/obj/machinery/door/airlock/release_door
@@ -36,7 +39,7 @@ GLOBAL_LIST(labor_sheet_values)
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "labor_claim_console", name, 315, 430, master_ui, state)
ui = new(user, src, ui_key, "LaborClaimConsole", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
@@ -100,7 +103,6 @@ GLOBAL_LIST(labor_sheet_values)
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
. = TRUE
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
@@ -110,12 +112,9 @@ GLOBAL_LIST(labor_sheet_values)
qdel(src)
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
. = ..()
if(obj_flags & EMAGGED)
return
obj_flags |= EMAGGED
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
return TRUE
if(!(obj_flags & EMAGGED))
obj_flags |= EMAGGED
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
/**********************Prisoner Collection Unit**************************/

View File

@@ -3,9 +3,54 @@
/**********************Mineral processing unit console**************************/
/obj/machinery/mineral
speed_process = TRUE
init_process = FALSE
/// The current direction of `input_turf`, in relation to the machine.
var/input_dir = NORTH
/// The current direction, in relation to the machine, that items will be output to.
var/output_dir = SOUTH
/// The turf the machines listens to for items to pick up. Calls the `pickup_item()` proc.
var/turf/input_turf = null
/// Determines if this machine needs to pick up items. Used to avoid registering signals to `/mineral` machines that don't pickup items.
var/needs_item_input = FALSE
/obj/machinery/mineral/Initialize(mapload)
. = ..()
if(needs_item_input && anchored)
register_input_turf()
/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED and ATOM_CREATED. Calls the `pickup_item()` proc when it receives these signals.
/obj/machinery/mineral/proc/register_input_turf()
input_turf = get_step(src, input_dir)
if(input_turf) // make sure there is actually a turf
RegisterSignal(input_turf, list(COMSIG_ATOM_CREATED, COMSIG_ATOM_ENTERED), .proc/pickup_item)
/// Unregisters signals that are registered the machine's input turf, if it has one.
/obj/machinery/mineral/proc/unregister_input_turf()
if(input_turf)
UnregisterSignal(input_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_CREATED))
/obj/machinery/mineral/Moved()
. = ..()
if(!needs_item_input || !anchored)
return
unregister_input_turf()
register_input_turf()
/**
Base proc for all `/mineral` subtype machines to use. Place your item pickup behavior in this proc when you override it for your specific machine.
Called when the COMSIG_ATOM_ENTERED and COMSIG_ATOM_CREATED signals are sent.
Arguments:
* source - the turf that is listening for the signals.
* target - the atom that just moved onto the `source` turf.
* oldLoc - the old location that `target` was at before moving onto `source`.
*/
/obj/machinery/mineral/proc/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
return
/// Generic unloading proc. Takes an atom as an argument and forceMove's it to the turf adjacent to this machine in the `output_dir` direction.
/obj/machinery/mineral/proc/unload_mineral(atom/movable/S)
S.forceMove(drop_location())
var/turf/T = get_step(src,output_dir)
@@ -19,7 +64,6 @@
density = TRUE
var/obj/machinery/mineral/processing_unit/machine = null
var/machinedir = EAST
speed_process = TRUE
/obj/machinery/mineral/processing_unit_console/Initialize()
. = ..()
@@ -58,6 +102,7 @@
if(href_list["set_on"])
machine.on = (href_list["set_on"] == "on")
START_PROCESSING(SSmachines, machine)
updateUsrDialog()
return
@@ -75,6 +120,7 @@
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "furnace"
density = TRUE
needs_item_input = TRUE
var/obj/machinery/mineral/CONSOLE = null
var/on = FALSE
var/datum/material/selected_material = null
@@ -93,9 +139,6 @@
QDEL_NULL(stored_research)
return ..()
/obj/machinery/mineral/processing_unit/HasProximity(atom/movable/AM)
if(istype(AM, /obj/item/stack/ore) && AM.loc == get_step(src, input_dir))
process_ore(AM)
/obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O)
if(QDELETED(O))
@@ -144,8 +187,14 @@
return dat
/obj/machinery/mineral/processing_unit/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
if(QDELETED(target))
return
if(istype(target, /obj/item/stack/ore))
process_ore(target)
/obj/machinery/mineral/processing_unit/process()
if (on)
if(on)
if(selected_material)
smelt_ore()
@@ -155,6 +204,8 @@
if(CONSOLE)
CONSOLE.updateUsrDialog()
else
STOP_PROCESSING(SSmachines, src)
/obj/machinery/mineral/processing_unit/proc/smelt_ore()
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)

View File

@@ -198,7 +198,7 @@
/obj/machinery/mineral/ore_redemption/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ore_redemption_machine", "Ore Redemption Machine", 440, 550, master_ui, state)
ui = new(user, src, ui_key, "OreRedemptionMachine", "Ore Redemption Machine", 440, 550, master_ui, state)
ui.open()
/obj/machinery/mineral/ore_redemption/ui_data(mob/user)

View File

@@ -7,6 +7,8 @@
icon_state = "mining"
density = TRUE
circuit = /obj/item/circuitboard/machine/mining_equipment_vendor
ui_x = 425
ui_y = 600
var/icon_deny = "mining-deny"
var/obj/item/card/id/inserted_id
var/list/prize_list = list( //if you add something to this, please, for the love of god, sort it by price/type. use tabs and not spaces.
@@ -84,9 +86,14 @@
src.equipment_path = path
src.cost = cost
/obj/machinery/mineral/equipment_vendor/power_change()
..()
update_icon()
/obj/machinery/mineral/equipment_vendor/Initialize()
. = ..()
build_inventory()
/obj/machinery/mineral/equipment_vendor/proc/build_inventory()
for(var/p in prize_list)
var/datum/data/mining_equipment/M = p
GLOB.vending_products[M.equipment_path] = 1
/obj/machinery/mineral/equipment_vendor/update_icon_state()
if(powered())
@@ -94,44 +101,82 @@
else
icon_state = "[initial(icon_state)]-off"
/obj/machinery/mineral/equipment_vendor/ui_interact(mob/user)
. = ..()
var/list/dat = list()
dat += "<br><b>Equipment point cost list:</b><BR><table border='0' width='300'>"
/obj/machinery/mineral/equipment_vendor/ui_base_html(html)
var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/vending)
. = replacetext(html, "<!--customheadhtml-->", assets.css_tag())
/obj/machinery/mineral/equipment_vendor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending)
assets.send(user)
ui = new(user, src, ui_key, "MiningVendor", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/mineral/equipment_vendor/ui_static_data(mob/user)
. = list()
.["product_records"] = list()
for(var/datum/data/mining_equipment/prize in prize_list)
dat += "<tr><td>[prize.equipment_name]</td><td>[prize.cost]</td><td><A href='?src=[REF(src)];purchase=[REF(prize)]'>Purchase</A></td></tr>"
dat += "</table>"
var/list/product_data = list(
path = replacetext(replacetext("[prize.equipment_path]", "/obj/item/", ""), "/", "-"),
name = prize.equipment_name,
price = prize.cost,
ref = REF(prize)
)
.["product_records"] += list(product_data)
var/datum/browser/popup = new(user, "miningvendor", "Mining Equipment Vendor", 400, 350)
popup.set_content(dat.Join())
popup.open()
return
/obj/machinery/mineral/equipment_vendor/ui_data(mob/user)
. = list()
var/mob/living/carbon/human/H
var/obj/item/card/id/C
if(ishuman(user))
H = user
C = H.get_idcard(TRUE)
if(C)
.["user"] = list()
.["user"]["points"] = C.mining_points
if(C.assignment)
.["user"]["job"] = C.assignment
else
.["user"]["job"] = "No Job"
/obj/machinery/mineral/equipment_vendor/Topic(href, href_list)
/obj/machinery/mineral/equipment_vendor/ui_act(action, params)
if(..())
return
if(href_list["purchase"])
var/mob/M = usr
var/obj/item/card/id/I = M.get_idcard(TRUE)
if(istype(I))
var/datum/data/mining_equipment/prize = locate(href_list["purchase"]) in prize_list
if (!prize || !(prize in prize_list))
to_chat(usr, "<span class='warning'>Error: Invalid choice!</span>")
switch(action)
if("purchase")
var/mob/M = usr
var/obj/item/card/id/I = M.get_idcard(TRUE)
if(!istype(I))
to_chat(usr, "<span class='alert'>Error: An ID is required!</span>")
flick(icon_deny, src)
return
var/datum/data/mining_equipment/prize = locate(params["ref"]) in prize_list
if(!prize || !(prize in prize_list))
to_chat(usr, "<span class='alert'>Error: Invalid choice!</span>")
flick(icon_deny, src)
return
if(prize.cost > I.mining_points)
to_chat(usr, "<span class='warning'>Error: Insufficient credits for [prize.equipment_name] on [I]!</span>")
to_chat(usr, "<span class='alert'>Error: Insufficient points for [prize.equipment_name] on [I]!</span>")
flick(icon_deny, src)
else
I.mining_points -= prize.cost
to_chat(usr, "<span class='notice'>[src] clanks to life briefly before vending [prize.equipment_name]!</span>")
new prize.equipment_path(src.loc)
SSblackbox.record_feedback("nested tally", "mining_equipment_bought", 1, list("[type]", "[prize.equipment_path]"))
else
to_chat(usr, "<span class='warning'>Error: An ID with a registered account is required!</span>")
flick(icon_deny, src)
updateUsrDialog()
return
return
I.mining_points -= prize.cost
to_chat(usr, "<span class='notice'>[src] clanks to life briefly before vending [prize.equipment_name]!</span>")
new prize.equipment_path(loc)
SSblackbox.record_feedback("nested tally", "mining_equipment_bought", 1, list("[type]", "[prize.equipment_path]"))
. = TRUE
/obj/machinery/mineral/equipment_vendor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/mining_voucher))
RedeemVoucher(I, user)
return
if(default_deconstruction_screwdriver(user, "mining-open", "mining", I))
return
if(default_deconstruction_crowbar(I))
return
return ..()
/obj/machinery/mineral/equipment_vendor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/mining_voucher))

View File

@@ -6,12 +6,15 @@
icon = 'icons/obj/economy.dmi'
icon_state = "coinpress0"
density = TRUE
var/newCoins = 0 //how many coins the machine made in it's last load
input_dir = EAST
ui_x = 300
ui_y = 250
needs_item_input = TRUE
var/obj/item/storage/bag/money/bag_to_use
var/produced_coins = 0 // how many coins the machine has made in it's last cycle
var/processing = FALSE
var/chosen = /datum/material/iron //which material will be used to make coins
var/coinsToProduce = 10
speed_process = TRUE
var/obj/item/storage/bag/money/bag_to_use
/obj/machinery/mineral/mint/Initialize()
. = ..()
@@ -28,89 +31,105 @@
/datum/material/mythril,
/datum/material/plastic,
/datum/material/runite
), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)
chosen = SSmaterials.GetMaterialRef(chosen)
), MINERAL_MATERIAL_AMOUNT * 75, FALSE, /obj/item/stack)
chosen = SSmaterials.GetMaterialRef(chosen)
/obj/machinery/mineral/mint/process()
var/turf/T = get_step(src, input_dir)
if(!T)
/obj/machinery/mineral/mint/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
if(QDELETED(target))
return
if(!istype(target, /obj/item/stack))
return
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/obj/item/stack/sheet/O in T)
var/inserted = materials.insert_item(O)
if(inserted)
qdel(O)
var/obj/item/stack/S = target
/obj/machinery/mineral/mint/attack_hand(mob/user)
if(materials.insert_item(S))
qdel(S)
/obj/machinery/mineral/mint/process()
if(processing)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/datum/material/M = chosen
if(!M)
processing = FALSE
icon_state = "coinpress0"
return
icon_state = "coinpress1"
var/coin_mat = MINERAL_MATERIAL_AMOUNT
for(var/sheets in 1 to 2)
if(materials.use_amount_mat(coin_mat, chosen))
for(var/coin_to_make in 1 to 5)
create_coins()
produced_coins++
CHECK_TICK
else
var/found_new = FALSE
for(var/datum/material/inserted_material in materials.materials)
var/amount = materials.get_material_amount(inserted_material)
if(amount)
chosen = inserted_material
found_new = TRUE
if(!found_new)
processing = FALSE
else
STOP_PROCESSING(SSmachines, src)
icon_state = "coinpress0"
/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "Mint", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/mineral/mint/ui_data()
var/list/data = list()
data["inserted_materials"] = list()
data["chosen_material"] = null
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/inserted_material in materials.materials)
var/amount = materials.get_material_amount(inserted_material)
if(!amount)
continue
data["inserted_materials"] += list(list(
"material" = inserted_material.name,
"amount" = amount,
))
if(chosen == inserted_material)
data["chosen_material"] = inserted_material.name
data["produced_coins"] = produced_coins
data["processing"] = processing
return data;
/obj/machinery/mineral/mint/ui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
var/dat = "<b>Coin Press</b><br>"
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/M in materials.materials)
var/amount = materials.get_material_amount(M)
if(!amount && chosen != M)
continue
dat += "<br><b>[M.name] amount:</b> [amount] cm<sup>3</sup> "
if (chosen == M)
dat += "<b>Chosen</b>"
else
dat += "<A href='?src=[REF(src)];choose=[REF(M)]'>Choose</A>"
var/datum/material/M = chosen
dat += "<br><br>Will produce [coinsToProduce] [lowertext(M.name)] coins if enough materials are available.<br>"
dat += "<A href='?src=[REF(src)];chooseAmt=-10'>-10</A> "
dat += "<A href='?src=[REF(src)];chooseAmt=-5'>-5</A> "
dat += "<A href='?src=[REF(src)];chooseAmt=-1'>-1</A> "
dat += "<A href='?src=[REF(src)];chooseAmt=1'>+1</A> "
dat += "<A href='?src=[REF(src)];chooseAmt=5'>+5</A> "
dat += "<A href='?src=[REF(src)];chooseAmt=10'>+10</A> "
dat += "<br><br>In total this machine produced <font color='green'><b>[newCoins]</b></font> coins."
dat += "<br><A href='?src=[REF(src)];makeCoins=[1]'>Make coins</A>"
user << browse(dat, "window=mint")
/obj/machinery/mineral/mint/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(processing==1)
to_chat(usr, "<span class='notice'>The machine is processing.</span>")
return
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(href_list["choose"])
var/datum/material/new_material = locate(href_list["choose"])
if(istype(new_material))
chosen = new_material
if(href_list["chooseAmt"])
coinsToProduce = clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
updateUsrDialog()
if(href_list["makeCoins"])
var/temp_coins = coinsToProduce
if(action == "startpress")
if (!processing)
produced_coins = 0
processing = TRUE
icon_state = "coinpress1"
var/coin_mat = MINERAL_MATERIAL_AMOUNT * 0.2
var/datum/material/M = chosen
if(!M)
updateUsrDialog()
return
while(coinsToProduce > 0 && materials.use_amount_mat(coin_mat, chosen))
create_coins()
coinsToProduce--
newCoins++
src.updateUsrDialog()
sleep(5)
icon_state = "coinpress0"
START_PROCESSING(SSmachines, src)
return TRUE
if (action == "stoppress")
processing = FALSE
coinsToProduce = temp_coins
src.updateUsrDialog()
return
STOP_PROCESSING(SSmachines, src)
return TRUE
if (action == "changematerial")
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/mat in materials.materials)
if (params["material_name"] == mat.name)
chosen = mat
return TRUE
/obj/machinery/mineral/mint/proc/create_coins()
var/turf/T = get_step(src,output_dir)

View File

@@ -9,6 +9,9 @@
density = TRUE
pressure_resistance = 5*ONE_ATMOSPHERE
var/ui_x = 335
var/ui_y = 415
/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
if (istype(W, /obj/item/stack/ore))
user.transferItemToLoc(W, src)
@@ -24,16 +27,16 @@
/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
if(I.use_tool(src, user, 50, volume=50))
user.visible_message("[user] pries \the [src] apart.",
user.visible_message("<span class='notice'>[user] pries \the [src] apart.</span>",
"<span class='notice'>You pry apart \the [src].</span>",
"<span class='italics'>You hear splitting wood.</span>")
"<span class='hear'>You hear splitting wood.</span>")
deconstruct(TRUE, user)
return TRUE
/obj/structure/ore_box/examine(mob/living/user)
if(Adjacent(user) && istype(user))
ui_interact(user)
return ..()
. = ..()
/obj/structure/ore_box/attack_hand(mob/user)
. = ..()
@@ -62,7 +65,7 @@
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ore_box", name, 335, 415, master_ui, state)
ui = new(user, src, ui_key, "OreBox", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/structure/ore_box/ui_data()