TGUI Research

This commit is contained in:
ShadowLarkens
2020-08-25 13:25:57 -07:00
parent 3de27a9e8f
commit 097d4fa283
144 changed files with 9345 additions and 4773 deletions
@@ -77,6 +77,9 @@
return "[..()][append]"
/obj/item/device/radio/headset/tgui_state(mob/user)
return GLOB.tgui_inventory_state
/obj/item/device/radio/headset/syndicate
origin_tech = list(TECH_ILLEGAL = 3)
syndie = 1
@@ -168,7 +168,7 @@ var/global/list/default_medbay_channels = list(
/obj/item/device/radio/tgui_data(mob/user)
var/data[0]
data["rawfreq"] = num2text(frequency)
data["rawfreq"] = frequency
data["listening"] = listening
data["broadcasting"] = broadcasting
data["subspace"] = subspace_transmission
@@ -5,7 +5,7 @@
icon_state = "valve_1"
var/obj/item/weapon/tank/tank_one
var/obj/item/weapon/tank/tank_two
var/obj/item/device/attached_device
var/obj/item/device/assembly/attached_device
var/mob/attacher = null
var/valve_open = 0
var/toggle = 1
@@ -20,18 +20,18 @@
if(!tank_one)
tank_one = item
user.drop_item()
item.loc = src
item.forceMove(src)
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
else if(!tank_two)
tank_two = item
user.drop_item()
item.loc = src
item.forceMove(src)
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
message_admins("[key_name_admin(user)] attached both tanks to a transfer valve. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[location.x];Y=[location.y];Z=[location.z]'>JMP</a>)")
log_game("[key_name_admin(user)] attached both tanks to a transfer valve.")
update_icon()
SSnanoui.update_uis(src) // update all UIs attached to src
SStgui.update_uis(src) // update all UIs attached to src
//TODO: Have this take an assemblyholder
else if(isassembly(item))
var/obj/item/device/assembly/A = item
@@ -43,7 +43,7 @@
return
user.remove_from_mob(item)
attached_device = A
A.loc = src
A.forceMove(src)
to_chat(user, "<span class='notice'>You attach the [item] to the valve controls and secure it.</span>")
A.holder = src
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
@@ -52,7 +52,7 @@
message_admins("[key_name_admin(user)] attached a [item] to a transfer valve. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[location.x];Y=[location.y];Z=[location.z]'>JMP</a>)")
log_game("[key_name_admin(user)] attached a [item] to a transfer valve.")
attacher = user
SSnanoui.update_uis(src) // update all UIs attached to src
SStgui.update_uis(src) // update all UIs attached to src
return
@@ -66,53 +66,51 @@
if(isturf(loc))
sense_proximity(callback = .HasProximity)
/obj/item/device/transfer_valve/attack_self(mob/user as mob)
ui_interact(user)
/obj/item/device/transfer_valve/attack_self(mob/user)
tgui_interact(user)
/obj/item/device/transfer_valve/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/item/device/transfer_valve/tgui_state(mob/user)
return GLOB.tgui_inventory_state
// this is the data which will be sent to the ui
var/data[0]
data["attachmentOne"] = tank_one ? tank_one.name : null
data["attachmentTwo"] = tank_two ? tank_two.name : null
data["valveAttachment"] = attached_device ? attached_device.name : null
data["valveOpen"] = valve_open ? 1 : 0
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "transfer_valve.tmpl", "Tank Transfer Valve", 460, 280)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
/obj/item/device/transfer_valve/tgui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "TransferValve", name) // 460, 320
ui.open()
// auto update every Master Controller tick
//ui.set_auto_update(1)
/obj/item/device/transfer_valve/Topic(href, href_list)
..()
if ( usr.stat || usr.restrained() )
return 0
if (src.loc != usr)
return 0
if(tank_one && href_list["tankone"])
remove_tank(tank_one)
else if(tank_two && href_list["tanktwo"])
remove_tank(tank_two)
else if(href_list["open"])
toggle_valve()
else if(attached_device)
if(href_list["rem_device"])
attached_device.loc = get_turf(src)
attached_device:holder = null
attached_device = null
update_icon()
if(href_list["device"])
attached_device.attack_self(usr)
src.add_fingerprint(usr)
return 1 // Returning 1 sends an update to attached UIs
/obj/item/device/transfer_valve/tgui_data(mob/user)
var/list/data = list()
data["tank_one"] = tank_one ? tank_one.name : null
data["tank_two"] = tank_two ? tank_two.name : null
data["attached_device"] = attached_device ? attached_device.name : null
data["valve"] = valve_open
return data
/obj/item/device/transfer_valve/tgui_act(action, params)
if(..())
return
. = TRUE
switch(action)
if("tankone")
remove_tank(tank_one)
if("tanktwo")
remove_tank(tank_two)
if("toggle")
toggle_valve()
if("device")
if(attached_device)
attached_device.attack_self(usr)
if("remove_device")
if(attached_device)
attached_device.forceMove(get_turf(src))
attached_device.holder = null
attached_device = null
update_icon()
else
. = FALSE
if(.)
update_icon()
add_fingerprint(usr)
/obj/item/device/transfer_valve/proc/process_activation(var/obj/item/device/D)
if(toggle)
@@ -148,7 +146,7 @@
else
return
T.loc = get_turf(src)
T.forceMove(get_turf(src))
update_icon()
/obj/item/device/transfer_valve/proc/merge_gases()
@@ -6,6 +6,8 @@
desc = "Protected by FRM."
icon = 'icons/obj/module.dmi'
icon_state = "cyborg_upgrade"
/// Bitflags listing module compatibility. Used in the exosuit fabricator for creating sub-categories.
var/list/module_flags = NONE
var/locked = 0
var/require_module = 0
var/installed = 0
@@ -95,6 +97,7 @@
desc = "Used to cool a mounted taser, increasing the potential current in it and thus its recharge rate."
icon_state = "cyborg_upgrade3"
item_state = "cyborg_upgrade"
module_flags = BORG_MODULE_SECURITY
require_module = 1
@@ -77,6 +77,9 @@
get_asset_datum(/datum/asset/spritesheet/pipes),
)
/obj/item/weapon/pipe_dispenser/tgui_state(mob/user)
return GLOB.tgui_inventory_state
/obj/item/weapon/pipe_dispenser/tgui_interact(mob/user, datum/tgui/ui)
SetupPipes()
ui = SStgui.try_update_ui(user, src, ui)
@@ -78,7 +78,7 @@ obj/item/weapon/circuitboard/rdserver/attackby(obj/item/I as obj, mob/user as mo
/obj/item/weapon/circuitboard/prosthetics
name = "Circuit board (Prosthetics Fabricator)"
build_path = /obj/machinery/pros_fabricator
build_path = /obj/machinery/mecha_part_fabricator/pros
board_type = new /datum/frame/frame_types/machine
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 3)
req_components = list(
@@ -40,6 +40,9 @@
/obj/item/weapon/card/id/proc/prevent_tracking()
return 0
/obj/item/weapon/card/id/tgui_state(mob/user)
return GLOB.tgui_deep_inventory_state
/obj/item/weapon/card/id/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
@@ -223,6 +223,8 @@ var/list/global/tank_gauge_cache = list()
if (src.proxyassembly.assembly)
src.proxyassembly.assembly.attack_self(user)
/obj/item/weapon/tank/tgui_state(mob/user)
return GLOB.tgui_deep_inventory_state
/obj/item/weapon/tank/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)