From 7f123cb472d12ce2fe2de7b5b8c045167852dda1 Mon Sep 17 00:00:00 2001 From: feyrkh Date: Sun, 29 Sep 2024 13:08:56 -0500 Subject: [PATCH] Update Beginner-Tutorial-Equipment.md When adding an item to an empty slot, avoid adding `None` objects to the backpack. --- .../Beginner-Tutorial/Part3/Beginner-Tutorial-Equipment.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Equipment.md b/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Equipment.md index cdabbd8d18..08dfd144c1 100644 --- a/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Equipment.md +++ b/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Equipment.md @@ -407,13 +407,14 @@ class EquipmentHandler: for to_backpack_obj in to_backpack: # put stuff in backpack - slots[WieldLocation.BACKPACK].append(to_backpack_obj) + if to_backpack_obj: + slots[WieldLocation.BACKPACK].append(to_backpack_obj) # store new state self._save() ``` -Here we remember that every `EvAdventureObject` has an `inventory_use_slot` property that tells us where it goes. So we just need to move the object to that slot, replacing whatever is in that place from before. Anything we replace goes back to the backpack. +Here we remember that every `EvAdventureObject` has an `inventory_use_slot` property that tells us where it goes. So we just need to move the object to that slot, replacing whatever is in that place from before. Anything we replace goes back to the backpack, as long as it's actually an item and not `None`, in the case where we are moving an item into an empty slot. ## Get everything