Use python hide instead of a single-use function

(cherry picked from commit a606fc9ca2)
This commit is contained in:
Gouvernathor 2023-11-14 23:24:15 +01:00 committed by LoafyLemon
parent 12e2bbcfb6
commit 780c028eb3
1 changed files with 5 additions and 8 deletions

View File

@ -90,13 +90,8 @@ label purchase_item(item):
$ game.gold -= item.price
$ item.owned += 1
$ item_store_achievements()
return
init python:
def item_store_achievements():
# We require a function because lambdas aren't pickleable
python hide:
# We hide the lambdas which aren't pickleable
if isinstance(item, Decoration):
_posters = filter(lambda x: (x.type == "decoration" and x.placement == poster_OBJ), inventory.items)
_hats = filter(lambda x: (x.type == "decoration" and "hat" in x.name.lower()), inventory.items)
@ -105,4 +100,6 @@ init python:
achievements.unlock("postman")
if all(i.owned > 0 for i in _hats):
achievements.unlock("hats")
achievements.unlock("hats")
return