1
0
forked from noxious/client

npm updated, fixed saving PvP settings for zones

This commit is contained in:
2024-07-22 23:28:20 +02:00
parent 1bdc83fab1
commit 9e897728db
5 changed files with 128 additions and 118 deletions

View File

@ -173,6 +173,7 @@ function save() {
width: zoneEditorStore.zone.width,
height: zoneEditorStore.zone.height,
tiles: zoneTiles,
pvp: zoneEditorStore.zone.pvp,
zoneEventTiles: toRaw(zoneEventTiles.value).map((tile) => ({
id: tile.id,
zoneId: tile.zoneId,
@ -192,10 +193,6 @@ function save() {
gameStore.connection?.emit('gm:zone_editor:zone:update', data)
gameStore.connection?.emit('gm:zone_editor:zone:request', { zoneId: zoneEditorStore.zone.id }, (response: Zone) => {
zoneEditorStore.setZone(response)
})
if (zoneEditorStore.isSettingsModalShown) {
zoneEditorStore.toggleSettingsModal()
}

View File

@ -22,7 +22,10 @@
</div>
<div class="w-full flex flex-col mb-5">
<label class="mb-1.5 font-titles" for="name">PVP enabled</label>
<input class="input-cyan max-w-64" name="name" id="name" />
<select class="input-cyan" name="pvp" id="pvp">
<option :value="false">No</option>
<option :value="true">Yes</option>
</select>
</div>
</div>
<button class="btn-cyan px-4 py-1.5 min-w-24" type="submit">Save</button>

View File

@ -22,9 +22,9 @@
</div>
<div class="w-full flex flex-col mb-5">
<label class="mb-1.5 font-titles" for="pvp">PVP enabled</label>
<select class="input-cyan" name="pvp" id="pvp">
<option value="0">No</option>
<option value="1">Yes</option>
<select v-model="pvp" class="input-cyan" name="pvp" id="pvp">
<option :value="false">No</option>
<option :value="true">Yes</option>
</select>
</div>
</div>
@ -44,6 +44,7 @@ const zoneEditorStore = useZoneEditorStore()
const name = ref(zoneEditorStore.zone?.name)
const width = ref(zoneEditorStore.zone?.width)
const height = ref(zoneEditorStore.zone?.height)
const pvp = ref(zoneEditorStore.zone?.pvp)
watch(name, (value) => {
zoneEditorStore.setZoneName(value)
@ -56,4 +57,8 @@ watch(width, (value) => {
watch(height, (value) => {
zoneEditorStore.setZoneHeight(value)
})
watch(pvp, (value) => {
zoneEditorStore.setZonePvp(value)
})
</script>

View File

@ -42,6 +42,11 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
this.zone.height = height
}
},
setZonePvp(pvp: boolean) {
if (this.zone) {
this.zone.pvp = pvp
}
},
setTool(tool: string) {
this.tool = tool
},