Skip to content

Commit

Permalink
fix: Delete and confirm work as expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay committed Oct 11, 2024
1 parent 633d20d commit 710bc8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
import { DefaultSequentialConfig } from "@/systems/preferences/PreferenceTypes"
import InputSystem from "@/systems/input/InputSystem"
import MirabufSceneObject from "@/mirabuf/MirabufSceneObject"
import { Global_AddToast } from "@/ui/components/GlobalUIControls"

class SynthesisBrain extends Brain {
public static brainIndexMap = new Map<number, SynthesisBrain>()
Expand Down Expand Up @@ -95,12 +94,7 @@ class SynthesisBrain extends Brain {
}

public clearControls(): void {
if (InputSystem.brainIndexSchemeMap.delete(this._brainIndex)) {
Global_AddToast?.("info", "Controls", "Successfully cleared controls.")
} else {
Global_AddToast?.("warning", "Controls", "Failed to cleared controls.")
}

InputSystem.brainIndexSchemeMap.delete(this._brainIndex)
}

/** Creates an instance of ArcadeDriveBehavior and automatically configures it. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,8 @@ const InitialConfigPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {

useEffect(() => {
closePanel("import-mirabuf")

/** If the panel is closed before a scheme is selected, defaults to the top of the list */
if (targetAssembly?.miraType == MiraType.ROBOT) {
return () => {
const brainIndex = SynthesisBrain.GetBrainIndex(targetAssembly)

if (brainIndex == undefined) return

if (InputSystem.brainIndexSchemeMap.has(brainIndex)) return

const scheme = InputSchemeManager.availableInputSchemes[0]

InputSystem.brainIndexSchemeMap.set(brainIndex, scheme)

setSelectedConfigurationType(ConfigurationType.INPUTS)
setSelectedScheme(scheme)
}
} else {
return () => {}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [targetAssembly])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

const closeFinish = useCallback(() => {
if (targetAssembly?.miraType == MiraType.ROBOT) {
Expand Down

0 comments on commit 710bc8a

Please sign in to comment.