DEVMENU: Reset other gangs when leaving gang (#1715)

This commit is contained in:
catloversg 2024-10-23 15:55:22 +07:00 committed by GitHub
parent b72c03acf0
commit d0022aac2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 33 deletions

@ -24,6 +24,7 @@ import { GangConstants } from "../../Gang/data/Constants";
import { checkForMessagesToSend } from "../../Message/MessageHelpers";
import { getEnumHelper } from "../../utils/EnumHelper";
import { formatRam } from "../../ui/formatNumber";
import { resetGangs } from "../../Gang/AllGangs";
export function General({ parentRerender }: { parentRerender: () => void }): React.ReactElement {
const rerender = useRerender(400);
@ -87,6 +88,7 @@ export function General({ parentRerender }: { parentRerender: () => void }): Rea
};
const stopGang = () => {
Player.gang = null;
resetGangs();
parentRerender();
};
const setGangFactionDropdown = (event: SelectChangeEvent) => {

@ -6,39 +6,8 @@ interface GangTerritory {
territory: number;
}
export let AllGangs: Record<string, GangTerritory> = {
[FactionName.SlumSnakes]: {
power: 1,
territory: 1 / 7,
},
[FactionName.Tetrads]: {
power: 1,
territory: 1 / 7,
},
[FactionName.TheSyndicate]: {
power: 1,
territory: 1 / 7,
},
[FactionName.TheDarkArmy]: {
power: 1,
territory: 1 / 7,
},
[FactionName.SpeakersForTheDead]: {
power: 1,
territory: 1 / 7,
},
[FactionName.NiteSec]: {
power: 1,
territory: 1 / 7,
},
[FactionName.TheBlackHand]: {
power: 1,
territory: 1 / 7,
},
};
export function resetGangs(): void {
AllGangs = {
function getDefaultAllGangs() {
return {
[FactionName.SlumSnakes]: {
power: 1,
territory: 1 / 7,
@ -70,6 +39,12 @@ export function resetGangs(): void {
};
}
export let AllGangs: Record<string, GangTerritory> = getDefaultAllGangs();
export function resetGangs(): void {
AllGangs = getDefaultAllGangs();
}
export function loadAllGangs(saveString: string): void {
AllGangs = JSON.parse(saveString, Reviver);
}