def look(life): if not 'CAN_SEE' in life['life_flags']: return False for target_id in life['know']: if life['know'][target_id]['last_seen_time']: life['know'][target_id]['last_seen_time'] += 1 life['know'][target_id]['time_visible'] = 0 else: life['know'][target_id]['time_visible'] += 1 if 'player' in life: if life['path'] or not brain.get_flag(life, 'visible_chunks'): if SETTINGS['smp']: _visible_chunks = post_scan_surroundings(life) else: _visible_chunks = scan_surroundings(life, judge=False, get_chunks=True, ignore_chunks=0) _chunks = [maps.get_chunk(c) for c in _visible_chunks] brain.flag(life, 'visible_chunks', value=_visible_chunks) elif 'player' in life: _visible_chunks = brain.get_flag(life, 'visible_chunks') _chunks = [maps.get_chunk(c) for c in _visible_chunks] else: #This is for optimizing. Be careful if you mess with this... _nearby_alife = {} for alife in LIFE.values(): if alife['id'] == life['id']: continue if bad_numbers.distance( life['pos'], alife['pos']) <= get_vision(life) and can_see_position( life, alife['pos']): _nearby_alife[alife['id']] = { 'pos': alife['pos'][:], 'stance': alife['stance'] } _last_nearby_alife = brain.get_flag(life, '_nearby_alife') if not _last_nearby_alife == _nearby_alife: brain.flag(life, '_nearby_alife', value=_nearby_alife) else: for target_id in life['seen']: if life['know'][target_id]['last_seen_time']: life['know'][target_id]['last_seen_time'] = 0 return False _chunks = [ maps.get_chunk(c) for c in brain.get_flag(life, 'visible_chunks') ] life['seen'] = [] life['seen_items'] = [] for item_uid in life['know_items']: life['know_items'][item_uid]['last_seen_time'] += 1 for target_id in life['know']: life['know'][target_id]['last_seen_time'] += 1 if life['know'][target_id]['last_seen_time'] >= 10 and not life[ 'know'][target_id]['escaped']: life['know'][target_id]['escaped'] = 1 if not 'player' in life: quick_look(life) return False for chunk in _chunks: judgement.judge_chunk_visually( life, '%s,%s' % (chunk['pos'][0], chunk['pos'][1])) judgement.judge_chunk_life( life, '%s,%s' % (chunk['pos'][0], chunk['pos'][1])) for ai in [LIFE[i] for i in chunk['life']]: if ai['id'] == life['id']: continue if not is_in_fov(life, ai['pos']): if ai['id'] in life['know']: life['know'][ai['id']]['time_visible'] = 0 continue if not ai['id'] in life['know']: brain.meet_alife(life, ai) _visibility = get_visiblity_of_position(life, ai['pos']) _stealth_coverage = get_stealth_coverage(ai) if _visibility < 1 - _stealth_coverage: continue life['seen'].append(ai['id']) if life['think_rate'] == life['think_rate_max']: lfe.create_and_update_self_snapshot(LIFE[ai['id']]) judgement.judge_life(life, ai['id']) if ai['dead']: if 'player' in life and not life['know'][ ai['id']]['dead'] and life['know'][ ai['id']]['last_seen_time'] > 25: logic.show_event('You discover the body of %s.' % ' '.join(ai['name']), life=ai) if life['know'][ai['id']]['group']: groups.remove_member(life, life['know'][ai['id']]['group'], ai['id']) life['know'][ai['id']]['group'] = None core.record_loss(1) life['know'][ai['id']]['dead'] = True elif ai['asleep']: life['know'][ai['id']]['asleep'] = True elif not ai['asleep']: life['know'][ai['id']]['asleep'] = False life['know'][ai['id']]['last_seen_time'] = 0 life['know'][ai['id']]['last_seen_at'] = ai['pos'][:] life['know'][ai['id']]['escaped'] = False life['know'][ai['id']]['state'] = ai['state'] life['know'][ai['id']]['state_tier'] = ai['state_tier'] if brain.alife_has_flag(life, ai['id'], 'search_map'): brain.unflag_alife(life, ai['id'], 'search_map') _chunk_id = lfe.get_current_chunk_id(ai) judgement.judge_chunk(life, _chunk_id, seen=True) for item in [ITEMS[i] for i in chunk['items'] if i in ITEMS]: if not is_in_fov(life, item['pos']): continue if not item['uid'] in life['know_items']: brain.remember_item(life, item) if items.is_item_owned(item['uid']): #TODO: This doesn't work because we are specifically checking chunks if item['owner'] and lfe.item_is_equipped( LIFE[item['owner']], item['uid']): life['know_items'][item['uid']]['last_seen_at'] = LIFE[ item['owner']]['pos'] life['know_items'][ item['uid']]['last_owned_by'] = item['owner'] life['know_items'][item['uid']]['last_seen_time'] = 0 continue life['seen_items'].append(item['uid']) life['know_items'][item['uid']]['last_seen_at'] = item['pos'][:] life['know_items'][item['uid']]['last_seen_time'] = 0 life['know_items'][item['uid']]['last_owned_by'] = None life['know_items'][item['uid']]['score'] = judgement.judge_item( life, item['uid']) life['know_items'][item['uid']]['lost'] = False
def quick_look(life): _life = [] _items = [] _current_chunk = lfe.get_current_chunk_id(life) _current_chunk_pos = chunks.get_chunk(_current_chunk)['pos'] _x_chunk_min = bad_numbers.clip( _current_chunk_pos[0] - ((get_vision(life) / WORLD_INFO['chunk_size']) * WORLD_INFO['chunk_size']), 0, MAP_SIZE[0] - WORLD_INFO['chunk_size']) _y_chunk_min = bad_numbers.clip( _current_chunk_pos[1] - ((get_vision(life) / WORLD_INFO['chunk_size']) * WORLD_INFO['chunk_size']), 0, MAP_SIZE[1] - WORLD_INFO['chunk_size']) _x_chunk_max = bad_numbers.clip( _current_chunk_pos[0] + ((get_vision(life) / WORLD_INFO['chunk_size']) * WORLD_INFO['chunk_size']), 0, MAP_SIZE[0] - WORLD_INFO['chunk_size']) _y_chunk_max = bad_numbers.clip( _current_chunk_pos[1] + ((get_vision(life) / WORLD_INFO['chunk_size']) * WORLD_INFO['chunk_size']), 0, MAP_SIZE[1] - WORLD_INFO['chunk_size']) _has_ready_weapon = combat.has_ready_weapon(life) for y in range(_y_chunk_min, _y_chunk_max, WORLD_INFO['chunk_size']): for x in range(_x_chunk_min, _x_chunk_max, WORLD_INFO['chunk_size']): _chunk_key = '%s,%s' % (x, y) _chunk = chunks.get_chunk(_chunk_key) for life_id in _chunk['life']: ai = LIFE[life_id] if ai['dead']: continue if life_id == life['id']: continue if not can_see_position(life, LIFE[life_id]['pos']): continue _visibility = get_visiblity_of_position(life, ai['pos']) _stealth_coverage = get_stealth_coverage(ai) if _visibility < 1 - _stealth_coverage: continue if not ai['id'] in life['know']: brain.meet_alife(life, ai) life['seen'].append(ai['id']) if life['think_rate'] == life['think_rate_max']: lfe.create_and_update_self_snapshot(LIFE[ai['id']]) judgement.judge_life(life, ai['id']) if ai['dead']: if life['know'][ai['id']]['group']: groups.remove_member(life, life['know'][ai['id']]['group'], ai['id']) life['know'][ai['id']]['group'] = None life['know'][ai['id']]['dead'] = True elif ai['asleep']: life['know'][ai['id']]['asleep'] = True elif not ai['asleep']: life['know'][ai['id']]['asleep'] = False life['know'][ai['id']]['last_seen_time'] = 0 life['know'][ai['id']]['last_seen_at'] = ai['pos'][:] life['know'][ai['id']]['escaped'] = False life['know'][ai['id']]['state'] = ai['state'] life['know'][ai['id']]['state_tier'] = ai['state_tier'] if brain.alife_has_flag(life, ai['id'], 'search_map'): brain.unflag_alife(life, ai['id'], 'search_map') _chunk_id = lfe.get_current_chunk_id(ai) judgement.judge_chunk(life, _chunk_id, seen=True) _life.append(life_id) for item_uid in _chunk['items']: if not item_uid in ITEMS: continue item = ITEMS[item_uid] if not item['uid'] in life['know_items']: brain.remember_item(life, item) if items.is_item_owned(item['uid']): continue # #TODO: This doesn't work because we are specifically checking chunks # if item['owner'] and lfe.item_is_equipped(LIFE[item['owner']], item['uid']): # life['know_items'][item['uid']]['last_seen_at'] = LIFE[item['owner']]['pos'] # life['know_items'][item['uid']]['last_owned_by'] = item['owner'] # life['know_items'][item['uid']]['last_seen_time'] = 0 # # continue if not can_see_position(life, item['pos']): continue if not item['uid'] in life['know_items']: brain.remember_item(life, item) life['seen_items'].append(item['uid']) life['know_items'][ item['uid']]['last_seen_at'] = item['pos'][:] life['know_items'][item['uid']]['last_seen_time'] = 0 life['know_items'][item['uid']]['last_owned_by'] = None life['know_items'][ item['uid']]['score'] = judgement.judge_item( life, item['uid']) life['know_items'][item['uid']]['lost'] = False _items.append(item_uid)
def listen(life): for event in life['heard'][:]: if not event['from']['id'] in life['know']: pass if not brain.knows_alife(life, event['from']): brain.meet_alife(life, event['from']) logging.info( '%s learned about %s via listen.' % (' '.join(life['name']), ' '.join(event['from']['name']))) if event['gist'] == 'looks_hostile': #speech.communicate(life, 'surrender', matches=[{'id': event['from']['id']}]) pass elif event['gist'] == 'camp_raid': print '*' * 10 print 'RAID IN EFFECT!!!!!!!!!!' print '*' * 10 _knows = brain.knows_alife(life, event['from']) _raid = raids.defend_camp(event['camp']['id'], life['id']) if _knows and not judgement.is_target_dangerous( life, _knows['life']['id']): lfe.memory(life, 'heard about a camp raid', camp=event['camp']['id']) _raid_score = judgement.judge_raid(life, event['raiders'], event['camp']['id']) speech.announce(life, 'raid_score', raid_score=_raid_score) elif event['gist'] == 'raid_score': print life['name'], 'Got friendly raid score:', event['raid_score'] elif event['gist'] == 'share_item_info': if event['item'] in ITEMS: if not brain.has_remembered_item(life, event['item']): lfe.memory(life, 'heard about an item', item=event['item'], target=event['from']['id']) brain.remember_item(life, ITEMS[event['item']]) elif event['gist'] == 'camp_founder': lfe.memory(life, 'heard about camp', camp=event['camp'], target=event['founder'], founder=event['founder']) print 'Thanks for the camp founder info!' elif event['gist'] == 'under_attack': _knows_attacker = True if life['id'] == event['attacker']: pass else: print life['name'], 'HEARD CALL FOR HELP FROM', event['from'][ 'name'] if not brain.knows_alife_by_id(life, event['attacker']): brain.meet_alife(life, LIFE[event['attacker']]) _knows_attacker = False _target = brain.knows_alife_by_id(life, event['attacker']) _believes = judgement.believe_which_alife( life, [event['from']['id'], event['attacker']]) #SITUATION 1: We believe it if _believes == event['from']['id']: lfe.memory(life, 'heard about attack', attacker=event['attacker'], target=event['from']['id']) lfe.memory(life, 'target attacked victim', target=event['attacker'], victim=event['from']['id']) if event['last_seen_at']: _target['last_seen_at'] = event['last_seen_at'][:] else: _target['last_seen_at'] = event['from']['pos'][:] judgement.judge_life(life, event['attacker']) else: lfe.memory(life, 'reject under_attack: attacker is trusted', attacker=event['attacker'], target=event['from']['id']) elif event['gist'] == 'bit': #React to attack... this needs to be a function in stats.py if event['target'] == life['id']: pass else: _trust_sender = judgement.can_trust(life, event['from']['id']) if brain.knows_alife_by_id(life, event['target']): _trust_target = judgement.can_trust(life, event['target'], low=5) else: brain.meet_alife(life, LIFE[event['target']]) _trust_target = False if _trust_target and not _trust_sender and 1 == 4: lfe.memory(life, 'trusted target attacked by', victim=event['target'], target=event['from']['id']) elif event['gist'] == 'consume_item': lfe.memory(life, 'consume_item', target=event['from']['id']) elif event['gist'] == 'call': if judgement.can_trust(life, event['from']['id']): speech.start_dialog(life, event['from']['id'], 'call_accepted', remote=True) elif event['gist'] == 'order_attack': lfe.memory(life, 'ordered to attack', target=event['target']) elif event['gist'] == 'threw_an_item': print 'CHECK THIS HERE' * 100 pass elif event['gist'] == '_group_leader_state_change': life['think_rate'] = 0 elif event['gist'] == 'dialog': if not 'player' in life and not event['dialog_id'] in life[ 'dialogs']: life['dialogs'].append(event['dialog_id']) else: logging.warning('Unhandled ALife context: %s' % event['gist']) life['heard'].remove(event)
def listen(life): for event in life['heard'][:]: if not event['from']['id'] in life['know']: pass if not brain.knows_alife(life, event['from']): brain.meet_alife(life, event['from']) logging.info('%s learned about %s via listen.' % (' '.join(life['name']), ' '.join(event['from']['name']))) if event['gist'] == 'looks_hostile': #speech.communicate(life, 'surrender', matches=[{'id': event['from']['id']}]) pass elif event['gist'] == 'camp_raid': print '*' * 10 print 'RAID IN EFFECT!!!!!!!!!!' print '*' * 10 _knows = brain.knows_alife(life, event['from']) _raid = raids.defend_camp(event['camp']['id'], life['id']) if _knows and not judgement.is_target_dangerous(life, _knows['life']['id']): lfe.memory(life, 'heard about a camp raid', camp=event['camp']['id']) _raid_score = judgement.judge_raid(life, event['raiders'], event['camp']['id']) speech.announce(life, 'raid_score', raid_score=_raid_score) elif event['gist'] == 'raid_score': print life['name'],'Got friendly raid score:', event['raid_score'] elif event['gist'] == 'share_item_info': if event['item'] in ITEMS: if not brain.has_remembered_item(life, event['item']): lfe.memory(life, 'heard about an item', item=event['item'], target=event['from']['id']) brain.remember_item(life, ITEMS[event['item']]) elif event['gist'] == 'camp_founder': lfe.memory(life, 'heard about camp', camp=event['camp'], target=event['founder'], founder=event['founder']) print 'Thanks for the camp founder info!' elif event['gist'] == 'under_attack': _knows_attacker = True if life['id'] == event['attacker']: pass else: print life['name'], 'HEARD CALL FOR HELP FROM', event['from']['name'] if not brain.knows_alife_by_id(life, event['attacker']): brain.meet_alife(life, LIFE[event['attacker']]) _knows_attacker = False _target = brain.knows_alife_by_id(life, event['attacker']) _believes = judgement.believe_which_alife(life, [event['from']['id'], event['attacker']]) #SITUATION 1: We believe it if _believes == event['from']['id']: lfe.memory(life, 'heard about attack', attacker=event['attacker'], target=event['from']['id']) lfe.memory(life, 'target attacked victim', target=event['attacker'], victim=event['from']['id']) if event['last_seen_at']: _target['last_seen_at'] = event['last_seen_at'][:] else: _target['last_seen_at'] = event['from']['pos'][:] judgement.judge_life(life, event['attacker']) else: lfe.memory(life, 'reject under_attack: attacker is trusted', attacker=event['attacker'], target=event['from']['id']) elif event['gist'] == 'bit': #React to attack... this needs to be a function in stats.py if event['target'] == life['id']: pass else: _trust_sender = judgement.can_trust(life, event['from']['id']) if brain.knows_alife_by_id(life, event['target']): _trust_target = judgement.can_trust(life, event['target'], low=5) else: brain.meet_alife(life, LIFE[event['target']]) _trust_target = False if _trust_target and not _trust_sender and 1==4: lfe.memory(life, 'trusted target attacked by', victim=event['target'], target=event['from']['id']) elif event['gist'] == 'consume_item': lfe.memory(life, 'consume_item', target=event['from']['id']) elif event['gist'] == 'call': if judgement.can_trust(life, event['from']['id']): speech.start_dialog(life, event['from']['id'], 'call_accepted', remote=True) elif event['gist'] == 'order_attack': lfe.memory(life, 'ordered to attack', target=event['target']) elif event['gist'] == 'threw_an_item': print 'CHECK THIS HERE' * 100 pass elif event['gist'] == '_group_leader_state_change': life['think_rate'] = 0 elif event['gist'] == 'dialog': if not 'player' in life and not event['dialog_id'] in life['dialogs']: life['dialogs'].append(event['dialog_id']) else: logging.warning('Unhandled ALife context: %s' % event['gist']) life['heard'].remove(event)
def look(life): if not 'CAN_SEE' in life['life_flags']: return False for target_id in life['know']: if life['know'][target_id]['last_seen_time']: life['know'][target_id]['last_seen_time'] += 1 life['know'][target_id]['time_visible'] = 0 else: life['know'][target_id]['time_visible'] += 1 if 'player' in life: if life['path'] or not brain.get_flag(life, 'visible_chunks'): if SETTINGS['smp']: _visible_chunks = post_scan_surroundings(life) else: _visible_chunks = scan_surroundings(life, judge=False, get_chunks=True, ignore_chunks=0) _chunks = [maps.get_chunk(c) for c in _visible_chunks] brain.flag(life, 'visible_chunks', value=_visible_chunks) elif 'player' in life: _visible_chunks = brain.get_flag(life, 'visible_chunks') _chunks = [maps.get_chunk(c) for c in _visible_chunks] else: #This is for optimizing. Be careful if you mess with this... _nearby_alife = {} for alife in LIFE.values(): if alife['id'] == life['id']: continue if bad_numbers.distance(life['pos'], alife['pos'])<=get_vision(life) and can_see_position(life, alife['pos']): _nearby_alife[alife['id']] = {'pos': alife['pos'][:], 'stance': alife['stance']} _last_nearby_alife = brain.get_flag(life, '_nearby_alife') if not _last_nearby_alife == _nearby_alife: brain.flag(life, '_nearby_alife', value=_nearby_alife) else: for target_id in life['seen']: if life['know'][target_id]['last_seen_time']: life['know'][target_id]['last_seen_time'] = 0 return False _chunks = [maps.get_chunk(c) for c in brain.get_flag(life, 'visible_chunks')] life['seen'] = [] life['seen_items'] = [] for item_uid in life['know_items']: life['know_items'][item_uid]['last_seen_time'] += 1 for target_id in life['know']: life['know'][target_id]['last_seen_time'] += 1 if life['know'][target_id]['last_seen_time']>=10 and not life['know'][target_id]['escaped']: life['know'][target_id]['escaped'] = 1 if not 'player' in life: quick_look(life) return False for chunk in _chunks: judgement.judge_chunk_visually(life, '%s,%s' % (chunk['pos'][0], chunk['pos'][1])) judgement.judge_chunk_life(life, '%s,%s' % (chunk['pos'][0], chunk['pos'][1])) for ai in [LIFE[i] for i in chunk['life']]: if ai['id'] == life['id']: continue if not is_in_fov(life, ai['pos']): if ai['id'] in life['know']: life['know'][ai['id']]['time_visible'] = 0 continue if not ai['id'] in life['know']: brain.meet_alife(life, ai) _visibility = get_visiblity_of_position(life, ai['pos']) _stealth_coverage = get_stealth_coverage(ai) if _visibility < 1-_stealth_coverage: continue life['seen'].append(ai['id']) if life['think_rate'] == life['think_rate_max']: lfe.create_and_update_self_snapshot(LIFE[ai['id']]) judgement.judge_life(life, ai['id']) if ai['dead']: if 'player' in life and not life['know'][ai['id']]['dead'] and life['know'][ai['id']]['last_seen_time']>25: logic.show_event('You discover the body of %s.' % ' '.join(ai['name']), life=ai) if life['know'][ai['id']]['group']: groups.remove_member(life, life['know'][ai['id']]['group'], ai['id']) life['know'][ai['id']]['group'] = None core.record_loss(1) life['know'][ai['id']]['dead'] = True elif ai['asleep']: life['know'][ai['id']]['asleep'] = True elif not ai['asleep']: life['know'][ai['id']]['asleep'] = False life['know'][ai['id']]['last_seen_time'] = 0 life['know'][ai['id']]['last_seen_at'] = ai['pos'][:] life['know'][ai['id']]['escaped'] = False life['know'][ai['id']]['state'] = ai['state'] life['know'][ai['id']]['state_tier'] = ai['state_tier'] if brain.alife_has_flag(life, ai['id'], 'search_map'): brain.unflag_alife(life, ai['id'], 'search_map') _chunk_id = lfe.get_current_chunk_id(ai) judgement.judge_chunk(life, _chunk_id, seen=True) for item in [ITEMS[i] for i in chunk['items'] if i in ITEMS]: if not is_in_fov(life, item['pos']): continue if not item['uid'] in life['know_items']: brain.remember_item(life, item) if items.is_item_owned(item['uid']): #TODO: This doesn't work because we are specifically checking chunks if item['owner'] and lfe.item_is_equipped(LIFE[item['owner']], item['uid']): life['know_items'][item['uid']]['last_seen_at'] = LIFE[item['owner']]['pos'] life['know_items'][item['uid']]['last_owned_by'] = item['owner'] life['know_items'][item['uid']]['last_seen_time'] = 0 continue life['seen_items'].append(item['uid']) life['know_items'][item['uid']]['last_seen_at'] = item['pos'][:] life['know_items'][item['uid']]['last_seen_time'] = 0 life['know_items'][item['uid']]['last_owned_by'] = None life['know_items'][item['uid']]['score'] = judgement.judge_item(life, item['uid']) life['know_items'][item['uid']]['lost'] = False
def quick_look(life): _life = [] _items = [] _current_chunk = lfe.get_current_chunk_id(life) _current_chunk_pos = chunks.get_chunk(_current_chunk)['pos'] _x_chunk_min = bad_numbers.clip(_current_chunk_pos[0]-((get_vision(life)/WORLD_INFO['chunk_size'])*WORLD_INFO['chunk_size']), 0, MAP_SIZE[0]-WORLD_INFO['chunk_size']) _y_chunk_min = bad_numbers.clip(_current_chunk_pos[1]-((get_vision(life)/WORLD_INFO['chunk_size'])*WORLD_INFO['chunk_size']), 0, MAP_SIZE[1]-WORLD_INFO['chunk_size']) _x_chunk_max = bad_numbers.clip(_current_chunk_pos[0]+((get_vision(life)/WORLD_INFO['chunk_size'])*WORLD_INFO['chunk_size']), 0, MAP_SIZE[0]-WORLD_INFO['chunk_size']) _y_chunk_max = bad_numbers.clip(_current_chunk_pos[1]+((get_vision(life)/WORLD_INFO['chunk_size'])*WORLD_INFO['chunk_size']), 0, MAP_SIZE[1]-WORLD_INFO['chunk_size']) _has_ready_weapon = combat.has_ready_weapon(life) for y in range(_y_chunk_min, _y_chunk_max, WORLD_INFO['chunk_size']): for x in range(_x_chunk_min, _x_chunk_max, WORLD_INFO['chunk_size']): _chunk_key = '%s,%s' % (x, y) _chunk = chunks.get_chunk(_chunk_key) for life_id in _chunk['life']: ai = LIFE[life_id] if ai['dead']: continue if life_id == life['id']: continue if not can_see_position(life, LIFE[life_id]['pos']): continue _visibility = get_visiblity_of_position(life, ai['pos']) _stealth_coverage = get_stealth_coverage(ai) if _visibility < 1-_stealth_coverage: continue if not ai['id'] in life['know']: brain.meet_alife(life, ai) life['seen'].append(ai['id']) if life['think_rate'] == life['think_rate_max']: lfe.create_and_update_self_snapshot(LIFE[ai['id']]) judgement.judge_life(life, ai['id']) if ai['dead']: if life['know'][ai['id']]['group']: groups.remove_member(life, life['know'][ai['id']]['group'], ai['id']) life['know'][ai['id']]['group'] = None life['know'][ai['id']]['dead'] = True elif ai['asleep']: life['know'][ai['id']]['asleep'] = True elif not ai['asleep']: life['know'][ai['id']]['asleep'] = False life['know'][ai['id']]['last_seen_time'] = 0 life['know'][ai['id']]['last_seen_at'] = ai['pos'][:] life['know'][ai['id']]['escaped'] = False life['know'][ai['id']]['state'] = ai['state'] life['know'][ai['id']]['state_tier'] = ai['state_tier'] if brain.alife_has_flag(life, ai['id'], 'search_map'): brain.unflag_alife(life, ai['id'], 'search_map') _chunk_id = lfe.get_current_chunk_id(ai) judgement.judge_chunk(life, _chunk_id, seen=True) _life.append(life_id) for item_uid in _chunk['items']: if not item_uid in ITEMS: continue item = ITEMS[item_uid] if not item['uid'] in life['know_items']: brain.remember_item(life, item) if items.is_item_owned(item['uid']): continue # #TODO: This doesn't work because we are specifically checking chunks # if item['owner'] and lfe.item_is_equipped(LIFE[item['owner']], item['uid']): # life['know_items'][item['uid']]['last_seen_at'] = LIFE[item['owner']]['pos'] # life['know_items'][item['uid']]['last_owned_by'] = item['owner'] # life['know_items'][item['uid']]['last_seen_time'] = 0 # # continue if not can_see_position(life, item['pos']): continue if not item['uid'] in life['know_items']: brain.remember_item(life, item) life['seen_items'].append(item['uid']) life['know_items'][item['uid']]['last_seen_at'] = item['pos'][:] life['know_items'][item['uid']]['last_seen_time'] = 0 life['know_items'][item['uid']]['last_owned_by'] = None life['know_items'][item['uid']]['score'] = judgement.judge_item(life, item['uid']) life['know_items'][item['uid']]['lost'] = False _items.append(item_uid)