source: trunk/PARPG/scripts/agents/agent.py @ 67

Revision 67, 1.4 KB checked in by maximinus_parpg, 11 years ago (diff)

All code now PEP-8 standard, with spaces

Line 
1#!/usr/bin/python
2
3#   This file is part of PARPG.
4
5#   PARPG is free software: you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation, either version 3 of the License, or
8#   (at your option) any later version.
9
10#   PARPG is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#   GNU General Public License for more details.
14
15#   You should have received a copy of the GNU General Public License
16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
17
18import fife
19
20class Agent(fife.InstanceActionListener):
21    """Base class for all NPC's and the main character"""
22    def __init__(self, agentName, layer):
23        # add this class for callbacks from fife itself
24        fife.InstanceActionListener.__init__(self)
25        self.agentName = agentName
26        self.agent = layer.getInstance(agentName)
27        self.agent.addActionListener(self)
28
29    def onInstanceActionFinished(self, instance, action):
30        """Called when an action is finished - normally overridden"""
31        raise CodeError("No OnActionFinished defined for Agent")
32
33    def start(self):
34        """Called when agent first used - normally overridden"""
35        raise CodeError("No start defined for Agent")
36
Note: See TracBrowser for help on using the repository browser.