# HG changeset patch # User M. George Hansen # Date 1311804990 36000 # Node ID 9c7a96c6fe41badecb45d1a2e8152f28bb7f21dd # Parent fa8bb78832e6d3c9aa4c597d2a9e4645c7ba994d 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 fa8bb78832e6 -r 9c7a96c6fe41 components/Behavior.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/CharacterStatistics.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/__init__.py diff -r fa8bb78832e6 -r 9c7a96c6fe41 components/containable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/container.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/description.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/dialog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/fifeagent.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 components/lockable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 entities/__init__.py diff -r fa8bb78832e6 -r 9c7a96c6fe41 entities/character.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 objects/components.py --- a/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 fa8bb78832e6 -r 9c7a96c6fe41 systems/__init__.py diff -r fa8bb78832e6 -r 9c7a96c6fe41 systems/gamerulessystem.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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 fa8bb78832e6 -r 9c7a96c6fe41 systems/scriptingsystem.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/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