mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added blacksmith
This commit is contained in:
parent
afd9ea5462
commit
e08f7d4fa9
@ -106,6 +106,8 @@ pub enum Profession {
|
||||
Guard,
|
||||
#[serde(rename = "4")]
|
||||
Adventurer(u32),
|
||||
#[serde(rename = "5")]
|
||||
Blacksmith,
|
||||
}
|
||||
|
||||
impl Profession {
|
||||
@ -116,6 +118,7 @@ impl Profession {
|
||||
Self::Merchant => "Merchant".to_string(),
|
||||
Self::Guard => "Guard".to_string(),
|
||||
Self::Adventurer(_) => "Adventurer".to_string(),
|
||||
Self::Blacksmith => "Blacksmith".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,11 +46,12 @@ impl Data {
|
||||
wpos2d.map(|e| e as f32 + 0.5)
|
||||
.with_z(world.sim().get_alt_approx(wpos2d).unwrap_or(0.0))
|
||||
};
|
||||
for _ in 0..10 {
|
||||
for _ in 0..20 {
|
||||
|
||||
this.npcs.create(Npc::new(rng.gen(), rand_wpos(&mut rng)).with_home(site_id).with_profession(match rng.gen_range(0..10) {
|
||||
0 => Profession::Hunter,
|
||||
1..=4 => Profession::Farmer,
|
||||
1 => Profession::Blacksmith,
|
||||
2..=4 => Profession::Farmer,
|
||||
_ => Profession::Guard,
|
||||
}));
|
||||
}
|
||||
|
@ -105,6 +105,12 @@ impl<'a> System<'a> for Sys {
|
||||
economy.as_ref(),
|
||||
|good| matches!(good, Good::Food),
|
||||
),
|
||||
Profession::Blacksmith => trader_loadout(
|
||||
loadout_builder
|
||||
.with_asset_expect("common.loadout.village.blacksmith", &mut rng),
|
||||
economy.as_ref(),
|
||||
|good| matches!(good, Good::Tools | Good::Armor),
|
||||
),
|
||||
Profession::Hunter => loadout_builder
|
||||
.with_asset_expect("common.loadout.village.villager", &mut rng),
|
||||
|
||||
@ -114,7 +120,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
let can_speak = npc.profession.is_some(); // TODO: not this
|
||||
|
||||
let trade_for_site = if let Some(Profession::Merchant | Profession::Farmer) = npc.profession {
|
||||
let trade_for_site = if let Some(Profession::Merchant | Profession::Farmer | Profession::Blacksmith) = npc.profession {
|
||||
npc.home.and_then(|home| Some(data.sites.get(home)?.world_site?.id()))
|
||||
} else {
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user