Пример #1
0
def handle_input():
    global _DEBUG_ORD, SELECTED_CAMP, SELECTED_SQUAD

    events.trigger_event('input')

    if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
        if not DRAW_MODE == 'news':
            if SELECTED_SQUAD:
                SELECTED_SQUAD = None

                if SELECTED_CAMP:
                    set_draw_mode('camp_info')

                else:
                    set_draw_mode('news')

            else:
                SELECTED_SQUAD = None
                SELECTED_CAMP = None

                set_draw_mode('news')

        else:
            return False

    if controls.get_input_char_pressed('z'):
        _DEBUG_ORD -= 1
        print _DEBUG_ORD

    elif controls.get_input_char_pressed('x'):
        _DEBUG_ORD += 1
        print _DEBUG_ORD

    return True
Пример #2
0
def handle_input():
	global _DEBUG_ORD, SELECTED_CAMP, SELECTED_SQUAD
	
	events.trigger_event('input')
	
	if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
		if not DRAW_MODE == 'news':
			if SELECTED_SQUAD:
				SELECTED_SQUAD = None
				
				if SELECTED_CAMP:
					set_draw_mode('camp_info')
				
				else:
					set_draw_mode('news')
			
			else:
				SELECTED_SQUAD = None
				SELECTED_CAMP = None
				
				set_draw_mode('news')
		
		else:
			return False
	
	if controls.get_input_char_pressed('z'):
		_DEBUG_ORD -= 1
		print _DEBUG_ORD
	
	elif controls.get_input_char_pressed('x'):
		_DEBUG_ORD += 1
		print _DEBUG_ORD
	
	return True
Пример #3
0
def handle_keyboard_input():
    if controls.get_input_char_pressed('\t'):
        if settings.TICK_MODE == 'strategy':
            if ui_panel.ACTIVE_MENU:
                ui_panel.close()
            else:
                ui_panel.show_inventory(entity)

        else:
            _x, _y = movement.get_position(entity)

            camera.set_pos(_x - constants.MAP_VIEW_WIDTH / 2,
                           _y - constants.MAP_VIEW_HEIGHT / 2)

    if controls.get_input_char_pressed('O'):
        settings.toggle_show_node_grid()

    elif controls.get_input_char_pressed('o'):
        settings.toggle_observer_mode()

    if controls.get_input_char_pressed('d'):
        _mx, _my = ui_cursor.get_map_position()

        for entity_id in entities.get_entity_group('life'):
            _entity = entities.get_entity(entity_id)

            if not numbers.distance(
                (_mx, _my), movement.get_position(_entity)):
                _x, _y = ui_cursor.get_screen_position()
                _menu = ui_menu.create(_x, _y, title='Debug')
                ui_menu.add_selectable(_menu, 'Show Metas',
                                       lambda: _show_metas(_entity))
                ui_menu.add_selectable(
                    _menu, 'Kill',
                    lambda: entities.trigger_event(_entity, 'kill'))
                ui_menu.add_selectable(_menu, 'Overwatch',
                                       lambda: ai_debugger.register(_entity))

                break

    if controls.get_input_char_pressed('l'):
        _x, _y = ui_cursor.get_screen_position()
        _mx, _my = ui_cursor.get_map_position()
        _weight = zones.get_active_weight_map()[_my, _mx]
        _menu = ui_menu.create(_x, _y, title='Tile Info')

        ui_menu.add_selectable(
            _menu, 'Warp', lambda: entities.trigger_event(
                entity, 'set_position', x=_mx, y=_my))
        ui_menu.add_selectable(
            _menu, 'Light', lambda: effects.light(_mx,
                                                  _my,
                                                  15,
                                                  r=random.uniform(1.0, 1.5),
                                                  g=random.uniform(1.0, 1.5),
                                                  light_map='static_lighting'))
        ui_menu.add_selectable(_menu, 'Weight: %s' % _weight, lambda: _)
Пример #4
0
def handle_keyboard_input():
	global SELECTED_SQUAD_MEMBER, WALK_PATH, WALK_DEST
	
	#TODO: Check for multiple movement changes at this location
	if not is_squad_member_selected():
		return
	
	_entity = get_selected_squad_member()
	_x, _y = movement.get_position(_entity)
	
	if timers.has_timer_with_name(_entity, 'passout'):
		return
	
	if controls.get_input_char_pressed('z'):
		entities.trigger_event(_entity, 'set_motion', motion='crawl')
		settings.set_tick_mode('normal')
	
	elif controls.get_input_char_pressed('x'):
		entities.trigger_event(_entity, 'set_motion', motion='crouch')
		settings.set_tick_mode('normal')
	
	elif controls.get_input_char_pressed('c'):
		entities.trigger_event(_entity, 'set_motion', motion='stand')
		settings.set_tick_mode('normal')
	
	elif controls.get_input_char_pressed(' '):
		_entity['stats']['action_points'] = 0
		SELECTED_SQUAD_MEMBER = None
		WALK_DEST = None
		WALK_PATH = []
		_broken = False
		
		for squad_id in entities.get_entity_group('squads'):
			_squad = entities.get_entity(squad_id)
			
			if not _squad['faction'] == 'Rogues':
				continue
		
			for entity_id in _squad['members']:
				_entity = entities.get_entity(entity_id)
				
				if _entity['stats']['action_points'] > 0:
					_broken = True
					break
			
			if _broken:
				break
		
		else:
			settings.set_tick_mode('normal')
Пример #5
0
def handle_keyboard_input():
    global SELECTED_SQUAD_MEMBER, WALK_PATH, WALK_DEST

    #TODO: Check for multiple movement changes at this location
    if not is_squad_member_selected():
        return

    _entity = get_selected_squad_member()
    _x, _y = movement.get_position(_entity)

    if timers.has_timer_with_name(_entity, 'passout'):
        return

    if controls.get_input_char_pressed('z'):
        entities.trigger_event(_entity, 'set_motion', motion='crawl')
        settings.set_tick_mode('normal')

    elif controls.get_input_char_pressed('x'):
        entities.trigger_event(_entity, 'set_motion', motion='crouch')
        settings.set_tick_mode('normal')

    elif controls.get_input_char_pressed('c'):
        entities.trigger_event(_entity, 'set_motion', motion='stand')
        settings.set_tick_mode('normal')

    elif controls.get_input_char_pressed(' '):
        _entity['stats']['action_points'] = 0
        SELECTED_SQUAD_MEMBER = None
        WALK_DEST = None
        WALK_PATH = []
        _broken = False

        for squad_id in entities.get_entity_group('squads'):
            _squad = entities.get_entity(squad_id)

            if not _squad['faction'] == 'Rogues':
                continue

            for entity_id in _squad['members']:
                _entity = entities.get_entity(entity_id)

                if _entity['stats']['action_points'] > 0:
                    _broken = True
                    break

            if _broken:
                break

        else:
            settings.set_tick_mode('normal')
Пример #6
0
def handle_input():
    events.trigger_event('input')

    if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
        return False

    if controls.get_input_char_pressed('\r'):
        return False

    elif controls.get_input_char_pressed(' '):
        roll()

    elif controls.get_input_char_pressed('k'):
        display.screenshot('screenshot-%s.bmp' % time.time())

    return True
Пример #7
0
def handle_input():
	global EXIT_MENU
	
	if QUIT:
		return False
	
	if settings.TICK_MODE in ['normal', 'strategy']:
		if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
			if ui_dialog.get_active_dialog():
				ui_dialog.delete(ui_dialog.get_active_dialog())
			
			elif EXIT_MENU:
				return False
			
			elif ui_menu.get_active_menu():
				_menu = ui_menu.get_active_menu()

				ui_menu.delete(_menu)

				if ui_panel.ACTIVE_MENU == _menu:
					ui_panel.close()
			else:
				EXIT_MENU = ui_menu.create((constants.WINDOW_WIDTH / 2) - 2, 18, title='Menu')
				
				ui_menu.add_selectable(EXIT_MENU, 'Quit', lambda: _quit())

		if settings.TICK_MODE == 'strategy':
			ui_squad_control.handle_keyboard_input()

	if controls.get_input_char_pressed('k'):
		display.screenshot('screenshot-%s.bmp' % time.time())

	return True
Пример #8
0
def handle_input():
	events.trigger_event('input')
	
	if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
		return False
	
	if controls.get_input_char_pressed('\r'):
		return False
	
	elif controls.get_input_char_pressed(' '):
		roll()
	
	elif controls.get_input_char_pressed('k'):
		display.screenshot('screenshot-%s.bmp' % time.time())
	
	return True
Пример #9
0
def handle_input():
    global EXIT_MENU

    if QUIT:
        return False

    if settings.TICK_MODE in ['normal', 'strategy']:
        if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
            if ui_dialog.get_active_dialog():
                ui_dialog.delete(ui_dialog.get_active_dialog())

            elif EXIT_MENU:
                return False

            elif ui_menu.get_active_menu():
                _menu = ui_menu.get_active_menu()

                ui_menu.delete(_menu)

                if ui_panel.ACTIVE_MENU == _menu:
                    ui_panel.close()
            else:
                EXIT_MENU = ui_menu.create((constants.WINDOW_WIDTH / 2) - 2,
                                           18,
                                           title='Menu')

                ui_menu.add_selectable(EXIT_MENU, 'Quit', lambda: _quit())

        if settings.TICK_MODE == 'strategy':
            ui_squad_control.handle_keyboard_input()

    if controls.get_input_char_pressed('k'):
        display.screenshot('screenshot-%s.bmp' % time.time())

    return True
Пример #10
0
def handle_keyboard_input():
	if controls.get_input_char_pressed('\t'):
		if settings.TICK_MODE == 'strategy':
			if ui_panel.ACTIVE_MENU:
				ui_panel.close()
			else:
				ui_panel.show_inventory(entity)
		
		else:
			_x, _y = movement.get_position(entity)
			
			camera.set_pos(_x - constants.MAP_VIEW_WIDTH/2, _y - constants.MAP_VIEW_HEIGHT/2)
	
	if controls.get_input_char_pressed('O'):
		settings.toggle_show_node_grid()
	
	elif controls.get_input_char_pressed('o'):
		settings.toggle_observer_mode()
	
	if controls.get_input_char_pressed('d'):
		_mx, _my = ui_cursor.get_map_position()
		
		for entity_id in entities.get_entity_group('life'):
			_entity = entities.get_entity(entity_id)
			
			if not numbers.distance((_mx, _my), movement.get_position(_entity)):
				_x, _y = ui_cursor.get_screen_position()
				_menu = ui_menu.create(_x, _y, title='Debug')
				ui_menu.add_selectable(_menu, 'Show Metas', lambda: _show_metas(_entity))
				ui_menu.add_selectable(_menu, 'Kill', lambda: entities.trigger_event(_entity, 'kill'))
				ui_menu.add_selectable(_menu, 'Overwatch', lambda: ai_debugger.register(_entity))
				
				break
	
	if controls.get_input_char_pressed('l'):
		_x, _y = ui_cursor.get_screen_position()
		_mx, _my = ui_cursor.get_map_position()
		_weight = zones.get_active_weight_map()[_my, _mx]
		_menu = ui_menu.create(_x, _y, title='Tile Info')
		
		ui_menu.add_selectable(_menu, 'Warp', lambda: entities.trigger_event(entity, 'set_position', x=_mx, y=_my))
		ui_menu.add_selectable(_menu, 'Light', lambda: effects.light(_mx, _my, 15, r=random.uniform(1.0, 1.5), g=random.uniform(1.0, 1.5), light_map='static_lighting'))
		ui_menu.add_selectable(_menu, 'Weight: %s' % _weight, lambda: _)
Пример #11
0
def handle_input():
    global MENU_ITEM_SELECTED

    events.trigger_event('input')

    if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
        return False

    if controls.get_input_char_pressed('s'):
        MENU_ITEM_SELECTED += 1

    elif controls.get_input_char_pressed('w'):
        MENU_ITEM_SELECTED -= 1

    MENU_ITEM_SELECTED = numbers.clip(MENU_ITEM_SELECTED, 0, 2)

    if controls.get_input_char_pressed('\r'):
        return False

    if controls.get_input_char_pressed('k'):
        display.screenshot('screenshot-%s.bmp' % time.time())

    return True
Пример #12
0
def handle_input():
    global MENU_ITEM_SELECTED

    events.trigger_event("input")

    if controls.get_input_ord_pressed(constants.KEY_ESCAPE):
        return False

    if controls.get_input_char_pressed("s"):
        MENU_ITEM_SELECTED += 1

    elif controls.get_input_char_pressed("w"):
        MENU_ITEM_SELECTED -= 1

    MENU_ITEM_SELECTED = numbers.clip(MENU_ITEM_SELECTED, 0, 2)

    if controls.get_input_char_pressed("\r"):
        return False

    if controls.get_input_char_pressed("k"):
        display.screenshot("screenshot-%s.bmp" % time.time())

    return True