Skip to content

Commit

Permalink
Merge pull request massif-press#2016 from super-salad/system_order
Browse files Browse the repository at this point in the history
feat(mech loadout): editable system order
  • Loading branch information
jarena3 authored Aug 11, 2022
2 parents 10abcb5 + f156e48 commit 5a62059
Showing 1 changed file with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@
@remove="w.Mod = null"
/>

<system-slot-card
v-for="(s, i) in mech.MechLoadoutController.ActiveLoadout.Systems"
:key="`${s.ID}-${i}`"
:mech="mech"
:item="s"
:color="color"
:index="i"
:readonly="readonly"
/>

<draggable
:list="systems"
@start="drag=true"
@end="drag=false"
@change="moveSystem($event)"
>
<system-slot-card
v-for="(s, i) in systems"
:key="`${s.ID}-${i}`"
:mech="mech"
:item="s"
:color="color"
:index="i"
:readonly="readonly"
/>
</draggable>
<system-slot-card v-if="!readonly" :mech="mech" empty />
</fieldset>
</v-card>
Expand All @@ -53,10 +59,11 @@
import Vue from 'vue'
import SystemSlotCard from './_SystemSlotCard.vue'
import ModEquippedCard from './_ModEquippedCard.vue'
import draggable from 'vuedraggable'
export default Vue.extend({
name: 'systems-block',
components: { SystemSlotCard, ModEquippedCard },
components: { SystemSlotCard, ModEquippedCard, draggable },
props: {
mech: {
type: Object,
Expand All @@ -75,6 +82,21 @@ export default Vue.extend({
return this.mech.MechLoadoutController.ActiveLoadout.Weapons.filter(x => x.Mod)
},
},
methods:{
moveSystem(event){
if(event.moved){
this.mech.SaveController.save()
}
},
},
data: () => {
return {
systems: null
}
},
mounted() {
this.systems = this.mech.MechLoadoutController.ActiveLoadout.Systems
},
})
</script>

Expand Down

0 comments on commit 5a62059

Please sign in to comment.