def boot(): create_human_faction('Militia', (4, 4), (4, 6), ['Terrorists', 'Rogues', 'Wild Dogs']) create_human_faction('Terrorists', (4, 4), (2, 3), ['Militia', 'Wild Dogs', 'Rogues']) create_human_faction('Rogues', (4, 4), (1, 1), ['Militia', 'Wild Dogs', 'Terrorists']) create_dog_faction('Wild Dogs', (2, 4), (0, 0), ['Militia', 'Terrorists', 'Rogues']) events.register_event('logic', logic)
def boot(): global DIRECTOR _entity = entities.create_entity(group='systems') DIRECTOR = _entity events.register_event('input', handle_keyboard_input) timers.register(_entity)
def show_inventory(entity): global ACTIVE_MENU display.fill_surface('ui_inventory', (45, 45, 45)) events.register_event('draw', draw) _holder_menu = ui_menu.create(1, 1, title='Inventory', surface='ui_inventory', click_offset=(constants.MAP_VIEW_WIDTH-35, 0)) ACTIVE_MENU = _holder_menu ui_menu.add_selectable(_holder_menu, 'Weapon', lambda: show_weapons(entity))
def boot(): global CURSOR CURSOR = entities.create_entity(group='systems') tile.register(CURSOR, surface='ui') events.register_event('camera', logic) events.register_event('mouse_moved', handle_mouse_movement) events.register_event('mouse_pressed', handle_mouse_pressed) events.register_event('input', handle_keyboard_input) events.register_event('draw', lambda *args: entities.trigger_event(CURSOR, 'draw')) entities.trigger_event(CURSOR, 'set_position', x=constants.MAP_VIEW_WIDTH/2, y=constants.MAP_VIEW_HEIGHT/2)
def show_inventory(entity): global ACTIVE_MENU display.fill_surface('ui_inventory', (45, 45, 45)) events.register_event('draw', draw) _holder_menu = ui_menu.create(1, 1, title='Inventory', surface='ui_inventory', click_offset=(constants.MAP_VIEW_WIDTH - 35, 0)) ACTIVE_MENU = _holder_menu ui_menu.add_selectable(_holder_menu, 'Weapon', lambda: show_weapons(entity))
def boot(): global CURSOR CURSOR = entities.create_entity(group='systems') tile.register(CURSOR, surface='ui') events.register_event('camera', logic) events.register_event('mouse_moved', handle_mouse_movement) events.register_event('mouse_pressed', handle_mouse_pressed) events.register_event('input', handle_keyboard_input) events.register_event('draw', lambda *args: entities.trigger_event(CURSOR, 'draw')) entities.trigger_event(CURSOR, 'set_position', x=constants.MAP_VIEW_WIDTH / 2, y=constants.MAP_VIEW_HEIGHT / 2)
def create(): global QUIT QUIT = False entities.create_entity_group('tiles', static=True) entities.create_entity_group('bullets', static=True) entities.create_entity_group('node_grid', static=True) entities.create_entity_group('missions', static=True) entities.create_entity_group('ui') entities.create_entity_group('ui_menus') entities.create_entity_group('ui_dialogs') entities.create_entity_group('nodes') entities.create_entity_group('effects_freetick') entities.create_entity_group('ui_effects_freetick') entities.create_entity_group('contexts') entities.create_entity_group('effects', static=True) entities.create_entity_group('ui_effects', static=True) display.create_surface('life', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT) display.create_surface('items', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT) display.create_surface('nodes', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT) display.create_surface('node_grid', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT) display.create_surface('effects', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT) display.create_surface('ui_inventory', width=35, height=constants.MAP_VIEW_HEIGHT) display.create_surface('ui') display.create_surface('ui_menus') display.create_surface('ui_dialogs') display.set_clear_surface('effects', 'tiles') display.set_clear_surface('ui_menus', 'tiles') display.set_clear_surface('ui_dialogs', 'tiles') display.set_clear_surface('ui', 'tiles') display.set_clear_surface('life', 'tiles') display.set_clear_surface('nodes', 'tiles') display.set_clear_surface('effects', 'tiles') events.register_event('mouse_pressed', handle_mouse_pressed) events.register_event('mouse_moved', handle_mouse_movement) events.register_event('camera', camera.update) camera.set_pos(0, 0) ui_cursor.boot() ai.boot() ui_input.boot() ui_draw.boot() ui_menu.boot() ui_dialog.boot() ui_director.boot()
def boot(): events.register_event('post_unload', reset_collision_map)
def boot(): events.register_event('mouse_pressed', handle_mouse_pressed) events.register_event('mouse_moved', handle_mouse_moved) events.register_event('draw', lambda: draw_all('ui_dialogs'))
def register_input(): events.register_event('mouse_moved', handle_mouse_moved) events.register_event('mouse_pressed', handle_mouse_pressed)
def boot(): events.register_event('input', handle_keyboard_input)
def activate(zone_id): global ACTIVE_ZONE ACTIVE_ZONE = zone_id _zone = ZONES[zone_id] _noise = tcod.noise_new(2) logging.info('Bringing zone \'%s\' online...' % _zone['name']) _zone['astar_map'] = pathfinding.setup(_zone['width'], _zone['height'], _zone['solids']) _zone['los_map'] = mapgen.generate_los_map(_zone['width'], _zone['height'], _zone['solids']) display.create_surface('tiles', width=_zone['width'], height=_zone['height']) maps.render_map(_zone['tile_map'], _zone['width'], _zone['height']) post_processing.start() events.register_event('logic', post_processing.tick_sun) _static_lighting = display.create_shader(_zone['width'], _zone['height'], start_offset=1) _zone['shaders'].append(post_processing.generate_shadow_map(_zone['width'], _zone['height'], _zone['solids'], _zone['trees'], _zone['inside'])) _zone['shaders'].append(post_processing.generate_light_map(_zone['width'], _zone['height'], _zone['solids'], _zone['trees'])) _zone['light_maps']['static_lighting'] = _static_lighting _zone['shaders'].append(_static_lighting) _noise = tcod.noise_new(3) _zoom = 2.0 _zone['fader'] = display.create_shader(_zone['width'], _zone['height']) _shader = display.create_shader(_zone['width'], _zone['height']) for y in range(0, _zone['height']): for x in range(0, _zone['width']): if (x, y) in _zone['inside']: _height = .75 else: _noise_values = [(_zoom * x / _zone['width']), (_zoom * y / _zone['height'])] _height = .35 + numbers.clip(tcod.noise_get_turbulence(_noise, _noise_values, tcod.NOISE_SIMPLEX), .35, 1) _shader[0][y, x] = 1.3 * _height _shader[1][y, x] = 1.3 * _height _shader[2][y, x] = 1.1 * _height _zone['shaders'].append(_shader) for light in _zone['lights']: effects.light(light[0], light[1], light[2], r=light[3], g=light[4], b=light[5], light_map='static_lighting') #if not '--no-fx' in sys.argv: # post_processing.run(time=8, # repeat=-1, # repeat_callback=lambda _: post_processing.post_process_clouds(constants.MAP_VIEW_WIDTH, # constants.MAP_VIEW_HEIGHT, # 8, # _noise, # _zone['inside'])) post_processing.run(time=0, repeat=-1, repeat_callback=lambda _: post_processing.post_process_lights()) #post_processing.run(time=0, # repeat=-1, # repeat_callback=lambda _: post_processing.sunlight()) camera.set_limits(0, 0, _zone['width']-constants.MAP_VIEW_WIDTH, _zone['height']-constants.MAP_VIEW_HEIGHT) logging.info('Zone \'%s\' is online' % _zone['name'])
def boot(): events.register_event('logic', logic)
def boot(): events.register_event('logic', all_logic)
def boot(): events.register_event('mouse_pressed', handle_mouse_pressed) events.register_event('mouse_moved', handle_mouse_moved) events.register_event('draw', draw_all) events.register_event('tick', tick)
def activate(zone_id): global ACTIVE_ZONE ACTIVE_ZONE = zone_id _zone = ZONES[zone_id] _noise = tcod.noise_new(2) logging.info('Bringing zone \'%s\' online...' % _zone['name']) _zone['astar_map'] = pathfinding.setup(_zone['width'], _zone['height'], _zone['solids']) _zone['los_map'] = mapgen.generate_los_map(_zone['width'], _zone['height'], _zone['solids']) display.create_surface('tiles', width=_zone['width'], height=_zone['height']) maps.render_map(_zone['tile_map'], _zone['width'], _zone['height']) post_processing.start() events.register_event('logic', post_processing.tick_sun) _static_lighting = display.create_shader(_zone['width'], _zone['height'], start_offset=1) _zone['shaders'].append( post_processing.generate_shadow_map(_zone['width'], _zone['height'], _zone['solids'], _zone['trees'], _zone['inside'])) _zone['shaders'].append( post_processing.generate_light_map(_zone['width'], _zone['height'], _zone['solids'], _zone['trees'])) _zone['light_maps']['static_lighting'] = _static_lighting _zone['shaders'].append(_static_lighting) _noise = tcod.noise_new(3) _zoom = 2.0 _zone['fader'] = display.create_shader(_zone['width'], _zone['height']) _shader = display.create_shader(_zone['width'], _zone['height']) for y in range(0, _zone['height']): for x in range(0, _zone['width']): if (x, y) in _zone['inside']: _height = .75 else: _noise_values = [(_zoom * x / _zone['width']), (_zoom * y / _zone['height'])] _height = .35 + numbers.clip( tcod.noise_get_turbulence(_noise, _noise_values, tcod.NOISE_SIMPLEX), .35, 1) _shader[0][y, x] = 1.3 * _height _shader[1][y, x] = 1.3 * _height _shader[2][y, x] = 1.1 * _height _zone['shaders'].append(_shader) for light in _zone['lights']: effects.light(light[0], light[1], light[2], r=light[3], g=light[4], b=light[5], light_map='static_lighting') #if not '--no-fx' in sys.argv: # post_processing.run(time=8, # repeat=-1, # repeat_callback=lambda _: post_processing.post_process_clouds(constants.MAP_VIEW_WIDTH, # constants.MAP_VIEW_HEIGHT, # 8, # _noise, # _zone['inside'])) post_processing.run( time=0, repeat=-1, repeat_callback=lambda _: post_processing.post_process_lights()) #post_processing.run(time=0, # repeat=-1, # repeat_callback=lambda _: post_processing.sunlight()) camera.set_limits(0, 0, _zone['width'] - constants.MAP_VIEW_WIDTH, _zone['height'] - constants.MAP_VIEW_HEIGHT) logging.info('Zone \'%s\' is online' % _zone['name'])