Skip to content

Commit

Permalink
Fix simulators demolition button (#5359)
Browse files Browse the repository at this point in the history
# About the pull request

This PR is a followup to #5318 that changed a var used to determine
whether detonation is possible.

# Explain why it's good for the game

Simulator is useless without this functionality.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![bombs](https://github.com/cmss13-devs/cmss13/assets/76988376/f8387688-a34f-4e59-b21d-c0497e8e0cdd)

</details>


# Changelog
:cl: Drathek
fix: Fixed simulators detonation button
/:cl:
  • Loading branch information
Drulikar committed Jan 6, 2024
1 parent 24231ab commit 63b1ad6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tgui/packages/tgui/interfaces/CasSim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box, Button, Section, ProgressBar, NoticeBox, Stack } from '../componen

interface CasSimData {
configuration: any;
looking: 0 | 1;
dummy_mode: string;
worldtime: number;
nextdetonationtime: number;
Expand All @@ -21,7 +20,7 @@ export const CasSim = (_props, context) => {
const timeLeft = data.nextdetonationtime - data.worldtime;
const timeLeftPct = timeLeft / data.detonation_cooldown;

const canDetonate = timeLeft < 0 && data.configuration && data.looking;
const canDetonate = timeLeft < 0 && data.configuration && simulationView;

return (
<Box className="CasSim">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ import { useBackend, useLocalState } from '../backend';
import { Button, Section, ProgressBar, NoticeBox, Box, Stack } from '../components';
import { Window } from '../layouts';

interface DemoSimData {
configuration: any;
dummy_mode: string;
worldtime: number;
nextdetonationtime: number;
detonation_cooldown: number;
}

export const DemoSim = (_props, context) => {
const { act, data } = useBackend(context);
const { act, data } = useBackend<DemoSimData>(context);
const [simulationView, setSimulationView] = useLocalState(
context,
'simulation_view',
Expand All @@ -13,7 +21,7 @@ export const DemoSim = (_props, context) => {
const timeLeft = data.nextdetonationtime - data.worldtime;
const timeLeftPct = timeLeft / data.detonation_cooldown;

const canDetonate = timeLeft < 0 && data.configuration && data.looking;
const canDetonate = timeLeft < 0 && data.configuration && simulationView;

return (
<Window width={550} height={300}>
Expand Down

0 comments on commit 63b1ad6

Please sign in to comment.