def CallExternalScript(ID, args = None):
    script_data = DataGrinder.get_script_data(ID)
    script_data[1]['args'] = args
    script = __import__(script_data[0]['Name'])
    scriptcall = getattr(script, 'call')
    result = scriptcall(**script_data[1])
    return result
Example #2
0
    def __init__(self, x, y, ID, map):
        self.x = x
        self.y = y

        actor_data = DataGrinder.get_actor_data(ID)
        self.name = actor_data['Name']
        self.char = actor_data['Char']
        self.bcolor = map.map[self.x][self.y].bcolor
        self.fcolor = actor_data['Fcolor']
        self.ai_script = actor_data['AI_Script_Ref']

        map.map[x][y].actor = self
Example #3
0
    def __init__(self, x, y, ID, prop=None, actor=None,item=None):
        self.x = x
        self.y = y
        self.prop = prop
        self.actor = actor
        self.item = item

        tile_data = DataGrinder.get_tile_data(ID)
        self.char = tile_data['Char']
        self.fcolor = tile_data['Fcolor']
        self.bcolor = tile_data['Bcolor']
        self.solid = tile_data['Solid']
        self.block_sight = tile_data['Block_sight']
        self.explored = False
Example #4
0
    def __init__(self, x, y, ID, map):
        self.x = x
        self.y = y

        prop_data = DataGrinder.get_prop_data(ID)

        self.char = prop_data['Char']
        self.name = prop_data['Name']
        self.fcolor = prop_data['Fcolor']
        self.bcolor = map[x][y].bcolor
        self.solid = prop_data['Solid']
        self.block_sight = prop_data['Block_sight']

        map[x][y].prop = self
Example #5
0
    def __init__(self, ID):
        map_data = DataGrinder.get_map_data(ID)

        self.width = map_data['Width']
        self.height = map_data['Height']
        self.size_variance = map_data['Size_Variance']
        self.name = map_data['Name']
        self.num_rooms = map_data['Num_Rooms']
        self.script_id = map_data['Script_ID']
        self.tile_ids = map_data['Tile_IDs']
        (self.map, self.objects, self.rooms) = ScriptHandler.CallExternalScript(self.script_id, map_data)

        self.fov_map  = libtcod.map_new(self.width, self.height)
        for x in range(self.width):
            for y in range(self.height):
                tile_block_sight = self.map[x][y].block_sight
                if self.map[x][y].prop != None:
                    tile_block_sight = tile_block_sight + self.map[x][y].prop.block_sight
                libtcod.map_set_properties(self.fov_map, x, y, not tile_block_sight, not self.map[x][y].solid)