Exemplo n.º 1
0
def tick(life, alife_seen, alife_not_seen, targets_seen, targets_not_seen, source_map):
	if lfe.ticker(life, 'call_for_help', 160, fire=True):
		_target = judgement.get_nearest_threat(life)
		_knows = brain.knows_alife_by_id(life, _target)
		if _target and judgement.get_nearest_trusted_target(life):
			if _knows:
				speech.announce(life, 'attacked_by_hostile', public=True, target_id=_target, last_seen_at=_knows['last_seen_at'])
			else:
				speech.announce(life, 'attacked_by_hostile', public=True, target_id=_target)
Exemplo n.º 2
0
def tick(life, alife_seen, alife_not_seen, targets_seen, targets_not_seen, source_map):
	if lfe.ticker(life, 'call_for_help', 160, fire=True):
		_target = judgement.get_nearest_threat(life)
		_knows = brain.knows_alife_by_id(life, _target)
		if _target and judgement.get_nearest_trusted_target(life):
			if _knows:
				speech.announce(life, 'attacked_by_hostile', public=True, target_id=_target, last_seen_at=_knows['last_seen_at'])
			else:
				speech.announce(life, 'attacked_by_hostile', public=True, target_id=_target)
Exemplo n.º 3
0
def tick(life, alife_seen, alife_not_seen, targets_seen, targets_not_seen, source_map):
	_threat = judgement.get_nearest_threat(life)
	
	if not 'hiding' in life['state_flags']:
		movement.hide(life, _threat)
		life['state_flags']['hiding'] = True
		return True
	
	_weapon = combat.get_best_weapon(life)
	
	if _weapon:
		if not combat.weapon_equipped_and_ready(life):
			combat._equip_weapon(life, _weapon['weapon']['uid'], _weapon['feed']['uid'])
Exemplo n.º 4
0
def tick(life, alife_seen, alife_not_seen, targets_seen, targets_not_seen,
         source_map):
    _threat = judgement.get_nearest_threat(life)

    if not 'hiding' in life['state_flags']:
        movement.hide(life, _threat)
        life['state_flags']['hiding'] = True
        return True

    _weapon = combat.get_best_weapon(life)

    if _weapon:
        if not combat.weapon_equipped_and_ready(life):
            combat._equip_weapon(life, _weapon['weapon']['uid'],
                                 _weapon['feed']['uid'])
Exemplo n.º 5
0
def is_threat_too_close(life):
	_nearest_threat = judgement.get_nearest_threat(life)
	
	_knows = brain.knows_alife_by_id(life, _nearest_threat)
	
	if not _nearest_threat:
		return False
	
	if _knows['last_seen_time'] >= 100:
		return False
	
	_danger_close_range = int(lfe.execute_raw(life, 'safety', 'danger_close_range'))
	if numbers.distance(life['pos'], _knows['last_seen_at'])<_danger_close_range:
		return True
	
	return False
Exemplo n.º 6
0
def is_threat_too_close(life):
    _nearest_threat = judgement.get_nearest_threat(life)

    if not _nearest_threat:
        return False

    _knows = brain.knows_alife_by_id(life, _nearest_threat)

    if not _nearest_threat:
        return False

    if _knows['last_seen_time'] >= 100:
        return False

    _danger_close_range = int(
        lfe.execute_raw(life, 'safety', 'danger_close_range'))
    if numbers.distance(life['pos'],
                        _knows['last_seen_at']) < _danger_close_range:
        return True

    return False