Loadout Update: Use

Delete guard and villager lazy_loadout and use LoadoutKind::Extended
with potions instead
This commit is contained in:
juliancoffee 2022-01-23 18:55:07 +02:00
parent 4a4f2f8d8f
commit 5a370cb6f7
4 changed files with 31 additions and 41 deletions

View File

@ -2,13 +2,21 @@
name: Name("Guard"),
body: RandomWith("humanoid"),
alignment: Alignment(Npc),
loadout: Hands(TwoHanded(Choice([
(1, Some(Item("common.items.weapons.sword.cobalt-0"))),
(2, Some(Item("common.items.weapons.bow.metal-2"))),
(1, Some(Item("common.items.weapons.axe.cobalt_axe-0"))),
]))),
loadout: Extended(
hands: TwoHanded(Choice([
(1, Some(Item("common.items.weapons.sword.cobalt-0"))),
(2, Some(Item("common.items.weapons.bow.metal-2"))),
(1, Some(Item("common.items.weapons.axe.cobalt_axe-0"))),
])),
base_asset: Loadout("common.loadout.village.guard"),
inventory: [
(25, "common.items.consumable.potion_big"),
],
),
loot: LootTable("common.loot_tables.creature.humanoid"),
meta: [
SkillSetAsset("common.skillset.preset.rank3.fullskill"),
],
)
)

View File

@ -2,14 +2,22 @@
name: Name("Villager"),
body: RandomWith("humanoid"),
alignment: Alignment(Npc),
loadout: Hands(TwoHanded(Choice([
(1, Some(Item("common.items.weapons.tool.broom"))),
(1, Some(Item("common.items.weapons.tool.hoe"))),
(1, Some(Item("common.items.weapons.tool.pickaxe"))),
(1, Some(Item("common.items.weapons.tool.rake"))),
(1, Some(Item("common.items.weapons.tool.shovel-0"))),
(1, Some(Item("common.items.weapons.tool.shovel-1"))),
]))),
loadout: Extended(
hands: TwoHanded(Choice([
(1, Some(Item("common.items.weapons.tool.broom"))),
(1, Some(Item("common.items.weapons.tool.hoe"))),
(1, Some(Item("common.items.weapons.tool.pickaxe"))),
(1, Some(Item("common.items.weapons.tool.rake"))),
(1, Some(Item("common.items.weapons.tool.shovel-0"))),
(1, Some(Item("common.items.weapons.tool.shovel-1"))),
])),
base_asset: Loadout("common.loadout.village.villager"),
inventory: [
(10, "common.items.consumable.potion_big"),
],
),
loot: LootTable("common.loot_tables.creature.humanoid"),
meta: [],
)
)

View File

@ -135,8 +135,6 @@ impl Entity {
/// Escape hatch for runtime creation of loadout not covered by entity
/// config.
// NOTE: Signature is part of interface of EntityInfo, and site information
// is not used for RtSim as of now.
pub fn get_adhoc_loadout(
&self,
) -> fn(LoadoutBuilder, Option<&trade::SiteInformation>) -> LoadoutBuilder {

View File

@ -1006,7 +1006,6 @@ fn humanoid(pos: Vec3<f32>, economy: &SiteInformation, dynamic_rng: &mut impl Rn
match dynamic_rng.gen_range(0..8) {
0 | 1 => entity
.with_agent_mark(agent::Mark::Guard)
.with_lazy_loadout(guard_loadout)
.with_asset_expect("common.entity.village.guard"),
2 => entity
.with_agent_mark(agent::Mark::Merchant)
@ -1014,7 +1013,6 @@ fn humanoid(pos: Vec3<f32>, economy: &SiteInformation, dynamic_rng: &mut impl Rn
.with_lazy_loadout(merchant_loadout)
.with_asset_expect("common.entity.village.merchant"),
_ => entity
.with_lazy_loadout(villager_loadout)
.with_asset_expect("common.entity.village.villager"),
}
}
@ -1257,28 +1255,6 @@ fn gather_merged_goods(
good_map
}
fn guard_loadout(
loadout_builder: LoadoutBuilder,
_economy: Option<&trade::SiteInformation>,
) -> LoadoutBuilder {
let rng = &mut rand::thread_rng();
loadout_builder
.with_asset_expect("common.loadout.village.guard", rng)
.bag(ArmorSlot::Bag1, Some(make_potion_bag(25)))
}
fn villager_loadout(
loadout_builder: LoadoutBuilder,
_economy: Option<&trade::SiteInformation>,
) -> LoadoutBuilder {
let rng = &mut rand::thread_rng();
loadout_builder
.with_asset_expect("common.loadout.village.villager", rng)
.bag(ArmorSlot::Bag1, Some(make_potion_bag(10)))
}
#[derive(Copy, Clone, PartialEq)]
pub enum Crop {
Corn,