Skip to content

Commit

Permalink
Merge pull request massif-press#2143 from msprijatelj/fix/loadoutDisplay
Browse files Browse the repository at this point in the history
fix(mech): update loadout systems on loadout change
  • Loading branch information
jarena3 authored Oct 3, 2022
2 parents b10693f + 8ebf663 commit dfab5f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/classes/mech/components/loadout/MechLoadoutController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IFeatureContainer } from '@/classes/components/feature/IFeatureContainer'
import Vue from 'vue'
import { Mech } from '../../Mech'
import { MechLoadout } from './MechLoadout'
import { IMechLoadoutData } from './MechLoadout'
Expand Down Expand Up @@ -37,13 +38,14 @@ class MechLoadoutController implements IFeatureContainer {
}

public set ActiveLoadout(loadout: MechLoadout) {
this._active_loadout = loadout
Vue.set(this, '_active_loadout', loadout)
this.Parent.SaveController.save()
}

public AddLoadout(): void {
this._loadouts.push(new MechLoadout(this.Parent))
this.ActiveLoadout = this._loadouts[this._loadouts.length - 1]
const newLoadout = new MechLoadout(this.Parent)
this._loadouts.push(newLoadout)
this.ActiveLoadout = newLoadout
this.Parent.SaveController.save()
}

Expand All @@ -67,7 +69,7 @@ class MechLoadoutController implements IFeatureContainer {
newLoadout.RenewID()
newLoadout.Name += ' (Copy)'
this._loadouts.splice(index + 1, 0, newLoadout)
this._active_loadout = this._loadouts[index + 1]
this._active_loadout = newLoadout
this.Parent.SaveController.save()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ export default Vue.extend({
type: Boolean,
},
},
watch: {
activeSystems() {
this.systems = this.activeSystems
},
},
computed: {
moddedWeapons() {
return this.mech.MechLoadoutController.ActiveLoadout.Weapons.filter(x => x.Mod)
},
activeSystems() {
return this.mech.MechLoadoutController.ActiveLoadout.Systems
}
},
methods:{
moveSystem(event){
Expand Down

0 comments on commit dfab5f3

Please sign in to comment.