Fix incorrect example code in equipment tutorial

The code to replace equipment in a single-item slot references a variable that is never used before or after, and incorrectly sets it to the item that is doing the replacement instead of the item being replaced, which causes the replaced item to not be moved back into the backpack.
This commit is contained in:
feyrkh 2024-09-29 12:25:15 -05:00 committed by GitHub
parent ac06ff735c
commit 54e5e63b8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -402,7 +402,7 @@ class EquipmentHandler:
to_backpack = [obj] to_backpack = [obj]
else: else:
# for others (body, head), just replace whatever's there # for others (body, head), just replace whatever's there
replaced = [obj] to_backpack = [slots[use_slot]]
slots[use_slot] = obj slots[use_slot] = obj
for to_backpack_obj in to_backpack: for to_backpack_obj in to_backpack: