mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
You can no longer use communications consoles off a station/CentCom z-level. (#55524)
Closes #55517 by making it so communications consoles don't work off of the station z-level. If you want to impact the game for nearly every player, it's now more likely you're impacted by it as well. Also prevents people from hiding in things like asteroids or drones from constantly recalling/calling.
This commit is contained in:
@@ -86,6 +86,9 @@
|
||||
if (.)
|
||||
return
|
||||
|
||||
if (!has_communication())
|
||||
return
|
||||
|
||||
. = TRUE
|
||||
|
||||
switch (action)
|
||||
@@ -323,6 +326,7 @@
|
||||
var/list/data = list(
|
||||
"authenticated" = FALSE,
|
||||
"emagged" = FALSE,
|
||||
"hasConnection" = has_communication(),
|
||||
)
|
||||
|
||||
var/ui_state = issilicon(user) ? cyborg_state : state
|
||||
@@ -436,6 +440,12 @@
|
||||
"maxMessageLength" = MAX_MESSAGE_LEN,
|
||||
)
|
||||
|
||||
/// Returns whether or not the communications console can communicate with the station
|
||||
/obj/machinery/computer/communications/proc/has_communication()
|
||||
var/turf/current_turf = get_turf(src)
|
||||
var/z_level = current_turf.z
|
||||
return is_station_level(z_level) || is_centcom_level(z_level)
|
||||
|
||||
/obj/machinery/computer/communications/proc/set_state(mob/user, new_state)
|
||||
if (issilicon(user))
|
||||
cyborg_state = new_state
|
||||
@@ -496,7 +506,6 @@
|
||||
|
||||
frequency.post_signal(src, status_signal)
|
||||
|
||||
|
||||
/obj/machinery/computer/communications/Destroy()
|
||||
GLOB.shuttle_caller_list -= src
|
||||
SSshuttle.autoEvac()
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { Component } from 'inferno';
|
||||
|
||||
const DEFAULT_BLINKING_INTERVAL = 1000;
|
||||
const DEFAULT_BLINKING_TIME = 1000;
|
||||
|
||||
export class Blink extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
hidden: false,
|
||||
};
|
||||
}
|
||||
|
||||
createTimer() {
|
||||
const {
|
||||
interval = DEFAULT_BLINKING_INTERVAL,
|
||||
time = DEFAULT_BLINKING_TIME,
|
||||
} = this.props;
|
||||
|
||||
clearInterval(this.interval);
|
||||
clearTimeout(this.timer);
|
||||
|
||||
this.setState({
|
||||
hidden: false,
|
||||
});
|
||||
|
||||
this.interval = setInterval(() => {
|
||||
this.setState({
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
this.timer = setTimeout(() => {
|
||||
this.setState({
|
||||
hidden: false,
|
||||
});
|
||||
}, time);
|
||||
}, interval + time);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.createTimer();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.interval !== this.props.interval
|
||||
|| prevProps.time !== this.props.time) {
|
||||
this.createTimer();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearInterval(this.interval);
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
||||
render(props) {
|
||||
return (
|
||||
<span style={{
|
||||
visibility: this.state.hidden ? "hidden" : "visible",
|
||||
}}>
|
||||
{props.children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
export { AnimatedNumber } from './AnimatedNumber';
|
||||
export { Blink } from './Blink';
|
||||
export { BlockQuote } from './BlockQuote';
|
||||
export { Box } from './Box';
|
||||
export { Button } from './Button';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend, useLocalState } from '../backend';
|
||||
import { BlockQuote, Box, Button, ByondUi, Collapsible, DraggableControl, Flex, Icon, Input, Knob, LabeledList, NoticeBox, NumberInput, ProgressBar, Section, Slider, Tabs, Tooltip } from '../components';
|
||||
import { Blink, BlockQuote, Box, Button, ByondUi, Collapsible, DraggableControl, Flex, Icon, Input, Knob, LabeledList, NoticeBox, NumberInput, ProgressBar, Section, Slider, Tabs, Tooltip } from '../components';
|
||||
import { formatSiUnit } from '../format';
|
||||
import { Pane, Window } from '../layouts';
|
||||
import { createLogger } from '../logging';
|
||||
@@ -41,6 +41,10 @@ const PAGES = [
|
||||
title: 'Button',
|
||||
component: () => KitchenSinkButton,
|
||||
},
|
||||
{
|
||||
title: 'Blink',
|
||||
component: () => KitchenSinkBlinker,
|
||||
},
|
||||
{
|
||||
title: 'Box',
|
||||
component: () => KitchenSinkBox,
|
||||
@@ -175,6 +179,16 @@ const KitchenSinkButton = props => {
|
||||
);
|
||||
};
|
||||
|
||||
const KitchenSinkBlinker = props => {
|
||||
return (
|
||||
<Section>
|
||||
<Blink>
|
||||
Blink
|
||||
</Blink>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
const KitchenSinkBox = props => {
|
||||
return (
|
||||
<Section>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { sortBy } from "common/collections";
|
||||
import { capitalize } from "common/string";
|
||||
import { useBackend, useLocalState } from "../backend";
|
||||
import { Box, Button, Flex, Input, Modal, Section, Table, TextArea } from "../components";
|
||||
import { Blink, Box, Button, Dimmer, Flex, Icon, Input, Modal, Section, TextArea } from "../components";
|
||||
import { Window } from "../layouts";
|
||||
import { sanitizeText } from "../sanitize";
|
||||
|
||||
@@ -106,6 +106,40 @@ const MessageModal = (props, context) => {
|
||||
);
|
||||
};
|
||||
|
||||
const NoConnectionModal = () => {
|
||||
return (
|
||||
<Dimmer>
|
||||
<Flex direction="column" textAlign="center" width="300px">
|
||||
<Flex.Item>
|
||||
<Icon
|
||||
color="red"
|
||||
name="wifi"
|
||||
size={10}
|
||||
/>
|
||||
|
||||
<Blink>
|
||||
<div
|
||||
style={{
|
||||
background: "#db2828",
|
||||
bottom: "60%",
|
||||
left: "25%",
|
||||
height: "10px",
|
||||
position: "relative",
|
||||
transform: "rotate(45deg)",
|
||||
width: "150px",
|
||||
}}
|
||||
/>
|
||||
</Blink>
|
||||
</Flex.Item>
|
||||
|
||||
<Flex.Item fontSize="16px">
|
||||
A connection to the station cannot be established.
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
</Dimmer>
|
||||
);
|
||||
};
|
||||
|
||||
const PageBuyingShuttle = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
@@ -648,6 +682,7 @@ export const CommunicationsConsole = (props, context) => {
|
||||
authorizeName,
|
||||
canLogOut,
|
||||
emagged,
|
||||
hasConnection,
|
||||
page,
|
||||
} = data;
|
||||
|
||||
@@ -658,6 +693,8 @@ export const CommunicationsConsole = (props, context) => {
|
||||
theme={emagged ? "syndicate" : undefined}
|
||||
resizable>
|
||||
<Window.Content scrollable>
|
||||
{!hasConnection && <NoConnectionModal />}
|
||||
|
||||
{(canLogOut || !authenticated)
|
||||
? (
|
||||
<Section title="Authentication">
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user