From 633296da15a9a722db806d5c5fd101b2ac6017c2 Mon Sep 17 00:00:00 2001 From: G4mingJon4s <40526179+G4mingJon4s@users.noreply.github.com> Date: Sun, 4 Dec 2022 04:58:40 +0100 Subject: [PATCH] Added check if factionWork is from faction of gang (#243) --- src/PersonObjects/Player/PlayerObjectGangMethods.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PersonObjects/Player/PlayerObjectGangMethods.ts b/src/PersonObjects/Player/PlayerObjectGangMethods.ts index 9911349cd..77d510068 100644 --- a/src/PersonObjects/Player/PlayerObjectGangMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectGangMethods.ts @@ -3,6 +3,7 @@ import { Faction } from "../../Faction/Faction"; import { Gang } from "../../Gang/Gang"; import { PlayerObject } from "./PlayerObject"; import { GangConstants } from "../../Gang/data/Constants"; +import { isFactionWork } from "../../Work/FactionWork"; export function canAccessGang(this: PlayerObject): boolean { if (this.bitNodeN === 2) { @@ -40,6 +41,9 @@ export function hasGangWith(this: PlayerObject, facName: string): boolean { } export function startGang(this: PlayerObject, factionName: string, hacking: boolean): void { + // isFactionWork handles null internally, finishWork might need to be run with true + if (isFactionWork(this.currentWork) && this.currentWork.factionName === factionName) this.finishWork(false); + this.gang = new Gang(factionName, hacking); const fac = Factions[factionName];