Beispiel #1
0
def create_effects(item, pos, real_z_pos, z_min):
    for _z in range(0, 2):
        _z_level = bad_numbers.clip(
            z_min - _z, 0,
            maputils.get_map_size(WORLD_INFO['map'])[2] - 1)

        if WORLD_INFO['map'][pos[0]][pos[1]][_z_level]:
            if int(round(real_z_pos)) - _z_level <= 2:
                if 'BLOODY' in item['flags']:
                    if random.randint(0, 50) <= 35:
                        effects.create_splatter('blood', [
                            pos[0] + random.randint(-2, 2),
                            pos[1] + random.randint(-2, 2), _z_level
                        ])

                if 'SMOKING' in item['flags']:
                    if random.randint(0, 50) <= 25:
                        effects.create_smoke_streamer(
                            [
                                pos[0] +
                                random.randint(-item['size'], item['size']),
                                pos[1] +
                                random.randint(-item['size'], item['size']),
                                _z_level
                            ], item['size'] / 2,
                            random.randint(item['size'] * 2,
                                           (item['size'] * 2) + 5))
                if 'BURNING' in item['flags']:
                    if random.randint(0, 50) <= 25:
                        effects.create_smoke_cloud([
                            pos[0] +
                            random.randint(-item['size'], item['size']),
                            pos[1] +
                            random.randint(-item['size'], item['size']),
                            _z_level
                        ],
                                                   random.randint(
                                                       item['size'],
                                                       (item['size']) + 3),
                                                   color=tcod.light_crimson)
                if 'max_speed' in item and is_moving(item):
                    effects.create_vapor(
                        item['pos'], 5,
                        bad_numbers.clip(item['speed'] / 20, 0, 1))
Beispiel #2
0
def collision_with_solid(item, pos):
	if pos[0]<0 or pos[0]>=MAP_SIZE[0]-1 or pos[1]<0 or pos[1]>=MAP_SIZE[1]-1 or pos[2]<0 or pos[2]>=MAP_SIZE[2]-1:
		return True
	
	if maps.is_solid(pos) and item['velocity'][2]<0:
		#TODO: Bounce
		item['velocity'] = [0, 0, 0]
		item['pos'] = pos
		process_event(item, 'stop')
			
		return True
	
	if item['velocity'][2]>=0:
		_z = 1
	else:
		_z = -1
	
	if not pos[0]-1 < 0 and item['velocity'][0]<0 and WORLD_INFO['map'][pos[0]-1][pos[1]][pos[2]+_z]:
		item['velocity'][0] = -item['velocity'][0]*.8
		
		if 'max_speed' in item:
			effects.create_smoke_cloud(pos, 4)
	elif not pos[0]+1 >= MAP_SIZE[0]-1 and item['velocity'][0]>0 and WORLD_INFO['map'][pos[0]+1][pos[1]][pos[2]+_z]:
		item['velocity'][0] = -item['velocity'][0]*.8
		
		if 'max_speed' in item:
			effects.create_smoke_cloud(pos, 4)
	
	if not pos[1]-1 < 0 and item['velocity'][1]<0 and WORLD_INFO['map'][pos[0]][pos[1]-1][pos[2]+_z]:
		item['velocity'][1] = -item['velocity'][1]*.8
		
		if 'max_speed' in item:
			effects.create_smoke_cloud(pos, 4)
	elif not pos[1]+1 >= MAP_SIZE[1]-1 and item['velocity'][1]>0 and WORLD_INFO['map'][pos[0]][pos[1]+1][pos[2]+_z]:
		item['velocity'][1] = -item['velocity'][1]*.8
		
		if 'max_speed' in item:
			effects.create_smoke_cloud(pos, 4)
	
	if 'max_speed' in item:
		effects.create_vapor(pos, 5, numbers.clip(item['speed']/30, 0, 1))
	
	return False
Beispiel #3
0
def create_effects(item, pos, real_z_pos, z_min):
	for _z in range(0, 2):
		_z_level = bad_numbers.clip(z_min-_z, 0, maputils.get_map_size(WORLD_INFO['map'])[2]-1)
		
		if WORLD_INFO['map'][pos[0]][pos[1]][_z_level]:
			if int(round(real_z_pos))-_z_level<=2:
				if 'BLOODY' in item['flags']:
					if random.randint(0,50)<=35:
						effects.create_splatter('blood', [pos[0]+random.randint(-2, 2), pos[1]+random.randint(-2, 2), _z_level])
				
				if 'SMOKING' in item['flags']:
					if random.randint(0, 50)<=25:
						effects.create_smoke_streamer([pos[0]+random.randint(-item['size'], item['size']), pos[1]+random.randint(-item['size'], item['size']), _z_level],
						                              item['size']/2,
						                              random.randint(item['size']*2, (item['size']*2)+5))
				if 'BURNING' in item['flags']:
					if random.randint(0, 50)<=25:
						effects.create_smoke_cloud([pos[0]+random.randint(-item['size'], item['size']), pos[1]+random.randint(-item['size'], item['size']), _z_level],
						                              random.randint(item['size'], (item['size'])+3),
						                              color=tcod.light_crimson)
				if 'max_speed' in item and is_moving(item):
					effects.create_vapor(item['pos'], 5, bad_numbers.clip(item['speed']/20, 0, 1))