Skip to content

Commit

Permalink
Added system to allow adjustment of bot appearance by season
Browse files Browse the repository at this point in the history
PMCs have higher weighting to wear winter clothing during Christmas
  • Loading branch information
Chomp committed Jan 1, 2025
1 parent 615f8df commit 6628eb9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
23 changes: 22 additions & 1 deletion project/assets/configs/seasonalevents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
{
"enableSeasonalEventDetection": true,
"botAppearanceChanges": {
"CHRISTMAS": {
"usec": {
"body": {
"675fd6dc7a57e0b2a00e340a": 10
},
"feet": {
"675fd71c1c153e52f1050fd6": 10
}
},
"bear": {
"body": {
"675998aba378f89a3e089b5c": 10
},
"feet": {
"67599889a378f89a3e089b5a": 10
}
}
}
},
"eventGear": {
"halloween": {
"assault": {
Expand Down Expand Up @@ -8341,7 +8361,8 @@
"endDay": "31",
"endMonth": "12",
"settings": {
"enableSanta": true
"enableSanta": true,
"adjustBotAppearances": true
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions project/src/models/spt/config/ISeasonalEventConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface ISeasonalEventConfig extends IBaseConfig {
hostilitySettingsForEvent: Record<string, Record<string, IAdditionalHostilitySettings[]>>;
/** Ids of containers on locations that only have christmas loot */
christmasContainerIds: string[];
/** Season - botType - location (body/feet/hands/head) */
botAppearanceChanges: Record<SeasonalEventType, Record<string, Record<string, Record<string, number>>>>;
}

export interface ISeasonalEvent {
Expand Down
22 changes: 22 additions & 0 deletions project/src/services/SeasonalEventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ export class SeasonalEventService {
this.addLootItemsToGifterDropItemsList();
}
this.enableDancingTree();
this.adjustBotAppearanceValues(event.type);
break;
case SeasonalEventType.NEW_YEARS.toLowerCase():
break;
Expand All @@ -458,6 +459,27 @@ export class SeasonalEventService {
}
}

protected adjustBotAppearanceValues(season: SeasonalEventType): void {
const adjustments = this.seasonalEventConfig.botAppearanceChanges[season];
if (!adjustments) {
return;
}

for (const botTypeKey in adjustments) {
const botDb = this.databaseService.getBots().types[botTypeKey];
if (!botDb) {
continue;
}
const botAppearanceAdjustments = adjustments[botTypeKey];
for (const appearanceKey in botAppearanceAdjustments) {
const weightAdjustments = botAppearanceAdjustments[appearanceKey];
for (const itemKey in weightAdjustments) {
botDb.appearance[appearanceKey][itemKey] = weightAdjustments[itemKey];
}
}
}
}

protected replaceBotHostility(hostilitySettings: Record<string, IAdditionalHostilitySettings[]>) {
const locations = this.databaseService.getLocations();
const ignoreList = this.locationConfig.nonMaps;
Expand Down

0 comments on commit 6628eb9

Please sign in to comment.