Mercurial > parpg-source
comparison gamescenecontroller.py @ 161:d224bbce512a
Implemented loading scripts from files.
author | KarstenBock@gmx.net |
---|---|
date | Thu, 17 Nov 2011 20:36:08 +0100 |
parents | 75c0b728ccf3 |
children | b3b82c2aebee |
comparison
equal
deleted
inserted
replaced
160:75c0b728ccf3 | 161:d224bbce512a |
---|---|
353 deleted.extend( | 353 deleted.extend( |
354 self.model.game_state.deleteObjectsFromMap(None) | 354 self.model.game_state.deleteObjectsFromMap(None) |
355 ) | 355 ) |
356 for obj in deleted: | 356 for obj in deleted: |
357 obj.delete() | 357 obj.delete() |
358 self.model.loadMap(self.model.target_map_name) | |
359 self.setupScripts(self.model.target_map_name) | |
358 | 360 |
359 self.model.loadMap(self.model.target_map_name) | 361 self.model.setActiveMap(self.model.target_map_name, self) |
360 | |
361 self.model.setActiveMap(self.model.target_map_name) | |
362 | 362 |
363 self.model.placeAgents(self) | 363 self.model.placeAgents(self) |
364 self.model.placePC(self) | 364 self.model.placePC(self) |
365 self.model.updateObjectDB(self) | 365 self.model.updateObjectDB(self) |
366 self.model.map_change = False | 366 self.model.map_change = False |
369 # At this point we sync the contents of the ready slots | 369 # At this point we sync the contents of the ready slots |
370 # with the contents of the inventory. | 370 # with the contents of the inventory. |
371 self.view.hud.inventory = None | 371 self.view.hud.inventory = None |
372 self.view.hud.initializeInventory() | 372 self.view.hud.initializeInventory() |
373 self.pause(False) | 373 self.pause(False) |
374 | |
375 def setupScripts(self, map_name): | |
376 """Read scripts for the current map""" | |
377 self.systems.scripting.reset() | |
378 self.model.readScriptsOfMap(map_name, self) | |
374 | 379 |
375 def handleScrolling(self): | 380 def handleScrolling(self): |
376 """ | 381 """ |
377 Merge kb and mouse related scroll data, limit the speed and | 382 Merge kb and mouse related scroll data, limit the speed and |
378 move the camera. | 383 move the camera. |
536 # Load the current map | 541 # Load the current map |
537 if self.model.game_state.current_map_name: | 542 if self.model.game_state.current_map_name: |
538 self.model.loadMap(self.model.game_state.current_map_name) | 543 self.model.loadMap(self.model.game_state.current_map_name) |
539 self.model.placeAgents(self) | 544 self.model.placeAgents(self) |
540 self.model.placePC(self) | 545 self.model.placePC(self) |
546 self.setupScripts(self.model.game_state.current_map_name) | |
541 self.view.hud.initializeInventory() | 547 self.view.hud.initializeInventory() |
542 | 548 |
543 def quitGame(self): | 549 def quitGame(self): |
544 """Quits the game | 550 """Quits the game |
545 @return: None""" | 551 @return: None""" |