Skip to content

Commit

Permalink
Merge pull request #159 from PhlexPlexico/map_sides
Browse files Browse the repository at this point in the history
Include side choices in seasons.
  • Loading branch information
PhlexPlexico authored Sep 8, 2022
2 parents 0d108e5 + 47a8cfe commit 1546752
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/components/NewMatchForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export default {
veto_first: "team1",
spectators: [],
side_type: "standard",
map_sides: [[]]
map_sides: []
},
selectedTeams: [],
newDialog: false,
Expand Down Expand Up @@ -441,6 +441,10 @@ export default {
seasonCvars.spectators.length < 1
? null
: seasonCvars.spectators.trim().split(" ");
this.newMatchData.map_sides =
seasonCvars.map_sides.length < 1
? []
: seasonCvars.map_sides.trim().split(" ");
//Delete all used get prepare custom CVARs.
delete seasonCvars.min_players_to_ready;
delete seasonCvars.min_spectators_to_ready;
Expand All @@ -450,6 +454,7 @@ export default {
delete seasonCvars.map_pool;
delete seasonCvars.side_type;
delete seasonCvars.spectators;
delete seasonCvars.map_sides;
// Now set Match CVARs. These will be converted back on submit.
let tmpCvarArr = [];
for (var obj in seasonCvars)
Expand Down
60 changes: 55 additions & 5 deletions src/components/SeasonsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,49 @@
</v-col>
</v-radio-group>
</v-row>
<v-row class="justify-center" v-if="seasonDefaults.skip_veto">
<v-col
lg="3"
md="12"
sm="12"
v-for="(entity, index) in seasonDefaults.maps_to_win"
:key="index"
>
<v-col class="text-left text-h6">
{{
$t("CreateMatch.MapSides", {
map:
seasonDefaults.map_pool[index] == null
? entity
: seasonDefaults.map_pool[index]
})
}}
</v-col>
<v-radio-group
row
v-model="seasonDefaults.map_sides[index]"
>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesTeam1CT')"
:value="'team1_ct'"
/>
</v-col>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesTeam2CT')"
:value="'team1_t'"
/>
</v-col>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesKnife')"
:value="'knife'"
/>
</v-col>
</v-radio-group>
</v-col>
</v-row>
<v-row class="pt-6">
<v-col cols="12">
<v-combobox
Expand Down Expand Up @@ -435,7 +478,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
},
datemenu: false,
formTitle: this.$t("Seasons.NewFormTitle"),
Expand Down Expand Up @@ -482,7 +526,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
};
this.$refs.newSeasonForm.resetValidation();
});
Expand Down Expand Up @@ -579,6 +624,8 @@ export default {
newCvar.spectators =
newCvar.spectators != "" ? newCvar.spectators.join(" ") : "";
newCvar.map_pool = newCvar.map_pool.join(" ");
newCvar.map_sides =
newCvar.map_sides != "" ? newCvar.map_sides.join(" ") : "";
}
if (this.newSeason.id == null) {
let serverObj = [
Expand Down Expand Up @@ -637,7 +684,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
};
this.$refs.newSeasonForm.resetValidation();
});
Expand All @@ -655,7 +703,6 @@ export default {
// If our cvars are empty, make an empty object instead to allow future saving.
if (typeof seasonCvars == "string") seasonCvars = {};
else {
console.log(seasonCvars);
for (let obj in seasonCvars) {
if (
obj !== "min_players_to_ready" &&
Expand All @@ -666,7 +713,8 @@ export default {
obj !== "skip_veto" &&
obj !== "map_pool" &&
obj !== "spectators" &&
obj !== "side_type"
obj !== "side_type" &&
obj !== "map_sides"
)
tmpArr.push(obj + " " + seasonCvars[obj]);
else if (
Expand All @@ -679,6 +727,8 @@ export default {
else if (obj === "skip_veto") {
seasonCvars[obj] = seasonCvars[obj] == 0 ? false : true;
this.seasonDefaults[obj] = seasonCvars[obj];
} else if (obj === "map_sides") {
this.seasonDefaults[obj] = seasonCvars[obj].split(" ");
} else this.seasonDefaults[obj] = seasonCvars[obj];
}
}
Expand Down

0 comments on commit 1546752

Please sign in to comment.