FACTIONS: Fix for faction names staying scrambled after joining (#968)

This commit is contained in:
Jesse Clark 2023-12-07 17:53:28 -08:00 committed by GitHub
parent 107b4e90e9
commit ecc63eb07e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

@ -3,7 +3,7 @@ import type { Faction } from "./Faction";
import { Augmentations } from "../Augmentation/Augmentations"; import { Augmentations } from "../Augmentation/Augmentations";
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation"; import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
import { AugmentationName } from "@enums"; import { AugmentationName, FactionDiscovery } from "@enums";
import { currentNodeMults } from "../BitNode/BitNodeMultipliers"; import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
import { Player } from "@player"; import { Player } from "@player";
@ -26,6 +26,7 @@ export function inviteToFaction(faction: Faction): void {
if (faction.alreadyInvited || faction.isMember) return; if (faction.alreadyInvited || faction.isMember) return;
Player.receiveInvite(faction.name); Player.receiveInvite(faction.name);
faction.alreadyInvited = true; faction.alreadyInvited = true;
faction.discovery = FactionDiscovery.known;
if (!Settings.SuppressFactionInvites) { if (!Settings.SuppressFactionInvites) {
InvitationEvent.emit(faction); InvitationEvent.emit(faction);
} }
@ -34,6 +35,9 @@ export function inviteToFaction(faction: Faction): void {
export function joinFaction(faction: Faction): void { export function joinFaction(faction: Faction): void {
if (faction.isMember) return; if (faction.isMember) return;
faction.isMember = true; faction.isMember = true;
faction.alreadyInvited = true;
faction.discovery = FactionDiscovery.known;
// Add this faction to player's faction list, keeping it in standard order // Add this faction to player's faction list, keeping it in standard order
Player.factions = getRecordKeys(Factions).filter((facName) => Factions[facName].isMember); Player.factions = getRecordKeys(Factions).filter((facName) => Factions[facName].isMember);

@ -124,7 +124,7 @@ const Messages: Record<MessageFilename, Message> = {
MessageFilename.Jumper2, MessageFilename.Jumper2,
"Do not try to save the world. There is no world to save. If " + "Do not try to save the world. There is no world to save. If " +
"you want to find the truth, worry only about yourself. Ethics and " + "you want to find the truth, worry only about yourself. Ethics and " +
`morals will get you killed. \n\nWatch out for a hacking group known as ${FactionName.NiteSec}.` + `morals will get you killed. \n\nKeep an eye out for a hacking group known as ${FactionName.NiteSec}.` +
"\n\n-jump3R", "\n\n-jump3R",
FactionName.NiteSec, FactionName.NiteSec,
), ),

@ -308,7 +308,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = `
"Bladeburners": { "Bladeburners": {
"ctor": "Faction", "ctor": "Faction",
"data": { "data": {
"discovery": "unknown", "discovery": "known",
"favor": 0, "favor": 0,
"playerReputation": 4000, "playerReputation": 4000,
}, },
@ -340,7 +340,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = `
"CyberSec": { "CyberSec": {
"ctor": "Faction", "ctor": "Faction",
"data": { "data": {
"discovery": "unknown", "discovery": "known",
"favor": 20, "favor": 20,
"playerReputation": 1000000, "playerReputation": 1000000,
}, },
@ -476,7 +476,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = `
"Slum Snakes": { "Slum Snakes": {
"ctor": "Faction", "ctor": "Faction",
"data": { "data": {
"discovery": "unknown", "discovery": "known",
"favor": 0, "favor": 0,
"playerReputation": 0, "playerReputation": 0,
}, },