mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Merge pull request #2790 from SlyCedix/travelToCity-money-fix
Make travelToCity throw on invalid city name and return false on no money
This commit is contained in:
commit
0dd339bb4d
@ -474,7 +474,8 @@ export function NetscriptSingularity(
|
|||||||
case CityName.Ishima:
|
case CityName.Ishima:
|
||||||
case CityName.Volhaven:
|
case CityName.Volhaven:
|
||||||
if (player.money < CONSTANTS.TravelCost) {
|
if (player.money < CONSTANTS.TravelCost) {
|
||||||
throw helper.makeRuntimeErrorMsg("travelToCity", "Not enough money to travel.");
|
workerScript.log("travelToCity", () => "Not enough money to travel.");
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
player.loseMoney(CONSTANTS.TravelCost, "other");
|
player.loseMoney(CONSTANTS.TravelCost, "other");
|
||||||
player.city = cityname;
|
player.city = cityname;
|
||||||
@ -482,8 +483,7 @@ export function NetscriptSingularity(
|
|||||||
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50000);
|
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50000);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
workerScript.log("travelToCity", () => `Invalid city name: '${cityname}'.`);
|
throw helper.makeRuntimeErrorMsg("travelToCity", `Invalid city name: '${cityname}'.`);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user