Ignore:
Timestamp:
10/09/09 20:03:08 (10 years ago)
Author:
eliedebrauwer
Message:

Ticket #66: Patch by saritor (& eliedebrauwer), implements saritors rework of teleporting, at this point it implements the within-a-map teleport successfully, but cross map teleport still has in issue which probably has to do with the setup of the PC. comment[s:trac, t:66]

Location:
trunk/game/scripts/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/__init__.py

    r262 r310  
    1515#   You should have received a copy of the GNU General Public License 
    1616#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    17 import containers 
     17import containers, doors 
    1818import actors 
    1919import sys 
    2020 
    21 object_modules = [containers, actors,] 
     21object_modules = [containers, actors, doors] 
    2222 
    2323def getAllObjects (): 
     
    5050            info[key] = val 
    5151 
     52        # this is for testing purposes 
    5253        return getAllObjects()[obj_type](ID, **info) 
  • trunk/game/scripts/objects/action.py

    r287 r310  
    2424class ChangeMapAction(Action): 
    2525    """A change map scheduled""" 
    26     def __init__(self, engine, targetmap, targetpos): 
    27         """@type engine: Engine reference 
     26    def __init__(self, engine, targetmapname, targetmapfile , targetpos): 
     27        """Initiates a change of the position of the character 
     28           possibly flagging a new map to be loaded. 
     29           @type engine: Engine reference 
    2830           @param engine: A reference to the engine. 
    29            @type targetmap: String 
    30            @param targetmap: Target mapname. 
     31           @type targetmapname: String 
     32           @param targetmapname: Target map id  
     33           @type targetmapfile: String 
     34           @param targetmapfile: Target map filename 
    3135           @type targetpos: Tuple 
    3236           @param targetpos: (X, Y) coordinates on the target map. 
     
    3438        self.engine = engine 
    3539        self.targetpos = targetpos 
    36         self.targetmap = targetmap 
    37         
     40        self.targetmapname = targetmapname 
     41        self.targetmapfile = targetmapfile 
     42 
    3843    def execute(self): 
    3944        """Executes the mapchange.""" 
    40         self.engine.changeMap(self.targetmap, self.targetpos) 
     45        self.engine.changeMap(self.targetmapname, self.targetmapfile, self.targetpos) 
    4146        
    4247class OpenBoxAction(Action): 
  • trunk/game/scripts/objects/actors.py

    r295 r310  
    136136        self.state = _AGENT_STATE_RUN 
    137137        self.behaviour.agent.move('walk', location, self.behaviour.speed-1) 
    138        
     138 
     139    def teleport(self, location): 
     140        """Teleports a PC instantly to the given location. 
     141           @type location: fife.Location 
     142           @param location: Target coordinates for PC. 
     143           @return: None""" 
     144        self.state = _AGENT_STATE_IDLE 
     145        self.behaviour.agent.setLocation(location) 
     146 
    139147    def approach(self, location, action = None): 
    140148        """Approaches an npc and then ???. 
  • trunk/game/scripts/objects/composed.py

    r262 r310  
    3131        Destructable .__init__(self, **kwargs) 
    3232        self.blocking = True 
     33 
     34class Door(GameObject, Lockable, Scriptable, Trappable): 
     35    """Composite class that can be used to create doors on a map.""" 
     36    def __init__ (self, target_map_name = 'my-map', target_map = 'map/map.xml', target_pos = (0.0, 0.0), \ 
     37                        **kwargs): 
     38        GameObject   .__init__(self, **kwargs) 
     39        Lockable     .__init__(self, **kwargs) 
     40        Scriptable   .__init__(self, **kwargs) 
     41        Trappable    .__init__(self, **kwargs) 
     42        self.is_door = True 
     43        self.target_map_name = target_map_name 
     44        self.target_map = target_map 
     45        self.target_pos = target_pos 
     46        self.blocking = True 
Note: See TracChangeset for help on using the changeset viewer.