MISC: Refactor code of traveling and going to location (#1365)

This commit is contained in:
catloversg
2024-06-09 03:52:10 +07:00
committed by GitHub
parent b8f03cb50b
commit a354867fc4
8 changed files with 38 additions and 34 deletions
+5 -1
View File
@@ -79,7 +79,11 @@ export function NetscriptSleeve(): InternalAPI<NetscriptSleeve> {
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
checkSleeveAPIAccess(ctx);
checkSleeveNumber(ctx, sleeveNumber);
return Player.sleeves[sleeveNumber].travel(cityName);
if (!Player.sleeves[sleeveNumber].travel(cityName)) {
helpers.log(ctx, () => "Not enough money to travel.");
return false;
}
return true;
},
setToCompanyWork: (ctx) => (_sleeveNumber, _companyName) => {
const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber);