forked from SilverStudioGames/WTS
Use python hide instead of a single-use function
This commit is contained in:
parent
5a2434df5e
commit
9d61a4c583
@ -90,13 +90,8 @@ label purchase_item(item):
|
|||||||
$ game.gold -= item.price
|
$ game.gold -= item.price
|
||||||
$ item.owned += 1
|
$ item.owned += 1
|
||||||
|
|
||||||
$ item_store_achievements()
|
python hide:
|
||||||
|
# We hide the lambdas which aren't pickleable
|
||||||
return
|
|
||||||
|
|
||||||
init python:
|
|
||||||
def item_store_achievements():
|
|
||||||
# We require a function because lambdas aren't pickleable
|
|
||||||
if isinstance(item, Decoration):
|
if isinstance(item, Decoration):
|
||||||
_posters = filter(lambda x: (x.type == "decoration" and x.placement == poster_OBJ), inventory.items)
|
_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)
|
_hats = filter(lambda x: (x.type == "decoration" and "hat" in x.name.lower()), inventory.items)
|
||||||
@ -106,3 +101,5 @@ init python:
|
|||||||
|
|
||||||
if all(i.owned > 0 for i in _hats):
|
if all(i.owned > 0 for i in _hats):
|
||||||
achievements.unlock("hats")
|
achievements.unlock("hats")
|
||||||
|
|
||||||
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user