mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
hang wreaths at the fireplace
This commit is contained in:
parent
9b485456eb
commit
c0b56671ec
@ -149,7 +149,12 @@ fn profession_agent_mark(profession: Option<&Profession>) -> Option<comp::agent:
|
||||
}
|
||||
}
|
||||
|
||||
fn get_npc_entity_info(npc: &Npc, sites: &Sites, index: IndexRef, time: Option<&(TimeOfDay, Calendar)>) -> EntityInfo {
|
||||
fn get_npc_entity_info(
|
||||
npc: &Npc,
|
||||
sites: &Sites,
|
||||
index: IndexRef,
|
||||
time: Option<&(TimeOfDay, Calendar)>,
|
||||
) -> EntityInfo {
|
||||
let pos = comp::Pos(npc.wpos);
|
||||
|
||||
let mut rng = npc.rng(Npc::PERM_ENTITY_CONFIG);
|
||||
@ -321,7 +326,12 @@ impl<'a> System<'a> for Sys {
|
||||
});
|
||||
},
|
||||
_ => {
|
||||
let entity_info = get_npc_entity_info(npc, &data.sites, index.as_index_ref(), Some(&calendar_data));
|
||||
let entity_info = get_npc_entity_info(
|
||||
npc,
|
||||
&data.sites,
|
||||
index.as_index_ref(),
|
||||
Some(&calendar_data),
|
||||
);
|
||||
|
||||
emitter.emit(match NpcData::from_entity_info(entity_info) {
|
||||
NpcData::Data {
|
||||
@ -377,8 +387,12 @@ impl<'a> System<'a> for Sys {
|
||||
let npc = data.npcs.npcs.get_mut(npc_id)?;
|
||||
if matches!(npc.mode, SimulationMode::Simulated) {
|
||||
npc.mode = SimulationMode::Loaded;
|
||||
let entity_info =
|
||||
get_npc_entity_info(npc, &data.sites, index.as_index_ref(), Some(&calendar_data));
|
||||
let entity_info = get_npc_entity_info(
|
||||
npc,
|
||||
&data.sites,
|
||||
index.as_index_ref(),
|
||||
Some(&calendar_data),
|
||||
);
|
||||
|
||||
Some(match NpcData::from_entity_info(entity_info) {
|
||||
NpcData::Data {
|
||||
|
@ -13,6 +13,7 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
astar::Astar,
|
||||
calendar::Calendar,
|
||||
path::Path,
|
||||
spiral::Spiral2d,
|
||||
store::{Id, Store},
|
||||
@ -236,6 +237,7 @@ impl Civs {
|
||||
seed: u32,
|
||||
sim: &mut WorldSim,
|
||||
index: &mut Index,
|
||||
calendar: Option<&Calendar>,
|
||||
report_stage: &dyn Fn(WorldCivStage),
|
||||
) -> Self {
|
||||
prof_span!("Civs::generate");
|
||||
@ -543,6 +545,7 @@ impl Civs {
|
||||
&mut rng,
|
||||
wpos,
|
||||
size,
|
||||
calendar,
|
||||
))
|
||||
},
|
||||
SiteKind::CliffTown => WorldSite::cliff_town(site2::Site::generate_cliff_town(
|
||||
|
@ -128,14 +128,16 @@ impl World {
|
||||
// is broken.
|
||||
threadpool.install(|| {
|
||||
let mut index = Index::new(seed);
|
||||
let calendar = opts.calendar.clone();
|
||||
|
||||
let mut sim = sim::WorldSim::generate(seed, opts, threadpool, &|stage| {
|
||||
report_stage(WorldGenerateStage::WorldSimGenerate(stage))
|
||||
});
|
||||
|
||||
let civs = civ::Civs::generate(seed, &mut sim, &mut index, &|stage| {
|
||||
report_stage(WorldGenerateStage::WorldCivGenerate(stage))
|
||||
});
|
||||
let civs =
|
||||
civ::Civs::generate(seed, &mut sim, &mut index, calendar.as_ref(), &|stage| {
|
||||
report_stage(WorldGenerateStage::WorldCivGenerate(stage))
|
||||
});
|
||||
|
||||
report_stage(WorldGenerateStage::EconomySimulation);
|
||||
sim2::simulate(&mut index, &mut sim);
|
||||
|
@ -19,6 +19,7 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
astar::Astar,
|
||||
calendar::Calendar,
|
||||
comp::Alignment,
|
||||
generation::EntityInfo,
|
||||
lottery::Lottery,
|
||||
@ -579,6 +580,7 @@ impl Site {
|
||||
rng: &mut impl Rng,
|
||||
origin: Vec2<i32>,
|
||||
size: f32,
|
||||
calendar: Option<&Calendar>,
|
||||
) -> Self {
|
||||
let mut rng = reseed(rng);
|
||||
|
||||
@ -664,6 +666,7 @@ impl Site {
|
||||
door_tile,
|
||||
door_dir,
|
||||
aabr,
|
||||
calendar,
|
||||
);
|
||||
let house_alt = house.alt;
|
||||
let plot = site.create_plot(Plot {
|
||||
@ -2023,6 +2026,7 @@ pub fn test_site() -> Site {
|
||||
&mut thread_rng(),
|
||||
Vec2::zero(),
|
||||
0.5,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,10 @@ use crate::{
|
||||
util::{RandomField, Sampler, DIRS},
|
||||
Land,
|
||||
};
|
||||
use common::terrain::{Block, BlockKind, SpriteKind};
|
||||
use common::{
|
||||
calendar::{Calendar, CalendarEvent},
|
||||
terrain::{Block, BlockKind, SpriteKind},
|
||||
};
|
||||
use rand::prelude::*;
|
||||
use vek::*;
|
||||
|
||||
@ -25,6 +28,7 @@ pub struct House {
|
||||
/// Color of the roof
|
||||
roof_color: Rgb<u8>,
|
||||
front: u8,
|
||||
christmas_decorations: bool,
|
||||
}
|
||||
|
||||
impl House {
|
||||
@ -35,6 +39,7 @@ impl House {
|
||||
door_tile: Vec2<i32>,
|
||||
door_dir: Vec2<i32>,
|
||||
tile_aabr: Aabr<i32>,
|
||||
calendar: Option<&Calendar>,
|
||||
) -> Self {
|
||||
let levels = rng.gen_range(1..2 + (tile_aabr.max - tile_aabr.min).product() / 6) as u32;
|
||||
let door_tile_pos = site.tile_center_wpos(door_tile);
|
||||
@ -52,6 +57,8 @@ impl House {
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let christmas_decorations =
|
||||
calendar.map_or(false, |c| c.is_event(CalendarEvent::Christmas));
|
||||
|
||||
Self {
|
||||
door_tile: door_tile_pos,
|
||||
@ -83,6 +90,7 @@ impl House {
|
||||
*colors.choose(rng).unwrap_or(&Rgb::new(21, 43, 48))
|
||||
},
|
||||
front,
|
||||
christmas_decorations,
|
||||
}
|
||||
}
|
||||
|
||||
@ -2041,6 +2049,52 @@ impl Structure for House {
|
||||
painter.prim(Primitive::Aabb(fire_embers)),
|
||||
Fill::Block(Block::air(SpriteKind::Ember)),
|
||||
);
|
||||
if self.christmas_decorations {
|
||||
let (wreath_pos, wreath_ori) = match self.front {
|
||||
0 => (
|
||||
Aabb {
|
||||
min: Vec2::new(fireplace_origin.x + 1, fireplace_origin.y + 3)
|
||||
.with_z(alt + 2),
|
||||
max: Vec2::new(fireplace_origin.x + 2, fireplace_origin.y + 4)
|
||||
.with_z(alt + 3),
|
||||
},
|
||||
4,
|
||||
),
|
||||
1 => (
|
||||
Aabb {
|
||||
min: Vec2::new(fireplace_origin.x + 3, fireplace_origin.y + 1)
|
||||
.with_z(alt + 2),
|
||||
max: Vec2::new(fireplace_origin.x + 4, fireplace_origin.y + 2)
|
||||
.with_z(alt + 3),
|
||||
},
|
||||
2,
|
||||
),
|
||||
2 => (
|
||||
Aabb {
|
||||
min: Vec2::new(fireplace_origin.x + 1, fireplace_origin.y - 1)
|
||||
.with_z(alt + 2),
|
||||
max: Vec2::new(fireplace_origin.x + 2, fireplace_origin.y).with_z(alt + 3),
|
||||
},
|
||||
0,
|
||||
),
|
||||
_ => (
|
||||
Aabb {
|
||||
min: Vec2::new(fireplace_origin.x - 1, fireplace_origin.y + 1)
|
||||
.with_z(alt + 2),
|
||||
max: Vec2::new(fireplace_origin.x, fireplace_origin.y + 2).with_z(alt + 3),
|
||||
},
|
||||
6,
|
||||
),
|
||||
};
|
||||
painter.fill(
|
||||
painter.prim(Primitive::Aabb(wreath_pos)),
|
||||
Fill::Block(
|
||||
Block::air(SpriteKind::ChristmasWreath)
|
||||
.with_ori(wreath_ori)
|
||||
.unwrap(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Door
|
||||
// Fill around the door with wall
|
||||
|
Loading…
Reference in New Issue
Block a user