less blocking - targets will try to path to any space around their tar

This commit is contained in:
Llywelwyn 2023-08-30 09:15:45 +01:00
parent 340aefa9e1
commit 64caf0dc1a
16 changed files with 252 additions and 68 deletions

View file

@ -1,6 +1,6 @@
use rltk::{ Algorithm2D, BaseMap, Point };
use rltk::prelude::*;
use serde::{ Deserialize, Serialize };
use std::collections::HashSet;
use std::collections::{ HashSet, HashMap };
mod tiletype;
pub use tiletype::{ tile_cost, tile_opaque, tile_walkable, TileType, get_dest, Destination };
mod interval_spawning_system;
@ -25,13 +25,13 @@ pub struct Map {
pub lit_tiles: Vec<bool>,
pub telepath_tiles: Vec<bool>,
pub colour_offset: Vec<((f32, f32, f32), (f32, f32, f32))>,
pub additional_fg_offset: rltk::RGB,
pub additional_fg_offset: RGB,
pub id: i32,
pub name: String,
pub short_name: String,
pub depth: i32,
pub difficulty: i32,
pub bloodstains: HashSet<usize>,
pub bloodstains: HashMap<usize, RGB>,
pub view_blocked: HashSet<usize>,
}
@ -72,7 +72,7 @@ impl Map {
short_name: short_name.to_string(),
depth: depth,
difficulty: difficulty,
bloodstains: HashSet::new(),
bloodstains: HashMap::new(),
view_blocked: HashSet::new(),
};

View file

@ -287,8 +287,8 @@ fn apply_colour_offset(mut rgb: RGB, map: &Map, idx: usize, offset: (i32, i32, i
}
fn apply_bloodstain_if_necessary(mut bg: RGB, map: &Map, idx: usize) -> RGB {
if map.bloodstains.contains(&idx) {
bg = bg.add(RGB::named(BLOODSTAIN_COLOUR));
if map.bloodstains.contains_key(&idx) {
bg = bg.add(map.bloodstains[&idx]);
}
return bg;
}