Prevent faction invitations appearing after prestige (#872)

This commit is contained in:
alutman 2023-10-23 19:55:08 +11:00 committed by GitHub
parent 71e37823dd
commit 36a8b35cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

@ -7,7 +7,7 @@ import { EventEmitter } from "../../utils/EventEmitter";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
export const InvitationEvent = new EventEmitter<[Faction]>();
export const InvitationEvent = new EventEmitter<[Faction | null]>();
export function InvitationModal({ hidden }: { hidden: boolean }): React.ReactElement {
const [faction, setFaction] = useState<Faction | null>(null);
@ -17,8 +17,9 @@ export function InvitationModal({ hidden }: { hidden: boolean }): React.ReactEle
const i = Player.factionInvitations.findIndex((facName) => facName === faction.name);
if (i === -1) {
console.error("Could not find faction in Player.factionInvitations");
} else {
joinFaction(faction);
}
joinFaction(faction);
setFaction(null);
}

@ -26,6 +26,7 @@ import { CONSTANTS } from "../../Constants";
import { Exploit } from "../../Exploits/Exploit";
import { Faction } from "../../Faction/Faction";
import { Factions } from "../../Faction/Factions";
import { InvitationEvent } from "../../Faction/ui/InvitationModal";
import { resetGangs } from "../../Gang/AllGangs";
import { Cities } from "../../Locations/Cities";
import { Locations } from "../../Locations/Locations";
@ -104,6 +105,8 @@ export function prestigeAugmentation(this: PlayerObject): void {
this.factions = [];
this.factionInvitations = [];
// Clear any pending invitation modals
InvitationEvent.emit(null);
this.queuedAugmentations = [];