view world.py @ 183:7b6aba7839ea

getGameEnvironment of GameState now returns a locals dictionary that is empty at the beginning of the game and will be saved in save games. The vals and funcs are now both in the globals dictionary. This WILL break old saves.
author Beliar <KarstenBock@gmx.net>
date Thu, 15 Mar 2012 16:24:05 +0100
parents 75c0b728ccf3
children 2a12e2843984
line wrap: on
line source

from parpg.bGrease.world import *
from parpg.bGrease.component import Component

from parpg.mode import FifeMode
from parpg import components
from parpg.components.fifeagent import commands
from parpg.systems import ScriptingSystem
from parpg.entities.action import ACTIONS

class World(FifeMode, BaseWorld):

    def __init__(self):
        FifeMode.__init__(self)
        BaseWorld.__init__(self)
        
    def configure(self):
        """Configure the game world's components, systems and renderers"""
        for name, component in components.components.iteritems():
            setattr(self.components, name, component)
        self.systems.scripting = ScriptingSystem(commands, ACTIONS)
    
    def pump(self, dt):
        for component in self.components:
            if hasattr(component, "step"):
                component.step(dt)
        for system in self.systems:
            if hasattr(system, "step"):
                system.step(dt)