Changeset 320 for trunk/game


Ignore:
Timestamp:
10/12/09 19:50:53 (10 years ago)
Author:
orlandov
Message:

Ticket #100: Patch by or1andov. Specify dialogue files for NPCs in their XML map instance attribute. fixes[s:trac, t:100]

Location:
trunk/game
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/local_loaders/xmlmap.py

    r317 r320  
    289289            #Check for PARPG specific object attributes 
    290290            object_type = instance.get('object_type') 
    291             if ( object_type ): 
     291            if object_type: 
    292292                inst_dict = {} 
    293293                inst_dict["type"] = object_type 
     
    300300                inst_dict["name"] = instance.get('name') 
    301301                inst_dict["text"] = instance.get('text') 
     302                if instance.get('dialogue'): 
     303                    inst_dict['dialogue'] = instance.get('dialogue') 
    302304                inst_dict["target_map_name"] = instance.get('target_map_name') 
    303305                inst_dict["target_map"] = instance.get('target_map') 
    304306                inst_dict["target_pos"] = (instance.get('target_x'), instance.get('target_y')) 
    305                 self.data.createObject( layer, inst_dict, inst ) 
     307                self.data.createObject(layer, inst_dict, inst) 
    306308                 
    307309    def parseCameras(self, map_elt, map): 
     
    345347                i += 1 
    346348                self.callback('loaded camera: ' +  str(id), float( i / len(tmplist) * 0.25 + 0.75 ) )     
    347              
  • trunk/game/maps/map.xml

    r317 r320  
    19491949      <i x="-5.0" o="long_coat_female" z="0.0" y="-3.0" r="0" id="long_coat_female0" object_type="NonPlayerCharacter" text="A woman wearing a large coat"/> 
    19501950      <i x="-5.0" o="long_coat_male" z="0.0" y="-4.0" r="0" id="long_coat_male0" object_type="NonPlayerCharacter" text="A man wearing a large coat"/> 
    1951       <i x="-5.0" o="male_farmer_1" z="0.0" y="-5.0" r="0" id="male_farmer0" object_type="NonPlayerCharacter" text="A grimy looking farmer"/> 
     1951      <i x="-5.0" o="male_farmer_1" z="0.0" y="-5.0" r="0" dialogue="dialogue/farmer.yaml" id="male_farmer0" object_type="NonPlayerCharacter" text="A grimy looking farmer"/> 
    19521952      <i x="-5.0" o="male_traveler_1" z="0.0" y="-6.0" r="0" id="male_traveler0" object_type="NonPlayerCharacter" text="A wandering traveler"/> 
    1953       <i x="-5.0" o="npc_woman" z="0.0" y="-7.0" r="0" id="woman01" object_type="NonPlayerCharacter" text="A friendly woman"/> 
     1953      <i x="-5.0" o="npc_woman" z="0.0" y="-7.0" r="0" id="woman01" dialogue="dialogue/sample.yaml" object_type="NonPlayerCharacter" text="A friendly woman"/> 
    19541954      <i x="-3.0" o="crate" z="0.0" y="-4.0" r="0" id="crate01" object_type="WoodenCrate" is_open="False" locked="False" name="asdf" text="A crate that is covered in grime and dirt. There doesn't seem to be anything remarkable about it"/> 
    19551955      <!-- There can be any number of objects --> 
  • trunk/game/scripts/dialoguegui.py

    r317 r320  
    6464            'pc': pc 
    6565        } 
    66         self.dialogue_engine = DialogueEngine('dialogue/sample.yaml', 
     66        self.dialogue_engine = DialogueEngine(npc.dialogue, 
    6767                                              dialogue_callbacks, state) 
    6868        self.dialogue_gui = pychan.loadXML("gui/dialogue.xml") 
  • trunk/game/scripts/objects/action.py

    r315 r320  
    9595        pc = self.engine.game_state.PC 
    9696        pc.behaviour.agent.act('stand', self.npc.getLocation()) 
    97         self.npc.talk(pc) 
    98         self.engine.view.hud.showDialogue(self.npc) 
     97 
     98        if self.npc.dialogue is not None: 
     99            self.npc.talk(pc) 
     100            self.engine.view.hud.showDialogue(self.npc) 
     101        else: 
     102            self.npc.behaviour.agent.say("Leave me alone!", 1000) 
  • trunk/game/scripts/objects/actors.py

    r315 r320  
    242242         
    243243        self.behaviour = NPCBehaviour(self, agent_layer) 
     244        self.dialogue = kwargs.get('dialogue') 
    244245 
    245246    def getLocation(self): 
Note: See TracChangeset for help on using the changeset viewer.