88class Item (Entity ):
99 """An Item is an entity which can be picked up by the player."""
1010
11-
12- __attributes__ = {** Entity .__attributes__ , "moveable" : bool , "carryable" : bool , "weight" : int }
13- __important_attributes__ = ("name" , "moveable" , "carryable" , "weight" )
11+ __attributes__ = {
12+ ** Entity .__attributes__ ,
13+ "moveable" : bool ,
14+ "carryable" : bool ,
15+ "weight" : int ,
16+ "quest_item" : bool ,
17+ }
18+ __important_attributes__ = ("name" , "moveable" , "carryable" , "weight" , "quest_item" )
1419
1520 moveable : bool
1621 carryable : bool
1722 weight : int
23+ quest_item : bool
1824
1925 def __init__ (self : Self , messages : Messages , config_dict : dict [str , Any ]) -> None :
2026 """
@@ -31,10 +37,14 @@ def __init__(self: Self, messages: Messages, config_dict: dict[str, Any]) -> Non
3137 self .moveable = config_dict .pop ("moveable" , True )
3238 self .carryable = config_dict .pop ("carryable" , True )
3339 self .weight = config_dict .pop ("weight" , 1 )
40+ self .quest_item = config_dict .pop ("quest_item" , False )
3441 super ().__init__ (messages , config_dict )
3542
43+ if self .quest_item :
44+ self .weight = 0
45+
3646 def __repr__ (self : Self ) -> str :
37- return f"Item({ self .name } , { self .description } , moveable={ self .moveable } , carryable={ self .carryable } , weight={ self .weight } )"
47+ return f"Item({ self .name } , { self .description } , moveable={ self .moveable } , carryable={ self .carryable } , weight={ self .weight } , quest_item= { self . quest_item } )"
3848
3949 def on_pickup (self : Self ):
4050 # TODO
@@ -45,6 +55,7 @@ def to_dict(self: Self) -> dict:
4555 item_dict ["moveable" ] = self .moveable
4656 item_dict ["carryable" ] = self .carryable
4757 item_dict ["weight" ] = self .weight
58+ item_dict ["quest_item" ] = self .quest_item
4859 return item_dict
4960
5061 @staticmethod
0 commit comments