mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
buildup time adjustments
This commit is contained in:
parent
3343ddf4cc
commit
09f7087ac6
BIN
assets/voxygen/voxel/object/portal.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/object/portal.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/object/portal_active.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/object/portal_active.vox
(Stored with Git LFS)
Binary file not shown.
@ -120,7 +120,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
end_time: Time(time.0 + teleporter.buildup_time.0),
|
end_time: Time(time.0 + teleporter.buildup_time.0),
|
||||||
}));
|
}));
|
||||||
} else if let Some(remaining) = teleporting.and_then(|teleporting| {
|
} else if let Some(remaining) = teleporting.and_then(|teleporting| {
|
||||||
((time.0 - teleporting.teleport_start.0) >= teleporter.buildup_time.0 / 2.
|
((time.0 - teleporting.teleport_start.0) >= teleporter.buildup_time.0 / 3.
|
||||||
&& !matches!(*character_state, CharacterState::Blink(_)))
|
&& !matches!(*character_state, CharacterState::Blink(_)))
|
||||||
.then_some(teleporter.buildup_time.0 - (time.0 - teleporting.teleport_start.0))
|
.then_some(teleporter.buildup_time.0 - (time.0 - teleporting.teleport_start.0))
|
||||||
}) {
|
}) {
|
||||||
@ -181,6 +181,11 @@ impl<'a> System<'a> for Sys {
|
|||||||
|
|
||||||
for entity in cancel_teleport {
|
for entity in cancel_teleport {
|
||||||
teleporting.remove(entity);
|
teleporting.remove(entity);
|
||||||
|
character_states.get_mut(entity).map(|mut state| {
|
||||||
|
if let CharacterState::Blink(data) = &mut *state {
|
||||||
|
data.stage_section = StageSection::Recover;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (entity, teleporter) in attempt_teleport {
|
for (entity, teleporter) in attempt_teleport {
|
||||||
|
@ -667,16 +667,16 @@ impl Floor {
|
|||||||
// Move both a bit to the side to prevent teleportation loop, ideally we'd have the portals at another location
|
// Move both a bit to the side to prevent teleportation loop, ideally we'd have the portals at another location
|
||||||
supplement.add_entity(EntityInfo::at(top_pos).into_special(
|
supplement.add_entity(EntityInfo::at(top_pos).into_special(
|
||||||
SpecialEntity::Teleporter(Teleporter {
|
SpecialEntity::Teleporter(Teleporter {
|
||||||
target: bottom_pos+ Vec3::unit_x() * 5.,
|
target: bottom_pos + Vec3::unit_x() * 5.,
|
||||||
requires_no_aggro: false,
|
requires_no_aggro: false,
|
||||||
buildup_time: Secs(1.),
|
buildup_time: Secs(1.),
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
supplement.add_entity(EntityInfo::at(bottom_pos).into_special(
|
supplement.add_entity(EntityInfo::at(bottom_pos).into_special(
|
||||||
SpecialEntity::Teleporter(Teleporter {
|
SpecialEntity::Teleporter(Teleporter {
|
||||||
target: top_pos+ Vec3::unit_x() * 5.,
|
target: top_pos + Vec3::unit_x() * 5.,
|
||||||
requires_no_aggro: true,
|
requires_no_aggro: true,
|
||||||
buildup_time: Secs(3.),
|
buildup_time: Secs(5.),
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -1188,173 +1188,163 @@ impl Floor {
|
|||||||
|
|
||||||
let mut chests = None;
|
let mut chests = None;
|
||||||
|
|
||||||
'room: {
|
if let Some(room) = room.map(|i| self.rooms.get(*i)) {
|
||||||
if let Some(room) = room.map(|i| self.rooms.get(*i)) {
|
height = height.min(room.height);
|
||||||
height = height.min(room.height);
|
if let Tile::UpStair(_, kind) = tile && !self.final_level {
|
||||||
if let Tile::UpStair(_, kind) = tile {
|
// Construct the staircase that connects this tile to the matching DownStair
|
||||||
if self.final_level {
|
// tile on the floor above (or to the surface if this is the top floor), and
|
||||||
break 'room;
|
// a hollow bounding box to place air in
|
||||||
|
let center = tile_center.with_z(floor_z);
|
||||||
|
let radius = TILE_SIZE as f32 / 2.0;
|
||||||
|
let aabb = aabr_with_z(tile_aabr, floor_z..floor_z + self.total_depth());
|
||||||
|
let outer_aabb = aabr_with_z(
|
||||||
|
outer_tile_aabr(2),
|
||||||
|
floor_z + tunnel_height as i32..floor_z + self.total_depth() - 1,
|
||||||
|
);
|
||||||
|
let bb = painter.prim(match kind {
|
||||||
|
StairsKind::Spiral => Primitive::Cylinder(aabb),
|
||||||
|
StairsKind::WallSpiral => Primitive::Aabb(aabb),
|
||||||
|
});
|
||||||
|
let outer_bb = painter.prim(match kind {
|
||||||
|
StairsKind::WallSpiral => Primitive::Aabb(outer_aabb),
|
||||||
|
StairsKind::Spiral => Primitive::Cylinder(outer_aabb),
|
||||||
|
});
|
||||||
|
let stair = painter.prim(Primitive::sampling(bb, match kind {
|
||||||
|
StairsKind::Spiral => spiral_staircase(center, radius, 0.5, 9.0),
|
||||||
|
StairsKind::WallSpiral => wall_staircase(center, radius, 27.0),
|
||||||
|
}));
|
||||||
|
// Construct the lights that go inside the staircase, starting above the
|
||||||
|
// ceiling to avoid placing them floating in mid-air
|
||||||
|
let mut lights = painter.prim(Primitive::Empty);
|
||||||
|
for i in height..self.total_depth() {
|
||||||
|
if i % 9 == 0 {
|
||||||
|
let mut light = painter.prim(Primitive::Aabb(Aabb {
|
||||||
|
min: aabb.min.with_z(floor_z + i),
|
||||||
|
max: aabb.max.with_z(floor_z + i + 1),
|
||||||
|
}));
|
||||||
|
let inner = painter.prim(Primitive::Aabb(Aabb {
|
||||||
|
min: (aabb.min + Vec3::new(1, 1, 0)).with_z(floor_z + i),
|
||||||
|
max: (aabb.max - Vec3::new(1, 1, 0)).with_z(floor_z + i + 1),
|
||||||
|
}));
|
||||||
|
|
||||||
|
light = painter.prim(Primitive::without(light, inner));
|
||||||
|
lights = painter.prim(Primitive::union(light, lights));
|
||||||
}
|
}
|
||||||
// Construct the staircase that connects this tile to the matching DownStair
|
}
|
||||||
// tile on the floor above (or to the surface if this is the top floor), and
|
lights = painter.prim(Primitive::intersect(lights, lighting_mask));
|
||||||
// a hollow bounding box to place air in
|
stairs_bb.push(bb);
|
||||||
let center = tile_center.with_z(floor_z);
|
stair_walls.push(outer_bb);
|
||||||
let radius = TILE_SIZE as f32 / 2.0;
|
stairs.push((stair, lights));
|
||||||
let aabb = aabr_with_z(tile_aabr, floor_z..floor_z + self.total_depth());
|
}
|
||||||
let outer_aabb = aabr_with_z(
|
|
||||||
outer_tile_aabr(2),
|
if matches!(tile, Tile::Room(_) | Tile::DownStair(_)) {
|
||||||
floor_z + tunnel_height as i32..floor_z + self.total_depth() - 1,
|
let seed = room.seed;
|
||||||
);
|
let loot_density = room.loot_density;
|
||||||
let bb = painter.prim(match kind {
|
let difficulty = room.difficulty;
|
||||||
StairsKind::Spiral => Primitive::Cylinder(aabb),
|
// Place chests with a random distribution based on the
|
||||||
StairsKind::WallSpiral => Primitive::Aabb(aabb),
|
// room's loot density in valid sprite locations,
|
||||||
});
|
// filled based on the room's difficulty
|
||||||
let outer_bb = painter.prim(match kind {
|
let chest_sprite = painter.prim(Primitive::sampling(
|
||||||
StairsKind::WallSpiral => Primitive::Aabb(outer_aabb),
|
sprite_layer,
|
||||||
StairsKind::Spiral => Primitive::Cylinder(outer_aabb),
|
Box::new(move |pos| RandomField::new(seed).chance(pos, loot_density * 0.5)),
|
||||||
});
|
));
|
||||||
let stair = painter.prim(Primitive::sampling(bb, match kind {
|
let chest_sprite_fill = Fill::Block(Block::air(match difficulty {
|
||||||
StairsKind::Spiral => spiral_staircase(center, radius, 0.5, 9.0),
|
2 => SpriteKind::DungeonChest2,
|
||||||
StairsKind::WallSpiral => wall_staircase(center, radius, 27.0),
|
3 => SpriteKind::DungeonChest3,
|
||||||
|
4 => SpriteKind::DungeonChest4,
|
||||||
|
5 => SpriteKind::DungeonChest5,
|
||||||
|
_ => SpriteKind::Chest,
|
||||||
|
}));
|
||||||
|
chests = Some((chest_sprite, chest_sprite_fill));
|
||||||
|
|
||||||
|
// If a room has pits, place them
|
||||||
|
if room.pits.is_some() {
|
||||||
|
// Make an air pit
|
||||||
|
let tile_pit = painter.prim(Primitive::Aabb(aabr_with_z(
|
||||||
|
tile_aabr,
|
||||||
|
floor_z - 7..floor_z,
|
||||||
|
)));
|
||||||
|
let tile_pit = painter.prim(Primitive::without(tile_pit, wall_contours));
|
||||||
|
painter.fill(tile_pit, Fill::Block(vacant));
|
||||||
|
|
||||||
|
// Fill with lava
|
||||||
|
let tile_lava = painter.prim(Primitive::Aabb(aabr_with_z(
|
||||||
|
tile_aabr,
|
||||||
|
floor_z - 7..floor_z - 5,
|
||||||
|
)));
|
||||||
|
let tile_lava = painter.prim(Primitive::without(tile_lava, wall_contours));
|
||||||
|
//pits.push(tile_pit);
|
||||||
|
//pits.push(tile_lava);
|
||||||
|
painter.fill(tile_lava, Fill::Block(lava));
|
||||||
|
}
|
||||||
|
if room
|
||||||
|
.pits
|
||||||
|
.map(|pit_space| {
|
||||||
|
tile_pos.map(|e| e.rem_euclid(pit_space) == 0).reduce_and()
|
||||||
|
})
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
let platform = painter.prim(Primitive::Aabb(Aabb {
|
||||||
|
min: (tile_center - Vec2::broadcast(pillar_thickness - 1))
|
||||||
|
.with_z(floor_z - 7),
|
||||||
|
max: (tile_center + Vec2::broadcast(pillar_thickness)).with_z(floor_z),
|
||||||
}));
|
}));
|
||||||
// Construct the lights that go inside the staircase, starting above the
|
painter.fill(platform, Fill::Block(stone));
|
||||||
// ceiling to avoid placing them floating in mid-air
|
|
||||||
let mut lights = painter.prim(Primitive::Empty);
|
|
||||||
for i in height..self.total_depth() {
|
|
||||||
if i % 9 == 0 {
|
|
||||||
let mut light = painter.prim(Primitive::Aabb(Aabb {
|
|
||||||
min: aabb.min.with_z(floor_z + i),
|
|
||||||
max: aabb.max.with_z(floor_z + i + 1),
|
|
||||||
}));
|
|
||||||
let inner = painter.prim(Primitive::Aabb(Aabb {
|
|
||||||
min: (aabb.min + Vec3::new(1, 1, 0)).with_z(floor_z + i),
|
|
||||||
max: (aabb.max - Vec3::new(1, 1, 0)).with_z(floor_z + i + 1),
|
|
||||||
}));
|
|
||||||
|
|
||||||
light = painter.prim(Primitive::without(light, inner));
|
|
||||||
lights = painter.prim(Primitive::union(light, lights));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lights = painter.prim(Primitive::intersect(lights, lighting_mask));
|
|
||||||
stairs_bb.push(bb);
|
|
||||||
stair_walls.push(outer_bb);
|
|
||||||
stairs.push((stair, lights));
|
|
||||||
}
|
}
|
||||||
if matches!(tile, Tile::Room(_) | Tile::DownStair(_)) {
|
|
||||||
let seed = room.seed;
|
// If a room has pillars, the current tile aligns with the pillar spacing,
|
||||||
let loot_density = room.loot_density;
|
// and we're not too close to a wall (i.e. the
|
||||||
let difficulty = room.difficulty;
|
// adjacent tiles are rooms and not hallways/solid),
|
||||||
// Place chests with a random distribution based on the
|
// place a pillar
|
||||||
// room's loot density in valid sprite locations,
|
if room
|
||||||
// filled based on the room's difficulty
|
.pillars
|
||||||
let chest_sprite = painter.prim(Primitive::sampling(
|
.map(|pillar_space| {
|
||||||
sprite_layer,
|
tile_pos
|
||||||
Box::new(move |pos| {
|
.map(|e| e.rem_euclid(pillar_space) == 0)
|
||||||
RandomField::new(seed).chance(pos, loot_density * 0.5)
|
.reduce_and()
|
||||||
}),
|
})
|
||||||
));
|
.unwrap_or(false)
|
||||||
let chest_sprite_fill = Fill::Block(Block::air(match difficulty {
|
&& DIRS
|
||||||
2 => SpriteKind::DungeonChest2,
|
.iter()
|
||||||
3 => SpriteKind::DungeonChest3,
|
.map(|dir| tile_pos + *dir)
|
||||||
4 => SpriteKind::DungeonChest4,
|
.all(|other_tile_pos| {
|
||||||
5 => SpriteKind::DungeonChest5,
|
matches!(self.tiles.get(other_tile_pos), Some(Tile::Room(_)))
|
||||||
_ => SpriteKind::Chest,
|
})
|
||||||
|
{
|
||||||
|
let mut pillar = painter.prim(Primitive::Cylinder(Aabb {
|
||||||
|
min: (tile_center - Vec2::broadcast(pillar_thickness - 1))
|
||||||
|
.with_z(floor_z),
|
||||||
|
max: (tile_center + Vec2::broadcast(pillar_thickness))
|
||||||
|
.with_z(floor_z + height),
|
||||||
|
}));
|
||||||
|
let base = painter.prim(Primitive::Cylinder(Aabb {
|
||||||
|
min: (tile_center - Vec2::broadcast(1 + pillar_thickness - 1))
|
||||||
|
.with_z(floor_z),
|
||||||
|
max: (tile_center + Vec2::broadcast(1 + pillar_thickness))
|
||||||
|
.with_z(floor_z + 1),
|
||||||
}));
|
}));
|
||||||
chests = Some((chest_sprite, chest_sprite_fill));
|
|
||||||
|
|
||||||
// If a room has pits, place them
|
let scale = (pillar_thickness + 2) as f32 / pillar_thickness as f32;
|
||||||
if room.pits.is_some() {
|
let mut lights = painter
|
||||||
// Make an air pit
|
.prim(Primitive::scale(pillar, Vec2::broadcast(scale).with_z(1.0)));
|
||||||
let tile_pit = painter.prim(Primitive::Aabb(aabr_with_z(
|
lights = painter.prim(Primitive::intersect(lighting_plane, lights));
|
||||||
tile_aabr,
|
// Only add the base (and shift the lights up)
|
||||||
floor_z - 7..floor_z,
|
// for boss-rooms pillars
|
||||||
)));
|
if room.kind == RoomKind::Boss {
|
||||||
let tile_pit =
|
lights = painter.prim(Primitive::translate(lights, 3 * Vec3::unit_z()));
|
||||||
painter.prim(Primitive::without(tile_pit, wall_contours));
|
pillar = painter.prim(Primitive::union(pillar, base));
|
||||||
painter.fill(tile_pit, Fill::Block(vacant));
|
|
||||||
|
|
||||||
// Fill with lava
|
|
||||||
let tile_lava = painter.prim(Primitive::Aabb(aabr_with_z(
|
|
||||||
tile_aabr,
|
|
||||||
floor_z - 7..floor_z - 5,
|
|
||||||
)));
|
|
||||||
let tile_lava =
|
|
||||||
painter.prim(Primitive::without(tile_lava, wall_contours));
|
|
||||||
//pits.push(tile_pit);
|
|
||||||
//pits.push(tile_lava);
|
|
||||||
painter.fill(tile_lava, Fill::Block(lava));
|
|
||||||
}
|
}
|
||||||
if room
|
// Specifically don't include pillars in Minotaur arena
|
||||||
.pits
|
if !(room.kind == RoomKind::Boss && self.difficulty == 4) {
|
||||||
.map(|pit_space| {
|
pillars.push((tile_center, pillar, lights));
|
||||||
tile_pos.map(|e| e.rem_euclid(pit_space) == 0).reduce_and()
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
|
||||||
let platform = painter.prim(Primitive::Aabb(Aabb {
|
|
||||||
min: (tile_center - Vec2::broadcast(pillar_thickness - 1))
|
|
||||||
.with_z(floor_z - 7),
|
|
||||||
max: (tile_center + Vec2::broadcast(pillar_thickness))
|
|
||||||
.with_z(floor_z),
|
|
||||||
}));
|
|
||||||
painter.fill(platform, Fill::Block(stone));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a room has pillars, the current tile aligns with the pillar spacing,
|
|
||||||
// and we're not too close to a wall (i.e. the
|
|
||||||
// adjacent tiles are rooms and not hallways/solid),
|
|
||||||
// place a pillar
|
|
||||||
if room
|
|
||||||
.pillars
|
|
||||||
.map(|pillar_space| {
|
|
||||||
tile_pos
|
|
||||||
.map(|e| e.rem_euclid(pillar_space) == 0)
|
|
||||||
.reduce_and()
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
&& DIRS
|
|
||||||
.iter()
|
|
||||||
.map(|dir| tile_pos + *dir)
|
|
||||||
.all(|other_tile_pos| {
|
|
||||||
matches!(self.tiles.get(other_tile_pos), Some(Tile::Room(_)))
|
|
||||||
})
|
|
||||||
{
|
|
||||||
let mut pillar = painter.prim(Primitive::Cylinder(Aabb {
|
|
||||||
min: (tile_center - Vec2::broadcast(pillar_thickness - 1))
|
|
||||||
.with_z(floor_z),
|
|
||||||
max: (tile_center + Vec2::broadcast(pillar_thickness))
|
|
||||||
.with_z(floor_z + height),
|
|
||||||
}));
|
|
||||||
let base = painter.prim(Primitive::Cylinder(Aabb {
|
|
||||||
min: (tile_center - Vec2::broadcast(1 + pillar_thickness - 1))
|
|
||||||
.with_z(floor_z),
|
|
||||||
max: (tile_center + Vec2::broadcast(1 + pillar_thickness))
|
|
||||||
.with_z(floor_z + 1),
|
|
||||||
}));
|
|
||||||
|
|
||||||
let scale = (pillar_thickness + 2) as f32 / pillar_thickness as f32;
|
|
||||||
let mut lights = painter
|
|
||||||
.prim(Primitive::scale(pillar, Vec2::broadcast(scale).with_z(1.0)));
|
|
||||||
lights = painter.prim(Primitive::intersect(lighting_plane, lights));
|
|
||||||
// Only add the base (and shift the lights up)
|
|
||||||
// for boss-rooms pillars
|
|
||||||
if room.kind == RoomKind::Boss {
|
|
||||||
lights =
|
|
||||||
painter.prim(Primitive::translate(lights, 3 * Vec3::unit_z()));
|
|
||||||
pillar = painter.prim(Primitive::union(pillar, base));
|
|
||||||
}
|
|
||||||
// Specifically don't include pillars in Minotaur arena
|
|
||||||
if !(room.kind == RoomKind::Boss && self.difficulty == 4) {
|
|
||||||
pillars.push((tile_center, pillar, lights));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Keep track of the boss room to be able to add decorations later
|
// Keep track of the boss room to be able to add decorations later
|
||||||
if room.kind == RoomKind::Boss {
|
if room.kind == RoomKind::Boss {
|
||||||
boss_room_center =
|
boss_room_center =
|
||||||
Some(floor_corner + TILE_SIZE * room.area.center() + TILE_SIZE / 2);
|
Some(floor_corner + TILE_SIZE * room.area.center() + TILE_SIZE / 2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user