# HG changeset patch # User M. George Hansen # Date 1311804990 36000 # Node ID 5ac50245e42c6a0f1e1625b3b14915c85bac1f6a # Parent 32d8b4dd9d99b2db9942369948dd36023fb35464 Refactored components and began defining basic Entities and Systems. * Moved the components from parpg.objects.components into their own top-level package, components, and separated them into individual modules. * Added a few new components, including Behavior, Container and Containable. * Created the systems top-level package for defining Grease Systems and added stub classes for the ScriptingSystem and GameRulesSystem. * Created the entities top-level package for defining Grease Entities and added an incomplete definition of the Character entity type. diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/Behavior.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/Behavior.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,24 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Behavior(Component): + """ + Component that defines how an entity interacts with the world though + scripting. + """ + + def __init__(self): + """Constructor""" + Component.__init__(scripts=list) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/CharacterStatistics.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/CharacterStatistics.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class CharacterStatistics(Component): + """Component that defines character statistics.""" + + def __init__(self): + """Constructor""" + Component.__init__(statistics=dict) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/__init__.py diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/containable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/containable.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Containable(Component): + """Component that allows an entity to be contained by Container entity.""" + + def __init__(self): + """Constructor""" + Component.__init__(bulk=int, weight=int, image=str, container=object) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/container.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/container.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,22 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Container(Component): + """ + Component that allows an entity to contain one or more child entities. + """ + + def __init__(self): + Component.__init__(children=list, max_bulk=int) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/description.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/description.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Description(Component): + """Component that stores the description of an object""" + + def __init__(self): + """Constructor""" + Component.__init__(view_name=str, real_name=str, desc=str) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/dialog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/dialog.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Dialog(Component): + """Component that stores the dialogue""" + + def __init__(self): + """Constructor""" + Component.__init__(dialogue=object) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/fifeagent.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/fifeagent.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class FifeAgent(Component): + """Component that stores the values for a fife agent""" + + def __init__(self): + """Constructor""" + Component.__init__(identifier=int, layer=object, behaviour=object, gfx=str) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/components/lockable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/lockable.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease.component import Component + +class Lockable(Component): + """Component that stores the data of a lock""" + + def __init__(self): + """Constructor""" + Component.__init__(locked=bool) diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/entities/__init__.py diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/entities/character.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/entities/character.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,26 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease import Entity + +class Character(Entity): + def __init__(self, world, view_name, real_name, desc, statistics, max_bulk, + items=None): + self.characterstats.statistics = statistics + + self.description.view_name = view_name + self.description.real_name = real_name + self.description.desc = desc + + self.container.children = items or [] + self.container.max_bulk = max_bulk diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/objects/components.py --- a/src/parpg/objects/components.py Mon Jul 25 13:39:01 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -# This file is part of PARPG. - -# PARPG is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# PARPG is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with PARPG. If not, see . - -from parpg.grease.component import Component -from parpg.grease.geometry import Vec2d - -""" Contains the components for PARPG -""" - -class FifeAgent(Component): - """Component that stores the values for a fife agent""" - - def __init__(self): - """Constructor""" - Component.__init__(identifier=int, layer=object, behaviour=object, gfx=str) - -class Description(Component): - """Component that stores the description of an object""" - - def __init__(self): - """Constructor""" - Component.__init__(view_name=str, real_name=str, desc=str) - -class Statistics(Component): - """Component that stores statistics""" - - def __init__(self): - """Constructor""" - Component.__init__(statistics=object) - -class Dialogue(Component): - """Component that stores the dialogue""" - - def __init__(self): - """Constructor""" - Component.__init__(dialogue=object) - -class Inventory(Component): - """Component that stores the inventory""" - - def __init__(self): - """Constructor""" - Component.__init__(inventory=object, hidden=bool) - -class Lock(Component): - """Component that stores the data of a lock""" - - def __init__(self): - """Constructor""" - Component.__init__(open=bool, locked=bool) - -class Item(Component): - """Component that stores the data of an item""" - - def __init__(self): - """Constructor""" - Component.__init__(bulk=int, weight=int, image=str, container=object) - - \ No newline at end of file diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/systems/__init__.py diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/systems/gamerulessystem.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/systems/gamerulessystem.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,22 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease import System + +class GameRulesSystem(System): + """ + System responsible for defining the game rules and mechanics by which + characters interact with the world. + """ + + pass diff -r 32d8b4dd9d99 -r 5ac50245e42c src/parpg/systems/scriptingsystem.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/systems/scriptingsystem.py Wed Jul 27 12:16:30 2011 -1000 @@ -0,0 +1,21 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from parpg.grease import System + +class ScriptingSystem(System): + """ + System responsible for managing scripts attached to entities to define + their behavior. + """ + pass \ No newline at end of file