The GenericStorage represents a storage for
buildings/units/players/etc. for storing resources. The GenericStorage is
the general form and is mostly used as baseclass to derive storages with
special function from it. Normally there should be no need to use the
GenericStorage. Rather use a specialized version that is suitable for the
job.
|
|
|
|
|
|
|
alter(self,
res,
amount)
alter() will return the amount of resources that did not fit into the
storage or if altering in a negative way to remove resources, the
amount of resources that was not available in the storage. |
source code
|
|
|
reset(self,
res)
Resets a resource slot to zero, removing all its contents. |
source code
|
|
|
reset_all(self)
Removes every resource from this inventory |
source code
|
|
|
|
|
get_free_space_for(self,
res)
Returns how much of res we can still store here (limit - current
amount). |
source code
|
|
|
|
|
get_dump(self)
Returns a dump of the inventory as dict |
source code
|
|
|
|
|
|
|
|
|
|
|
_changed(self)
Calls every listener when an object changed |
source code
|
|
|
add_change_listener(self,
listener,
call_listener_now=False,
no_duplicates=False) |
source code
|
|
|
add_remove_listener(self,
listener,
no_duplicates=False)
A listener that listens for removal of the object |
source code
|
|
|
clear_change_listeners(self)
Removes all change listeners |
source code
|
|
|
discard_change_listener(self,
listener)
Remove listener if it's there |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|