diff --git a/src/main.ts b/src/main.ts index 1cbd8f0..5ae5bbf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,5 @@ import { button, checkbox, label, textbox, window } from "openrct2-flexui"; -let originalGuestMaximum: number = 0; let suggestedGuestMaximum: number = 0; let activate: boolean = false; let event: any; @@ -8,17 +7,8 @@ let event: any; export const allWidgets = window({ title: "OpenRCT2 Soft Guest Cap Editor", width: { value: 200, min: 200, max: 10_000 }, - height: { value: 117, min: 117, max: 10_000 }, - onUpdate() { - originalGuestMaximum = park.suggestedGuestMaximum; - }, + height: { value: 100, min: 100, max: 10_000 }, content: [ - label({ - alignment: "centred", - text: `Original Guest Cap: ${originalGuestMaximum.toString()}`, - tooltip: - "This is the maximum number of guests that will be allowed in your park", - }), label({ alignment: "centred", text: "Enter your desired soft guest cap", @@ -28,8 +18,7 @@ export const allWidgets = window({ textbox({ text: suggestedGuestMaximum.toString(), onChange: (text: string) => { - // @ts-ignore - suggestedGuestMaximum = Number.parseInt(text); + suggestedGuestMaximum = Number(text); }, }), checkbox({ @@ -39,7 +28,6 @@ export const allWidgets = window({ activate = checked; if (checked) { event = context.subscribe("park.calculateGuestCap", (e) => { - originalGuestMaximum = e.suggestedGuestMaximum; e.suggestedGuestMaximum = suggestedGuestMaximum; }); } else if (event) { @@ -63,9 +51,6 @@ export const allWidgets = window({ export function main() { if (typeof ui !== "undefined") { const menuItemName = "Soft Guest Cap Editor"; - ui.registerMenuItem(menuItemName, function () { - originalGuestMaximum = park.suggestedGuestMaximum; - allWidgets.open(); - }); + ui.registerMenuItem(menuItemName, () => allWidgets.open()); } }