sorry - swapping from rustfmt to prettier-rust

This commit is contained in:
Llywelwyn 2023-08-23 01:22:09 +01:00
parent 281396f9ce
commit c2c7e0bd52
93 changed files with 2797 additions and 2021 deletions

View file

@ -1,5 +1,5 @@
use super::{gamelog, Blind, BlocksVisibility, Hidden, Map, Name, Player, Position, Telepath, Viewshed};
use rltk::{FieldOfViewAlg::SymmetricShadowcasting, Point};
use super::{ gamelog, Blind, BlocksVisibility, Hidden, Map, Name, Player, Position, Telepath, Viewshed };
use rltk::{ FieldOfViewAlg::SymmetricShadowcasting, Point };
use specs::prelude::*;
pub struct VisibilitySystem {}
@ -49,12 +49,12 @@ impl<'a> System<'a> for VisibilitySystem {
let origin = Point::new(pos.x, pos.y);
viewshed.visible_tiles = SymmetricShadowcasting.field_of_view(origin, range, &*map);
viewshed.visible_tiles.retain(|p| {
p.x >= 0
&& p.x < map.width
&& p.y >= 0
&& p.y < map.height
&& (map.lit_tiles[map.xy_idx(p.x, p.y)] == true
|| rltk::DistanceAlg::Pythagoras.distance2d(Point::new(p.x, p.y), origin) < 1.5)
p.x >= 0 &&
p.x < map.width &&
p.y >= 0 &&
p.y < map.height &&
(map.lit_tiles[map.xy_idx(p.x, p.y)] == true ||
rltk::DistanceAlg::Pythagoras.distance2d(Point::new(p.x, p.y), origin) < 1.5)
});
// If this is the player, reveal what they can see
@ -75,7 +75,8 @@ impl<'a> System<'a> for VisibilitySystem {
if rng.roll_dice(1, 12) == 1 {
let name = names.get(e);
if let Some(name) = name {
gamelog::Logger::new()
gamelog::Logger
::new()
.append("You spot a")
.item_name_n(&name.name)
.period()
@ -121,11 +122,11 @@ pub fn fast_fov(p_x: i32, p_y: i32, r: i32) -> Vec<Point> {
let mut i = 0;
while i <= 360 {
let x: f32 = f32::cos(i as f32 * 0.01745 as f32);
let y: f32 = f32::sin(i as f32 * 0.01745 as f32);
let x: f32 = f32::cos((i as f32) * (0.01745 as f32));
let y: f32 = f32::sin((i as f32) * (0.01745 as f32));
let mut ox: f32 = p_x as f32 + 0.5 as f32;
let mut oy: f32 = p_y as f32 + 0.5 as f32;
let mut ox: f32 = (p_x as f32) + (0.5 as f32);
let mut oy: f32 = (p_y as f32) + (0.5 as f32);
for _i in 0..r {
visible_tiles.push(Point::new(ox as i32, oy as i32));
ox += x;