From 5a370cb6f789e0ddb94657bd993af96838cb844d Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Sun, 23 Jan 2022 18:55:07 +0200 Subject: [PATCH] Loadout Update: Use Delete guard and villager lazy_loadout and use LoadoutKind::Extended with potions instead --- assets/common/entity/village/guard.ron | 20 +++++++++++------ assets/common/entity/village/villager.ron | 26 +++++++++++++++-------- server/src/rtsim/entity.rs | 2 -- world/src/site/settlement/mod.rs | 24 --------------------- 4 files changed, 31 insertions(+), 41 deletions(-) diff --git a/assets/common/entity/village/guard.ron b/assets/common/entity/village/guard.ron index 9ec6e8949c..618d7d20f4 100644 --- a/assets/common/entity/village/guard.ron +++ b/assets/common/entity/village/guard.ron @@ -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"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/villager.ron b/assets/common/entity/village/villager.ron index dccb3bf23c..1531d7d7b8 100644 --- a/assets/common/entity/village/villager.ron +++ b/assets/common/entity/village/villager.ron @@ -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: [], -) \ No newline at end of file +) diff --git a/server/src/rtsim/entity.rs b/server/src/rtsim/entity.rs index beb7ccdffe..a76ece5355 100644 --- a/server/src/rtsim/entity.rs +++ b/server/src/rtsim/entity.rs @@ -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 { diff --git a/world/src/site/settlement/mod.rs b/world/src/site/settlement/mod.rs index c5473bd79b..3eaa405ec3 100644 --- a/world/src/site/settlement/mod.rs +++ b/world/src/site/settlement/mod.rs @@ -1006,7 +1006,6 @@ fn humanoid(pos: Vec3, 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, 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,