Mercurial > parpg-source
comparison gamestate.py @ 187:ab6a0fd1668a
Added help, moveObject, deleteObject, putItemIntoContainer, equipItem, createItemByID and createItemByType functions to the GameEnvironment.
author | Beliar <KarstenBock@gmx.net> |
---|---|
date | Sat, 24 Mar 2012 09:59:46 +0100 |
parents | 9e7f494cc850 |
children |
comparison
equal
deleted
inserted
replaced
186:c41299c7e833 | 187:ab6a0fd1668a |
---|---|
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 | 12 |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. | 14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. |
15 | |
16 import math | 15 import math |
17 | 16 |
18 from parpg.quest_engine import QuestEngine | 17 from parpg.quest_engine import QuestEngine |
19 | 18 |
19 def script_help(object): | |
20 """Python's help() function with the no-parameters path disabled""" | |
21 help(object) | |
22 | |
20 class GameState(object): | 23 class GameState(object): |
21 """This class holds the current state of the game.""" | 24 """This class holds the current state of the game.""" |
22 def __init__(self, quests_dir = None): | 25 def __init__(self, quests_dir = None): |
23 self.player_character = None | 26 self.player_character = None |
24 self.quest_engine = QuestEngine(quests_dir) | 27 self.quest_engine = QuestEngine(quests_dir) |
27 self.object_ids = {} | 30 self.object_ids = {} |
28 self.current_map_name = None | 31 self.current_map_name = None |
29 self.maps = {} | 32 self.maps = {} |
30 self.npcs_met = set() | 33 self.npcs_met = set() |
31 self.funcs = { | 34 self.funcs = { |
32 "__builtins__":None, | 35 "__builtins__":None, |
33 "meet":self.meet, | 36 "help":script_help, |
34 "met":self.met, | 37 "sqrt":math.sqrt, |
35 "sqrt":math.sqrt, | 38 "log":math.log, |
36 "log":math.log, | 39 "str":str, |
37 "str":str, | 40 "meet":self.meet, |
38 } | 41 "met":self.met, |
42 } | |
39 self.locals = {} | 43 self.locals = {} |
40 | 44 |
41 | 45 |
42 def addObject(self, object_id, map_id, game_object): | 46 def addObject(self, object_id, map_id, game_object): |
43 """Adds an object to the objects and object_ids | 47 """Adds an object to the objects and object_ids |