From dd87a1bad322a0ee15d4a945de00aa77d80c58b7 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 10 Jun 2018 00:55:25 -0400 Subject: [PATCH] prevent players from doing work through singularity in BN2 when the player already joined a faction --- src/NetscriptFunctions.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 23faf4ee1..1783a4606 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -14,6 +14,7 @@ import {CONSTANTS} from "./Constants.js"; import {Programs} from "./CreateProgram.js"; import {parseDarkwebItemPrice, DarkWebItems} from "./DarkWeb.js"; import {Engine} from "./engine.js"; +import {AllGangs} from "./Gang.js"; import {Factions, Faction, joinFaction, factionExists, purchaseAugmentation} from "./Faction.js"; import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode.js"; @@ -2777,6 +2778,12 @@ function NetscriptFunctions(workerScript) { } } + // if the player is in a gang and the target faction is any of the gang faction, fail + if(Player.gang != null && AllGangs[name] !== undefined) { + workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not offer work at the moment."); + return; + } + if (inMission) { workerScript.scriptRef.log("ERROR: workForFaction() failed because you are in the middle of a mission."); return;