Mercurial > parpg-source
changeset 96:8363261b658e
Added saveable_fields to containable, dialogue and equipable.
author | KarstenBock@gmx.net |
---|---|
date | Tue, 27 Sep 2011 16:05:07 +0200 |
parents | d67e8288e9bf |
children | f94d4577ca5e |
files | components/containable.py components/dialogue.py components/equipable.py |
diffstat | 3 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/components/containable.py Tue Sep 27 15:57:36 2011 +0200 +++ b/components/containable.py Tue Sep 27 16:05:07 2011 +0200 @@ -11,6 +11,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +from copy import deepcopy + from base import Base class Containable(Base): @@ -19,3 +21,9 @@ def __init__(self): """Constructor""" Base.__init__(self, bulk=int, weight=int, item_type=str, image=str, container=object, slot=int) + + @property + def saveable_fields(self): + fields = deepcopy(self.fields) + del fields["container"] + return fields \ No newline at end of file
--- a/components/dialogue.py Tue Sep 27 15:57:36 2011 +0200 +++ b/components/dialogue.py Tue Sep 27 16:05:07 2011 +0200 @@ -11,6 +11,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +from copy import deepcopy + from base import Base class Dialogue(Base): @@ -19,3 +21,9 @@ def __init__(self): """Constructor""" Base.__init__(self, dialogue=object) + + @property + def saveable_fields(self): + fields = deepcopy(self.fields) + del fields["dialogue"] + return fields \ No newline at end of file
--- a/components/equipable.py Tue Sep 27 15:57:36 2011 +0200 +++ b/components/equipable.py Tue Sep 27 16:05:07 2011 +0200 @@ -11,6 +11,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +from copy import deepcopy + from base import Base class Equipable(Base): @@ -19,4 +21,10 @@ """ def __init__(self): - Base.__init__(self, possible_slots=list, wearer=object, in_slot=str) \ No newline at end of file + Base.__init__(self, possible_slots=list, wearer=object, in_slot=str) + + @property + def saveable_fields(self): + fields = deepcopy(self.fields) + del fields["wearer"] + return fields \ No newline at end of file