From da6a2b403908cb4d17d095ea354bdce10e64026e Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Sat, 28 May 2022 03:43:55 +0200 Subject: [PATCH] add function to remove planted crops on context / long press --- concept.md | 2 +- src/components/CropField.vue | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/concept.md b/concept.md index ac8bd91..59a5170 100644 --- a/concept.md +++ b/concept.md @@ -6,7 +6,7 @@ - [ ] Watering of crops - [ ] Quick access on field for crops and later tools - [ ] Switch system from field -> crop to crop -> fields - - [ ] Removing planted crops and regaining of removed crop + - [x] Removing planted crops and regaining of removed crop - [ ] Revision of crop-assets - [x] Farm animals - [x] Animal products (egg, milk, wool, etc.) diff --git a/src/components/CropField.vue b/src/components/CropField.vue index 3b8667c..d1361d8 100644 --- a/src/components/CropField.vue +++ b/src/components/CropField.vue @@ -3,6 +3,7 @@
@@ -106,6 +107,33 @@ export default { } else { return seed.assetsFolder + '1.png'; } + }, + removeCrop(field) { + let view = this; + let seed = ItemService.getItemByID(field.data.seed_id); + + iziToast.question({ + title: 'Do you want to remove this '+seed.name+'?', + buttons: [ + ['', function (instance, toast) { + field.data = null; + view.$store.commit('addItemToInventory', {item: seed, quantity: 1}); + + iziToast.success({ + title: 'Added removed '+seed.name+' back to inventory', + image: seed.icon + }) + + instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); + }, true], + ['', function (instance, toast) { + + instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); + + }], + ], + timeout: false + }) } } }