names to file
This commit is contained in:
parent
e1eae7efaf
commit
486807fc84
6 changed files with 41 additions and 10 deletions
|
|
@ -4,3 +4,4 @@ pub mod messages;
|
|||
pub mod char_create;
|
||||
pub mod events;
|
||||
pub mod ids;
|
||||
pub mod names;
|
||||
|
|
|
|||
4
src/data/names.rs
Normal file
4
src/data/names.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
pub const NAME_OVERMAP: &str = "WORLD MAP";
|
||||
pub const NAME_DUNGEON_RANDOM: &str = "the dungeon";
|
||||
pub const NAME_STARTER_TOWN: &str = "TOWN NAME";
|
||||
pub const NAME_FOREST_BUILDER: &str = "the woods outside of town";
|
||||
|
|
@ -272,16 +272,13 @@ fn transition_to_new_map(ecs: &mut World, new_id: i32) -> Vec<Map> {
|
|||
{
|
||||
let mut worldmap_resource = ecs.write_resource::<Map>();
|
||||
old_map = worldmap_resource.clone();
|
||||
if !old_map.overmap {
|
||||
// If there is zero overmap involvement, place an upstair where we ended up.
|
||||
// Otherwise, this should be hand-placed.
|
||||
if !old_map.overmap && !builder.build_data.map.overmap {
|
||||
if let Some(pos) = &builder.build_data.starting_position {
|
||||
let up_idx = builder.build_data.map.xy_idx(pos.x, pos.y);
|
||||
builder.build_data.map.tiles[up_idx] = TileType::UpStair;
|
||||
}
|
||||
} else {
|
||||
if let Some(pos) = &builder.build_data.starting_position {
|
||||
let down_idx = builder.build_data.map.xy_idx(pos.x, pos.y);
|
||||
builder.build_data.map.tiles[down_idx] = TileType::ToOvermap;
|
||||
}
|
||||
}
|
||||
*worldmap_resource = builder.build_data.map.clone();
|
||||
// Unwrap so we get a CTD if there's no starting pos.
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use super::{
|
|||
YStart,
|
||||
};
|
||||
use rltk::prelude::*;
|
||||
use crate::data::names::*;
|
||||
|
||||
pub fn forest_builder(
|
||||
new_id: i32,
|
||||
|
|
@ -20,7 +21,15 @@ pub fn forest_builder(
|
|||
difficulty: i32,
|
||||
initial_player_level: i32
|
||||
) -> BuilderChain {
|
||||
let mut chain = BuilderChain::new(false, new_id, width, height, difficulty, "the woods", initial_player_level);
|
||||
let mut chain = BuilderChain::new(
|
||||
false,
|
||||
new_id,
|
||||
width,
|
||||
height,
|
||||
difficulty,
|
||||
NAME_FOREST_BUILDER,
|
||||
initial_player_level
|
||||
);
|
||||
chain.start_with(CellularAutomataBuilder::new());
|
||||
chain.with(AreaStartingPosition::new(XStart::CENTRE, YStart::CENTRE));
|
||||
chain.with(CullUnreachable::new());
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ use specs::prelude::*;
|
|||
use voronoi_spawning::VoronoiSpawning;
|
||||
use super::config::CONFIG;
|
||||
use super::data::ids::*;
|
||||
use super::data::names::*;
|
||||
//use wfc::WaveFunctionCollapseBuilder;
|
||||
mod room_exploder;
|
||||
use room_exploder::RoomExploder;
|
||||
|
|
@ -319,7 +320,7 @@ fn random_shape_builder(rng: &mut rltk::RandomNumberGenerator, builder: &mut Bui
|
|||
}
|
||||
|
||||
fn overmap_builder() -> BuilderChain {
|
||||
let mut builder = BuilderChain::new(true, ID_OVERMAP, 69, 41, 0, "the world", 1);
|
||||
let mut builder = BuilderChain::new(true, ID_OVERMAP, 69, 41, 0, NAME_OVERMAP, 1);
|
||||
builder.start_with(PrefabBuilder::overmap());
|
||||
return builder;
|
||||
}
|
||||
|
|
@ -333,7 +334,15 @@ pub fn random_builder(
|
|||
initial_player_level: i32
|
||||
) -> BuilderChain {
|
||||
rltk::console::log(format!("DEBUGINFO: Building random (ID:{}, DIFF:{})", new_id, difficulty));
|
||||
let mut builder = BuilderChain::new(false, new_id, width, height, difficulty, "the dungeon", initial_player_level);
|
||||
let mut builder = BuilderChain::new(
|
||||
false,
|
||||
new_id,
|
||||
width,
|
||||
height,
|
||||
difficulty,
|
||||
NAME_DUNGEON_RANDOM,
|
||||
initial_player_level
|
||||
);
|
||||
let type_roll = rng.roll_dice(1, 2);
|
||||
let mut want_doors = true;
|
||||
match type_roll {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use super::{ BuilderChain, BuilderMap, InitialMapBuilder, Position, TileType };
|
||||
use std::collections::HashSet;
|
||||
use crate::data::names::*;
|
||||
|
||||
pub fn town_builder(
|
||||
new_id: i32,
|
||||
|
|
@ -10,7 +11,15 @@ pub fn town_builder(
|
|||
initial_player_level: i32
|
||||
) -> BuilderChain {
|
||||
rltk::console::log(format!("DEBUGINFO: Building town (ID:{}, DIFF:{})", new_id, difficulty));
|
||||
let mut chain = BuilderChain::new(false, new_id, width, height, difficulty, "the town", initial_player_level);
|
||||
let mut chain = BuilderChain::new(
|
||||
false,
|
||||
new_id,
|
||||
width,
|
||||
height,
|
||||
difficulty,
|
||||
NAME_STARTER_TOWN,
|
||||
initial_player_level
|
||||
);
|
||||
chain.start_with(TownBuilder::new());
|
||||
|
||||
return chain;
|
||||
|
|
@ -65,6 +74,8 @@ impl TownBuilder {
|
|||
x: build_data.width - 2,
|
||||
y: wall_gap_y,
|
||||
});
|
||||
let overmap_entrance = build_data.map.xy_idx(build_data.width - 2, wall_gap_y);
|
||||
build_data.map.tiles[overmap_entrance] = TileType::ToOvermap;
|
||||
|
||||
build_data.take_snapshot();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue