From 19949b842bde9c32cb9f15952372915e16618815 Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 9 Jun 2020 11:05:54 +0300 Subject: [PATCH] Transfer valve and VR sleeper --- .../objects/items/devices/transfer_valve.dm | 76 ++++++++++++++----- code/modules/VR/vr_sleeper.dm | 2 - .../tgui/interfaces/SyndContractor.js | 2 +- tgui/packages/tgui/interfaces/VrSleeper.js | 4 +- 4 files changed, 62 insertions(+), 22 deletions(-) diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 7caf263611..6124138aeb 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -7,14 +7,14 @@ righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi' desc = "Regulates the transfer of air between two tanks." w_class = WEIGHT_CLASS_BULKY - var/ui_x = 310 - var/ui_y = 320 var/obj/item/tank/tank_one var/obj/item/tank/tank_two var/obj/item/assembly/attached_device var/mob/attacher = null var/valve_open = FALSE - var/toggle = TRUE + var/toggle = 1 + var/ui_x = 310 + var/ui_y = 320 /obj/item/transfer_valve/IsAssemblyHolder() return TRUE @@ -59,7 +59,7 @@ attacher = user return -//These keep attached devices synced up, for example a TTV with a mouse trap being found in a bag so it's triggered, or moving the TTV with an infrared beam sensor to update the beam's direction. +//Attached device memes /obj/item/transfer_valve/Move() . = ..() if(attached_device) @@ -79,14 +79,58 @@ if(attached_device) attached_device.Crossed(AM) -//Triggers mousetraps -/obj/item/transfer_valve/attack_hand() +/obj/item/transfer_valve/attack_hand()//Triggers mousetraps . = ..() if(.) return if(attached_device) attached_device.attack_hand() +//These keep attached devices synced up, for example a TTV with a mouse trap being found in a bag so it's triggered, or moving the TTV with an infrared beam sensor to update the beam's direction. + + +/obj/item/transfer_valve/attack_self(mob/user) + user.set_machine(src) + var/dat = {" Valve properties: +
Attachment one: [tank_one] [tank_one ? "Remove" : ""] +
Attachment two: [tank_two] [tank_two ? "Remove" : ""] +
Valve attachment: [attached_device ? "[attached_device]" : "None"] [attached_device ? "Remove" : ""] +
Valve status: [ valve_open ? "Closed Open" : "Closed Open"]"} + + var/datum/browser/popup = new(user, "trans_valve", name) + popup.set_content(dat) + popup.open() + return + +/obj/item/transfer_valve/Topic(href, href_list) + ..() + if(!usr.canUseTopic(src)) + return + if(tank_one && href_list["tankone"]) + split_gases() + valve_open = FALSE + tank_one.forceMove(drop_location()) + tank_one = null + update_icon() + else if(tank_two && href_list["tanktwo"]) + split_gases() + valve_open = FALSE + tank_two.forceMove(drop_location()) + tank_two = null + update_icon() + else if(href_list["open"]) + toggle_valve() + else if(attached_device) + if(href_list["rem_device"]) + attached_device.on_detach() + attached_device = null + update_icon() + if(href_list["device"]) + attached_device.attack_self(usr) + + attack_self(usr) + add_fingerprint(usr) + /obj/item/transfer_valve/proc/process_activation(obj/item/D) if(toggle) toggle = FALSE @@ -98,6 +142,7 @@ /obj/item/transfer_valve/update_icon() cut_overlays() + underlays = null if(!tank_one && !tank_two && !attached_device) icon_state = "valve_1" @@ -107,13 +152,9 @@ if(tank_one) add_overlay("[tank_one.icon_state]") if(tank_two) - var/mutable_appearance/J = mutable_appearance(icon, icon_state = "[tank_two.icon_state]") - var/matrix/T = matrix() - T.Translate(-13, 0) - J.transform = T - underlays = list(J) - else - underlays = null + var/icon/J = new(icon, icon_state = "[tank_two.icon_state]") + J.Shift(WEST, 13) + underlays += J if(attached_device) add_overlay("device") if(istype(attached_device, /obj/item/assembly/infra)) @@ -151,6 +192,7 @@ Exadv1: I know this isn't how it's going to work, but this was just to check it explodes properly when it gets a signal (and it does). */ + /obj/item/transfer_valve/proc/toggle_valve() if(!valve_open && tank_one && tank_two) valve_open = TRUE @@ -176,6 +218,7 @@ admin_bomber_message = " - Last touched by: [ADMIN_LOOKUPFLW(bomber)]" bomber_message = " - Last touched by: [key_name_admin(bomber)]" + var/admin_bomb_message = "Bomb valve opened in [ADMIN_VERBOSEJMP(bombturf)][admin_attachment_message][admin_bomber_message]" GLOB.bombers += admin_bomb_message message_admins(admin_bomb_message, 0, 1) @@ -189,10 +232,9 @@ split_gases() valve_open = FALSE update_icon() -/* - This doesn't do anything but the timer etc. expects it to be here - eventually maybe have it update icon to show state (timer, prox etc.) like old bombs -*/ + +// this doesn't do anything but the timer etc. expects it to be here +// eventually maybe have it update icon to show state (timer, prox etc.) like old bombs /obj/item/transfer_valve/proc/c_state() return diff --git a/code/modules/VR/vr_sleeper.dm b/code/modules/VR/vr_sleeper.dm index fdad89eeaf..49fb70f072 100644 --- a/code/modules/VR/vr_sleeper.dm +++ b/code/modules/VR/vr_sleeper.dm @@ -113,12 +113,10 @@ to_chat(occupant, "The virtual world does not support the creation of new virtual avatars, aborting transfer") else to_chat(vr_mob, "Transfer successful! You are now playing as [vr_mob] in VR!") - M.ui_close(M) //The UI can get stuck open while in VR, which can be annoying . = TRUE if("delete_avatar") if(!occupant || usr == occupant) if(vr_mob) - SStgui.try_update_ui(occupant, src) cleanup_vr_mob() else to_chat(usr, "The VR Sleeper's safeties prevent you from doing that.") diff --git a/tgui/packages/tgui/interfaces/SyndContractor.js b/tgui/packages/tgui/interfaces/SyndContractor.js index 0e9129cb4b..f717d681e2 100644 --- a/tgui/packages/tgui/interfaces/SyndContractor.js +++ b/tgui/packages/tgui/interfaces/SyndContractor.js @@ -303,7 +303,7 @@ const ContractsTab = (props, context) => { return (
{
)} - {data.vr_avatar && ( + {...!!data.vr_avatar && (
{ ) || ("You need to be inside the VR sleeper to connect to VR")}
- {data.can_delete_avatar && ( + {!!data.vr_avatar && (