comparison src/parpg/gamescenecontroller.py @ 80:84d03dc70904

Added code that checks if the object is the player so certain actions (talk, attack) will not appear in the menu.
author KarstenBock@gmx.net
date Thu, 08 Sep 2011 18:36:40 +0200
parents c25c734bd2a7
children 1e7465a785c4
comparison
equal deleted inserted replaced
79:62cff91a19cb 80:84d03dc70904
427 actions = [] 427 actions = []
428 obj = self.model.game_state.\ 428 obj = self.model.game_state.\
429 getObjectById(obj_id, 429 getObjectById(obj_id,
430 self.model.game_state.current_map_name) 430 self.model.game_state.current_map_name)
431 player = self.model.game_state.getObjectById("PlayerCharacter") 431 player = self.model.game_state.getObjectById("PlayerCharacter")
432 432 is_player = obj.fifeagent.identifier == player.fifeagent.identifier
433 433
434 #TODO: Check all actions to be compatible with the grease components 434 #TODO: Check all actions to be compatible with the grease components
435 if obj is not None: 435 if obj is not None:
436 if obj.dialogue: 436 if obj.dialogue and not is_player:
437 actions.append(["Talk", "Talk", self.initTalk, obj]) 437 actions.append(["Talk", "Talk", self.initTalk, obj])
438 if obj.characterstats: 438 if obj.characterstats and not is_player:
439 actions.append(["Attack", "Attack", self.nullFunc, obj]) 439 actions.append(["Attack", "Attack", self.nullFunc, obj])
440 if obj.description: 440 if obj.description:
441 actions.append(["Examine", "Examine", 441 actions.append(["Examine", "Examine",
442 player.fifeagent.behaviour.approach, 442 player.fifeagent.behaviour.approach,
443 [obj.fifeagent.pos.x, obj.fifeagent.pos.y], 443 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
450 player.fifeagent.behaviour.approach, 450 player.fifeagent.behaviour.approach,
451 [obj.fifeagent.pos.x, obj.fifeagent.pos.y], 451 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
452 ChangeMapAction(self, obj.target_map_name, 452 ChangeMapAction(self, obj.target_map_name,
453 obj.target_pos)]) 453 obj.target_pos)])
454 454
455 # is it a container?
456 if obj.lockable: 455 if obj.lockable:
457 actions.append(["Open", "Open", 456 actions.append(["Open", "Open",
458 player.fifeagent.behaviour.approach, 457 player.fifeagent.behaviour.approach,
459 [obj.fifeagent.pos.x, obj.fifeagent.pos.y], 458 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
460 OpenBoxAction(self, obj)]) 459 OpenBoxAction(self, obj)])
464 UnlockBoxAction(self, obj)]) 463 UnlockBoxAction(self, obj)])
465 actions.append(["Lock", "Lock", 464 actions.append(["Lock", "Lock",
466 player.fifeagent.behaviour.approach, 465 player.fifeagent.behaviour.approach,
467 [obj.fifeagent.pos.x, obj.fifeagent.pos.y], 466 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
468 LockBoxAction(self, obj)]) 467 LockBoxAction(self, obj)])
469 # can you pick it up?
470 if obj.containable: 468 if obj.containable:
471 actions.append(["Pick Up", "Pick Up", 469 actions.append(["Pick Up", "Pick Up",
472 player.fifeagent.behaviour.approach, 470 player.fifeagent.behaviour.approach,
473 [obj.fifeagent.pos.x, obj.fifeagent.pos.y], 471 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
474 PickUpAction(self, obj)]) 472 PickUpAction(self, obj)])