mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Merge pull request #3349 from phyzical/bugfix/3347
add logic to block sleeve working for gang faction
This commit is contained in:
commit
4cdef2d898
@ -122,7 +122,11 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
|
||||
return player.sleeves[sleeveNumber].workForCompany(player, companyName);
|
||||
},
|
||||
setToFactionWork: function (_sleeveNumber: unknown, _factionName: unknown, _workType: unknown): boolean {
|
||||
setToFactionWork: function (
|
||||
_sleeveNumber: unknown,
|
||||
_factionName: unknown,
|
||||
_workType: unknown,
|
||||
): boolean | undefined {
|
||||
const sleeveNumber = helper.number("setToFactionWork", "sleeveNumber", _sleeveNumber);
|
||||
const factionName = helper.string("setToUniversityCourse", "factionName", _factionName);
|
||||
const workType = helper.string("setToUniversityCourse", "workType", _workType);
|
||||
@ -144,6 +148,13 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
}
|
||||
}
|
||||
|
||||
if (player.gang && player.gang.facName == factionName) {
|
||||
throw helper.makeRuntimeErrorMsg(
|
||||
"sleeve.setToFactionWork",
|
||||
`Sleeve ${sleeveNumber} cannot work for faction ${factionName} because you have started a gang with them.`,
|
||||
);
|
||||
}
|
||||
|
||||
return player.sleeves[sleeveNumber].workForFaction(player, factionName, workType);
|
||||
},
|
||||
setToGymWorkout: function (_sleeveNumber: unknown, _gymName: unknown, _stat: unknown): boolean {
|
||||
|
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3637,9 +3637,9 @@ export interface Sleeve {
|
||||
* @param sleeveNumber - Index of the sleeve to work for the faction.
|
||||
* @param factionName - Name of the faction to work for.
|
||||
* @param factionWorkType - Name of the action to perform for this faction.
|
||||
* @returns True if the sleeve started working on this faction, false otherwise.
|
||||
* @returns True if the sleeve started working on this faction, false otherwise, can also throw on errors
|
||||
*/
|
||||
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: string): boolean;
|
||||
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: string): boolean | undefined;
|
||||
|
||||
/**
|
||||
* Set a sleeve to work for a company.
|
||||
|
Loading…
Reference in New Issue
Block a user