From f6e8f317b321f013ec113233ad2f72eb7ee31415 Mon Sep 17 00:00:00 2001 From: mochi Date: Mon, 20 Jul 2020 11:57:54 +0200 Subject: [PATCH] Fix ghost interact, ENTER works on modal, knob position --- code/game/machinery/Sleeper.dm | 2 +- code/game/machinery/adv_med.dm | 2 +- code/game/machinery/cryo.dm | 2 +- .../chemistry/machinery/chem_dispenser.dm | 6 ++--- .../chemistry/machinery/chem_heater.dm | 3 +-- .../chemistry/machinery/chem_master.dm | 3 +-- tgui/packages/tgui/components/Knob.js | 6 ++++- tgui/packages/tgui/components/Modal.js | 10 ++++++- tgui/packages/tgui/interfaces/DNAModifier.js | 2 ++ .../tgui/interfaces/common/ComplexModal.js | 27 ++++++++++++++++++- .../packages/tgui/styles/components/Knob.scss | 7 ++++- 11 files changed, 56 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index e9d1ca693e4..31c62defc46 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -125,7 +125,7 @@ return attack_hand(user) /obj/machinery/sleeper/attack_ghost(mob/user) - return attack_hand(user) + tgui_interact(user) /obj/machinery/sleeper/attack_hand(mob/user) if(stat & (NOPOWER|BROKEN)) diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index e485402ed38..39df08ba64c 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -134,7 +134,7 @@ return attack_hand(user) /obj/machinery/bodyscanner/attack_ghost(user) - return attack_hand(user) + tgui_interact(user) /obj/machinery/bodyscanner/attack_hand(user) if(stat & (NOPOWER|BROKEN)) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index ff46f079cc5..262db8f7b56 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -185,7 +185,7 @@ return /obj/machinery/atmospherics/unary/cryo_cell/attack_ghost(mob/user) - return attack_hand(user) + tgui_interact(user) /obj/machinery/atmospherics/unary/cryo_cell/attack_hand(mob/user) if(user == occupant) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 6f310856970..800827aa037 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -309,13 +309,13 @@ return attack_hand(user) /obj/machinery/chem_dispenser/attack_ghost(mob/user) - if(user.can_admin_interact()) - return attack_hand(user) + if(stat & BROKEN) + return + tgui_interact(user) /obj/machinery/chem_dispenser/attack_hand(mob/user) if(stat & BROKEN) return - tgui_interact(user) /obj/machinery/chem_dispenser/soda diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 2e49208f2c3..b76cdc622e9 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -91,8 +91,7 @@ tgui_interact(user) /obj/machinery/chem_heater/attack_ghost(mob/user) - if(user.can_admin_interact()) - return attack_hand(user) + tgui_interact(user) /obj/machinery/chem_heater/attack_ai(mob/user) add_hiddenprint(user) diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index d1ab0c3e7e7..12705f38f9e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -238,8 +238,7 @@ return attack_hand(user) /obj/machinery/chem_master/attack_ghost(mob/user) - if(user.can_admin_interact()) - return attack_hand(user) + tgui_interact(user) /obj/machinery/chem_master/attack_hand(mob/user) if(..()) diff --git a/tgui/packages/tgui/components/Knob.js b/tgui/packages/tgui/components/Knob.js index 501308aea8d..0e817111653 100644 --- a/tgui/packages/tgui/components/Knob.js +++ b/tgui/packages/tgui/components/Knob.js @@ -35,6 +35,7 @@ export const Knob = props => { size, bipolar, children, + popUpPosition, ...rest } = props; return ( @@ -102,7 +103,10 @@ export const Knob = props => { {dragging && ( -
+
{displayElement}
)} diff --git a/tgui/packages/tgui/components/Modal.js b/tgui/packages/tgui/components/Modal.js index 916150de402..49b9fd735f0 100644 --- a/tgui/packages/tgui/components/Modal.js +++ b/tgui/packages/tgui/components/Modal.js @@ -6,10 +6,18 @@ export const Modal = props => { const { className, children, + onEnter, ...rest } = props; + let handleKeyDown; + if (onEnter) { + handleKeyDown = e => { + onEnter(e); + }; + } return ( - +
{ maxValue="10" stepPixelSize="20" value={radiationIntensity} + popUpPosition="right" ml="0" onChange={(e, val) => act('radiationIntensity', { value: val })} /> @@ -313,6 +314,7 @@ const DNAModifierMainRadiationEmitter = (props, context) => { stepPixelSize="10" unit="s" value={radiationDuration} + popUpPosition="right" ml="0" onChange={(e, val) => act('radiationDuration', { value: val })} /> diff --git a/tgui/packages/tgui/interfaces/common/ComplexModal.js b/tgui/packages/tgui/interfaces/common/ComplexModal.js index c222e8d73d8..b5420443b2e 100644 --- a/tgui/packages/tgui/interfaces/common/ComplexModal.js +++ b/tgui/packages/tgui/interfaces/common/ComplexModal.js @@ -79,6 +79,7 @@ export const ComplexModal = (props, context) => { type, } = data.modal; + let modalOnEnter; let modalBody; let modalFooter = (