comparison gamestate.py @ 180:0d0422243490

The getGameEnvironment method of GameState will now return a globals dictionary where __builtins__ is disabled.
author Beliar
date Sat, 10 Mar 2012 13:31:47 +0100
parents 230d316cc43b
children 7b6aba7839ea
comparison
equal deleted inserted replaced
179:90b2545f7459 180:0d0422243490
27 self.object_ids = {} 27 self.object_ids = {}
28 self.current_map_name = None 28 self.current_map_name = None
29 self.maps = {} 29 self.maps = {}
30 self.npcs_met = set() 30 self.npcs_met = set()
31 self.funcs = { 31 self.funcs = {
32 "__builtins__":None,
32 "meet":self.meet, 33 "meet":self.meet,
33 "met":self.met, 34 "met":self.met,
34 "sqrt":math.sqrt, 35 "sqrt":math.sqrt,
35 "log":math.log, 36 "log":math.log,
36 } 37 }
173 def getGameEnvironment(self): 174 def getGameEnvironment(self):
174 """Returns a 2 item list containing the entities and functions that 175 """Returns a 2 item list containing the entities and functions that
175 can work with it. This can be used in functions like eval or exec""" 176 can work with it. This can be used in functions like eval or exec"""
176 vals = {} 177 vals = {}
177 vals.update(self.getObjectDictOfMap(self.current_map_name)) 178 vals.update(self.getObjectDictOfMap(self.current_map_name))
178 return vals, self.funcs 179 return self.funcs, vals