basic_tiles is now a part of the mod.
[realism.git] / engine / item.py
blob5ce90682a58d0e53e6a543752f68be2dc1f9fdb7
1 # This file is part of Realism, which is Copyright FunnyMan3595 (Charlie Nolan)
2 # and licensed under the GNU GPL v3. For more details, see LICENSE in the main
3 # Realism directory.
5 class Item(object):
6 def __init__(self, name, value, count):
7 self.name = name
8 self.value = value
9 self.count = count
11 def __eq__(self, other):
12 if self.name != other.name:
13 return False
14 if self.value != other.value:
15 return False
16 return True
18 def split(self, split_count):
19 '''Splits this stack of items, returning a new stack with the requested size.'''
20 self.count -= split_count
21 return Item(self.name, self.value, split_count)
23 def make(self, count):
24 '''Creates a stack of count copies of this item.'''
25 return Item(self.name, self.value, count)