make crime unfocusable

This commit is contained in:
Olivier Gagnon 2022-07-14 15:53:42 -04:00
parent fac6633347
commit 28956d8fd6
3 changed files with 14 additions and 0 deletions

@ -107,6 +107,7 @@ export class Crime {
singularity: workerScript !== null,
}),
);
p.focus = true;
router.toWork();
return this.time;

@ -33,6 +33,7 @@ import { isGraftingWork } from "../../Work/GraftingWork";
import { isFactionWork } from "../../Work/FactionWork";
import { ReputationRate } from "./ReputationRate";
import { isCompanyWork } from "../../Work/CompanyWork";
import { isCrimeWork } from "../../Work/CrimeWork";
interface IProps {
save: () => void;
@ -149,6 +150,14 @@ function Work(): React.ReactElement {
let details = <></>;
let header = <></>;
let innerText = <></>;
if (isCrimeWork(player.currentWork)) {
const crime = player.currentWork.getCrime();
const perc = ((player.currentWork.cyclesWorked * CONSTANTS._idleSpeed) / crime.time) * 100;
details = <>{player.currentWork.crimeType}</>;
header = <>You are attempting to {player.currentWork.crimeType}</>;
innerText = <>{perc.toFixed(2)}%</>;
}
if (isClassWork(player.currentWork)) {
details = <>{player.currentWork.getClass().youAreCurrently}</>;
header = <>You are {player.currentWork.getClass().youAreCurrently}</>;

@ -153,6 +153,10 @@ export function WorkInProgressRoot(): React.ReactElement {
router.toLocation(Locations[LocationName.Slums]);
player.finishNEWWork(true);
},
unfocus: () => {
router.toCity();
player.stopFocusing();
},
},
title: `You are attempting to ${crime.type}`,