Fixed adjustBotHostilitySettings()
failing when location lacks various properties
This commit is contained in:
parent
8b08378ce1
commit
a56d33b5f2
@ -201,6 +201,7 @@ export class LocationLifecycleService {
|
|||||||
|
|
||||||
// Add/edit chance settings
|
// Add/edit chance settings
|
||||||
if (configHostilityChanges.chancedEnemies) {
|
if (configHostilityChanges.chancedEnemies) {
|
||||||
|
locationBotHostilityDetails.ChancedEnemies ||= [];
|
||||||
for (const chanceDetailsToApply of configHostilityChanges.chancedEnemies) {
|
for (const chanceDetailsToApply of configHostilityChanges.chancedEnemies) {
|
||||||
const locationBotDetails = locationBotHostilityDetails.ChancedEnemies.find(
|
const locationBotDetails = locationBotHostilityDetails.ChancedEnemies.find(
|
||||||
(botChance) => botChance.Role === chanceDetailsToApply.Role,
|
(botChance) => botChance.Role === chanceDetailsToApply.Role,
|
||||||
@ -217,6 +218,7 @@ export class LocationLifecycleService {
|
|||||||
|
|
||||||
// Add new permanent friends if they don't already exist
|
// Add new permanent friends if they don't already exist
|
||||||
if (configHostilityChanges.additionalFriendlyTypes) {
|
if (configHostilityChanges.additionalFriendlyTypes) {
|
||||||
|
locationBotHostilityDetails.AlwaysFriends ||= [];
|
||||||
for (const friendlyTypeToAdd of configHostilityChanges.additionalFriendlyTypes) {
|
for (const friendlyTypeToAdd of configHostilityChanges.additionalFriendlyTypes) {
|
||||||
if (!locationBotHostilityDetails.AlwaysFriends.includes(friendlyTypeToAdd)) {
|
if (!locationBotHostilityDetails.AlwaysFriends.includes(friendlyTypeToAdd)) {
|
||||||
locationBotHostilityDetails.AlwaysFriends.push(friendlyTypeToAdd);
|
locationBotHostilityDetails.AlwaysFriends.push(friendlyTypeToAdd);
|
||||||
|
Loading…
Reference in New Issue
Block a user