Surface world: grass in daylight, forests, cliffs with cave mouths; free-game and editor option
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef10b5c432
commit
8a35a903de
32 files changed
+343
-24
No files matched your search
+18
-1
@@ -350,6 +350,8 @@ pub struct Map {
|
||||
pub explored: Vec<bool>, // fog of war: tiles the dungeon knows (empty: no fog)
|
||||
#[serde(skip)]
|
||||
pub visible: Vec<bool>, // fog of war: tiles in sight right now
|
||||
#[serde(default, with = "crate::fog::bits")]
|
||||
pub sky: Vec<bool>, // tiles above ground (daylight, grass); empty: all underground
|
||||
}
|
||||
|
||||
fn default_size() -> usize {
|
||||
@@ -367,6 +369,21 @@ impl Map {
|
||||
}
|
||||
}
|
||||
|
||||
// tile i lies above ground
|
||||
pub fn sky(&self, i: usize) -> bool {
|
||||
self.sky.get(i).copied().unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn set_sky(&mut self, i: usize, on: bool) {
|
||||
if self.sky.len() != self.t.len() {
|
||||
if !on {
|
||||
return;
|
||||
}
|
||||
self.sky = vec![false; self.t.len()];
|
||||
}
|
||||
self.sky[i] = on;
|
||||
}
|
||||
|
||||
pub fn get(&self, x: i32, y: i32) -> Option<&Tile> {
|
||||
if inb(x, y) {
|
||||
Some(&self.t[idx(x, y)])
|
||||
@@ -587,7 +604,7 @@ impl Map {
|
||||
tl.hp = 6.0;
|
||||
}
|
||||
}
|
||||
Map { w, h, t, core, portals, legacy_portal: None, gate, treasures, explored: Vec::new(), visible: Vec::new() }
|
||||
Map { w, h, t, core, portals, legacy_portal: None, gate, treasures, explored: Vec::new(), visible: Vec::new(), sky: Vec::new() }
|
||||
}
|
||||
|
||||
// Carves a meandering river; the player's area, the core and portals stay dry.
|
||||
|
||||
Reference in new issue
Block a user