Example #1
0
def find_shelter(life, group_id):
	_group = get_group(life, group_id)
	_shelter = judgement.get_best_shelter(life)
	
	if _shelter:
		set_shelter(life, group_id, chunks.get_chunk(_shelter)['reference'])
		announce(life, group_id, 'found_shelter')
	else:
		if get_stage(life, group_id) in [STAGE_FORMING]:
			set_stage(life, group_id, STAGE_SETTLING)
Example #2
0
def find_shelter(life, group_id):
    _group = get_group(life, group_id)
    _shelter = judgement.get_best_shelter(life)

    if _shelter:
        set_shelter(life, group_id, chunks.get_chunk(_shelter)['reference'])
        announce(life, group_id, 'found_shelter')
    else:
        if get_stage(life, group_id) in [STAGE_FORMING]:
            set_stage(life, group_id, STAGE_SETTLING)
Example #3
0
def find_shelter(life, group_id):
	_group = get_group(life, group_id)
	_shelter = judgement.get_best_shelter(life)
	
	if _shelter:
		set_shelter(life, group_id, chunks.get_chunk(_shelter)['reference'])
		announce(life, group_id, 'found_shelter')
	else:
		if not get_stage(life, group_id) == STAGE_SETTLING:
			set_stage(life, group_id, STAGE_SETTLING)
			announce(life, group_id, 'update_group_stage')
Example #4
0
def tick(life):
	if not 'shelter' in life['state_flags']:
		life['state_flags']['shelter'] = judgement.get_best_shelter(life)
	
	if not life['state_flags']['shelter'] in life['known_chunks']:
		judgement.judge_chunk(life, life['state_flags']['shelter'])
	
	if not chunks.get_flag(life, life['state_flags']['shelter'], 'shelter_cover'):
		return False
	
	if not list(life['pos'][:2]) in chunks.get_flag(life, life['state_flags']['shelter'], 'shelter_cover'):
		if not lfe.path_dest(life) or (not chunks.position_is_in_chunk(lfe.path_dest(life), life['state_flags']['shelter'])):
			_cover = chunks.get_flag(life, life['state_flags']['shelter'], 'shelter_cover')
			lfe.walk_to(life, random.choice(_cover))
Example #5
0
def tick(life):
    if not 'shelter' in life['state_flags']:
        life['state_flags']['shelter'] = judgement.get_best_shelter(life)

    if not life['state_flags']['shelter'] in life['known_chunks']:
        judgement.judge_chunk(life, life['state_flags']['shelter'])

    if not chunks.get_flag(life, life['state_flags']['shelter'],
                           'shelter_cover'):
        return False

    if not list(life['pos'][:2]) in chunks.get_flag(
            life, life['state_flags']['shelter'], 'shelter_cover'):
        if not lfe.path_dest(life) or (not chunks.position_is_in_chunk(
                lfe.path_dest(life), life['state_flags']['shelter'])):
            _cover = chunks.get_flag(life, life['state_flags']['shelter'],
                                     'shelter_cover')
            lfe.walk_to(life, random.choice(_cover))