mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add basic guards to towns
This commit is contained in:
parent
d069eb9a57
commit
b7a33c56cc
@ -116,7 +116,7 @@ impl LoadoutBuilder {
|
||||
active_item,
|
||||
second_item: None,
|
||||
shoulder: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.shoulder.chain",
|
||||
"common.items.armor.shoulder.steel_0",
|
||||
)),
|
||||
chest: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.chest.steel_0",
|
||||
@ -376,83 +376,47 @@ impl LoadoutBuilder {
|
||||
head: None,
|
||||
tabard: None,
|
||||
},
|
||||
Villager => {
|
||||
if is_giant {
|
||||
Loadout {
|
||||
active_item,
|
||||
second_item: None,
|
||||
shoulder: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.shoulder.plate_0",
|
||||
)),
|
||||
chest: Some(Item::new_from_asset_expect(match alignment {
|
||||
Alignment::Enemy => "common.items.npc_armor.chest.plate_red_0",
|
||||
_ => "common.items.npc_armor.chest.plate_green_0",
|
||||
})),
|
||||
belt: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.belt.plate_0",
|
||||
)),
|
||||
hand: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.hand.plate_0",
|
||||
)),
|
||||
pants: Some(Item::new_from_asset_expect(match alignment {
|
||||
Alignment::Enemy => "common.items.npc_armor.pants.plate_red_0",
|
||||
_ => "common.items.npc_armor.pants.plate_green_0",
|
||||
})),
|
||||
foot: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.foot.plate_0",
|
||||
)),
|
||||
back: None,
|
||||
ring: None,
|
||||
neck: None,
|
||||
lantern: None,
|
||||
glider: None,
|
||||
head: None,
|
||||
tabard: None,
|
||||
}
|
||||
} else {
|
||||
Loadout {
|
||||
active_item,
|
||||
second_item: None,
|
||||
shoulder: None,
|
||||
chest: Some(Item::new_from_asset_expect(
|
||||
match rand::thread_rng().gen_range(0, 10) {
|
||||
0 => "common.items.armor.chest.worker_green_0",
|
||||
1 => "common.items.armor.chest.worker_green_1",
|
||||
2 => "common.items.armor.chest.worker_red_0",
|
||||
3 => "common.items.armor.chest.worker_red_1",
|
||||
4 => "common.items.armor.chest.worker_purple_0",
|
||||
5 => "common.items.armor.chest.worker_purple_1",
|
||||
6 => "common.items.armor.chest.worker_yellow_0",
|
||||
7 => "common.items.armor.chest.worker_yellow_1",
|
||||
8 => "common.items.armor.chest.worker_orange_0",
|
||||
_ => "common.items.armor.chest.worker_orange_1",
|
||||
},
|
||||
)),
|
||||
belt: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.belt.leather_0",
|
||||
)),
|
||||
hand: None,
|
||||
pants: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.pants.worker_blue_0",
|
||||
)),
|
||||
foot: Some(Item::new_from_asset_expect(
|
||||
match rand::thread_rng().gen_range(0, 2) {
|
||||
0 => "common.items.armor.foot.leather_0",
|
||||
_ => "common.items.armor.starter.sandals_0",
|
||||
},
|
||||
)),
|
||||
back: None,
|
||||
ring: None,
|
||||
neck: None,
|
||||
lantern: Some(Item::new_from_asset_expect(
|
||||
"common.items.lantern.black_0",
|
||||
)),
|
||||
glider: None,
|
||||
head: None,
|
||||
tabard: None,
|
||||
}
|
||||
}
|
||||
},
|
||||
Villager => Loadout {
|
||||
active_item,
|
||||
second_item: None,
|
||||
shoulder: None,
|
||||
chest: Some(Item::new_from_asset_expect(
|
||||
match rand::thread_rng().gen_range(0, 10) {
|
||||
0 => "common.items.armor.chest.worker_green_0",
|
||||
1 => "common.items.armor.chest.worker_green_1",
|
||||
2 => "common.items.armor.chest.worker_red_0",
|
||||
3 => "common.items.armor.chest.worker_red_1",
|
||||
4 => "common.items.armor.chest.worker_purple_0",
|
||||
5 => "common.items.armor.chest.worker_purple_1",
|
||||
6 => "common.items.armor.chest.worker_yellow_0",
|
||||
7 => "common.items.armor.chest.worker_yellow_1",
|
||||
8 => "common.items.armor.chest.worker_orange_0",
|
||||
_ => "common.items.armor.chest.worker_orange_1",
|
||||
},
|
||||
)),
|
||||
belt: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.belt.leather_0",
|
||||
)),
|
||||
hand: None,
|
||||
pants: Some(Item::new_from_asset_expect(
|
||||
"common.items.armor.pants.worker_blue_0",
|
||||
)),
|
||||
foot: Some(Item::new_from_asset_expect(
|
||||
match rand::thread_rng().gen_range(0, 2) {
|
||||
0 => "common.items.armor.foot.leather_0",
|
||||
_ => "common.items.armor.starter.sandals_0",
|
||||
},
|
||||
)),
|
||||
back: None,
|
||||
ring: None,
|
||||
neck: None,
|
||||
lantern: Some(Item::new_from_asset_expect(
|
||||
"common.items.lantern.black_0",
|
||||
)),
|
||||
glider: None,
|
||||
head: None,
|
||||
tabard: None,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
match body {
|
||||
|
@ -43,7 +43,7 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
let mut wtr = csv::Writer::from_path("weaponstats.csv")?;
|
||||
wtr.write_record(&["Path", "Kind", "Name", "Power", "Equip Time (ms)"])?;
|
||||
wtr.write_record(&["Path", "Kind", "Name", "Power", "Speed", "Equip Time (ms)"])?;
|
||||
|
||||
for item in comp::item::Item::new_from_asset_glob("common.items.weapons.*")
|
||||
.expect("Failed to iterate over item folders!")
|
||||
@ -51,6 +51,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
match item.kind() {
|
||||
comp::item::ItemKind::Tool(tool) => {
|
||||
let power = tool.base_power().to_string();
|
||||
let speed = tool.base_speed().to_string();
|
||||
let equip_time = tool.equip_time().subsec_millis().to_string();
|
||||
let kind = get_tool_kind(&tool.kind);
|
||||
|
||||
@ -59,6 +60,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
&kind,
|
||||
item.name(),
|
||||
&power,
|
||||
&speed,
|
||||
&equip_time,
|
||||
])?;
|
||||
},
|
||||
|
@ -917,8 +917,17 @@ impl Settlement {
|
||||
} else {
|
||||
comp::Alignment::Tame
|
||||
})
|
||||
.do_if(!is_dummy, |e| e.with_automatic_name())
|
||||
.do_if(is_dummy, |e| e.with_name("Training Dummy"))
|
||||
.do_if(is_human && dynamic_rng.gen(), |entity| {
|
||||
entity.with_main_tool(Item::new_from_asset_expect(
|
||||
match dynamic_rng.gen_range(0, 5) {
|
||||
0 => entity.with_main_tool(Item::new_from_asset_expect(
|
||||
"common.items.weapons.sword.greatsword_2h_simple-0",
|
||||
))
|
||||
.with_name("Guard")
|
||||
.with_level(dynamic_rng.gen_range(10, 15))
|
||||
.with_config(common::loadout_builder::LoadoutConfig::Guard),
|
||||
_ => entity.with_main_tool(Item::new_from_asset_expect(
|
||||
match dynamic_rng.gen_range(0, 7) {
|
||||
0 => "common.items.npc_weapons.tool.broom",
|
||||
1 => "common.items.npc_weapons.tool.hoe",
|
||||
@ -931,9 +940,8 @@ impl Settlement {
|
||||
},
|
||||
))
|
||||
.with_config(common::loadout_builder::LoadoutConfig::Villager)
|
||||
})
|
||||
.do_if(is_dummy, |e| e.with_name("Training Dummy"))
|
||||
.do_if(!is_dummy, |e| e.with_automatic_name());
|
||||
}
|
||||
});
|
||||
|
||||
supplement.add_entity(entity);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user