From fec64bb91c03c5e872a8f6fbc1a253f341373072 Mon Sep 17 00:00:00 2001 From: Persson-dev <66266021+Persson-dev@users.noreply.github.com> Date: Wed, 29 Dec 2021 20:28:41 +0100 Subject: Improved farmer AI & Fixed entity loading functions (#5351) * Allow villagers to pickup items * Add farmer villager harvesting * Use of auto keyword * Using for loop to check adjacent crops * Show particules when farmer harvest * Fix area comment * Move constants to header file * Removing unnecessary semicolon * Initialization of CropBlockType variable * Apply 12xx12 suggestion * Fixing area constant size * Refactor bounding box calculation, use vectors. * Add Api documentation * Update lua docs * Rework farmer ai * Fixing lua docs notes * Add missing capitalisation * Add villagers inventory save * Fixing loading entities from disk inconsistencies * Add farmer harvest animation * Fix beetroots grow state Co-authored-by: Alexander Harkness --- src/Defines.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/Defines.cpp') diff --git a/src/Defines.cpp b/src/Defines.cpp index 02b9f28d5..aa5e46995 100644 --- a/src/Defines.cpp +++ b/src/Defines.cpp @@ -623,3 +623,29 @@ bool ItemCategory::IsHorseArmor(short a_ItemType) } } } + + + + + +bool ItemCategory::IsVillagerFood(short a_ItemType) +{ + switch (a_ItemType) + { + case E_ITEM_CARROT: + case E_ITEM_POTATO: + case E_ITEM_BREAD: + case E_ITEM_BEETROOT: + case E_ITEM_SEEDS: + case E_ITEM_BEETROOT_SEEDS: + case E_ITEM_WHEAT: + { + return true; + } + + default: + { + return false; + } + } +} -- cgit v1.2.3