diff --git a/assets/common/entity/dungeon/fallback/boss.ron b/assets/common/entity/dungeon/fallback/boss.ron index cfda6d5ee3..3f11d76f76 100644 --- a/assets/common/entity/dungeon/fallback/boss.ron +++ b/assets/common/entity/dungeon/fallback/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.fallback"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/fallback/enemy.ron b/assets/common/entity/dungeon/fallback/enemy.ron index 22dea6881a..04b2f43071 100644 --- a/assets/common/entity/dungeon/fallback/enemy.ron +++ b/assets/common/entity/dungeon/fallback/enemy.ron @@ -5,7 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.fallback"), - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.0, Some(Item("common.items.weapons.tool.broom"))), (1.0, Some(Item("common.items.weapons.tool.hoe"))), (1.0, Some(Item("common.items.weapons.tool.pickaxe"))), @@ -14,7 +14,6 @@ EntityConfig ( (1.0, Some(Item("common.items.weapons.tool.shovel-1"))), (1.0, Some(Item("common.items.weapons.bow.bone-1"))), ])), - second_tool: None, meta: [], ) diff --git a/assets/common/entity/dungeon/fallback/miniboss.ron b/assets/common/entity/dungeon/fallback/miniboss.ron index 018dcfbb6e..befb2f8cf6 100644 --- a/assets/common/entity/dungeon/fallback/miniboss.ron +++ b/assets/common/entity/dungeon/fallback/miniboss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.fallback"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-0/boss.ron b/assets/common/entity/dungeon/tier-0/boss.ron index c45b913721..b0cecbc954 100644 --- a/assets/common/entity/dungeon/tier-0/boss.ron +++ b/assets/common/entity/dungeon/tier-0/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-0.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-0/bow.ron b/assets/common/entity/dungeon/tier-0/bow.ron index 362cf82734..55829f748f 100644 --- a/assets/common/entity/dungeon/tier-0/bow.ron +++ b/assets/common/entity/dungeon/tier-0/bow.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-0.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.gnarling.adlet_bow")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.adlet_bow")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-0.gnarling"), diff --git a/assets/common/entity/dungeon/tier-0/miniboss.ron b/assets/common/entity/dungeon/tier-0/miniboss.ron index 99ebb6165c..d17e7fd605 100644 --- a/assets/common/entity/dungeon/tier-0/miniboss.ron +++ b/assets/common/entity/dungeon/tier-0/miniboss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-0.miniboss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-0/spear.ron b/assets/common/entity/dungeon/tier-0/spear.ron index ade46b767d..d71328be25 100644 --- a/assets/common/entity/dungeon/tier-0/spear.ron +++ b/assets/common/entity/dungeon/tier-0/spear.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-0.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.gnarling.wooden_spear")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.wooden_spear")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-0.gnarling"), diff --git a/assets/common/entity/dungeon/tier-0/staff.ron b/assets/common/entity/dungeon/tier-0/staff.ron index 8c855b9e70..e9d9e4e376 100644 --- a/assets/common/entity/dungeon/tier-0/staff.ron +++ b/assets/common/entity/dungeon/tier-0/staff.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-0.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.gnarling.gnoll_staff")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.gnoll_staff")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-0.gnarling"), diff --git a/assets/common/entity/dungeon/tier-1/boss.ron b/assets/common/entity/dungeon/tier-1/boss.ron index 1ff096a52c..63bacdcfc8 100644 --- a/assets/common/entity/dungeon/tier-1/boss.ron +++ b/assets/common/entity/dungeon/tier-1/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-1.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-1/bow.ron b/assets/common/entity/dungeon/tier-1/bow.ron index ac3b28e5e9..06078fb1e2 100644 --- a/assets/common/entity/dungeon/tier-1/bow.ron +++ b/assets/common/entity/dungeon/tier-1/bow.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-1.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.adlet.adlet_bow")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.adlet.adlet_bow")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-1.adlet_bow"), diff --git a/assets/common/entity/dungeon/tier-1/rat.ron b/assets/common/entity/dungeon/tier-1/rat.ron index c2672e0f3c..aeab6f2370 100644 --- a/assets/common/entity/dungeon/tier-1/rat.ron +++ b/assets/common/entity/dungeon/tier-1/rat.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.creature.quad_small.generic"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-1/spear.ron b/assets/common/entity/dungeon/tier-1/spear.ron index f32e2021fa..4fb7d51fa2 100644 --- a/assets/common/entity/dungeon/tier-1/spear.ron +++ b/assets/common/entity/dungeon/tier-1/spear.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-1.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.adlet.wooden_spear")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.adlet.wooden_spear")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-1.adlet_spear"), diff --git a/assets/common/entity/dungeon/tier-1/staff.ron b/assets/common/entity/dungeon/tier-1/staff.ron index 5591010069..1c9e8762f5 100644 --- a/assets/common/entity/dungeon/tier-1/staff.ron +++ b/assets/common/entity/dungeon/tier-1/staff.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-1.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.adlet.gnoll_staff")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.adlet.gnoll_staff")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-1.adlet_spear"), diff --git a/assets/common/entity/dungeon/tier-2/boss.ron b/assets/common/entity/dungeon/tier-2/boss.ron index d24afd982f..2139489071 100644 --- a/assets/common/entity/dungeon/tier-2/boss.ron +++ b/assets/common/entity/dungeon/tier-2/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-2.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-2/bow.ron b/assets/common/entity/dungeon/tier-2/bow.ron index e0cfe24086..7e6c2d6dbc 100644 --- a/assets/common/entity/dungeon/tier-2/bow.ron +++ b/assets/common/entity/dungeon/tier-2/bow.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-2.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.sahagin.adlet_bow")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.sahagin.adlet_bow")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-2.sahagin"), diff --git a/assets/common/entity/dungeon/tier-2/hakulaq.ron b/assets/common/entity/dungeon/tier-2/hakulaq.ron index 9ef070ab67..7f9199585a 100644 --- a/assets/common/entity/dungeon/tier-2/hakulaq.ron +++ b/assets/common/entity/dungeon/tier-2/hakulaq.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.creature.quad_low.fanged"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-2/spear.ron b/assets/common/entity/dungeon/tier-2/spear.ron index abc9b1b961..239162caf8 100644 --- a/assets/common/entity/dungeon/tier-2/spear.ron +++ b/assets/common/entity/dungeon/tier-2/spear.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-2.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.sahagin.wooden_spear")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.sahagin.wooden_spear")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-2.sahagin"), diff --git a/assets/common/entity/dungeon/tier-2/staff.ron b/assets/common/entity/dungeon/tier-2/staff.ron index b13508dd1b..cba57b3351 100644 --- a/assets/common/entity/dungeon/tier-2/staff.ron +++ b/assets/common/entity/dungeon/tier-2/staff.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-2.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.sahagin.gnoll_staff")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.sahagin.gnoll_staff")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-2.sahagin"), diff --git a/assets/common/entity/dungeon/tier-3/bonerattler.ron b/assets/common/entity/dungeon/tier-3/bonerattler.ron index ddbb8b5952..79d7c5e2d3 100644 --- a/assets/common/entity/dungeon/tier-3/bonerattler.ron +++ b/assets/common/entity/dungeon/tier-3/bonerattler.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.creature.quad_medium.carapace"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-3/boss.ron b/assets/common/entity/dungeon/tier-3/boss.ron index aea8d5cf91..a8b075c9b2 100644 --- a/assets/common/entity/dungeon/tier-3/boss.ron +++ b/assets/common/entity/dungeon/tier-3/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-3.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-3/bow.ron b/assets/common/entity/dungeon/tier-3/bow.ron index 24ceaabafd..445d697338 100644 --- a/assets/common/entity/dungeon/tier-3/bow.ron +++ b/assets/common/entity/dungeon/tier-3/bow.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-3.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.haniwa.adlet_bow")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.haniwa.adlet_bow")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-3.haniwa"), diff --git a/assets/common/entity/dungeon/tier-3/sentry.ron b/assets/common/entity/dungeon/tier-3/sentry.ron index 08cb3e73b7..43c519c834 100644 --- a/assets/common/entity/dungeon/tier-3/sentry.ron +++ b/assets/common/entity/dungeon/tier-3/sentry.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Item("common.items.crafting_ing.stones"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-3/spear.ron b/assets/common/entity/dungeon/tier-3/spear.ron index 38bdb85f0f..10614bd9c0 100644 --- a/assets/common/entity/dungeon/tier-3/spear.ron +++ b/assets/common/entity/dungeon/tier-3/spear.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-3.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.haniwa.wooden_spear")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.haniwa.wooden_spear")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-3.haniwa"), diff --git a/assets/common/entity/dungeon/tier-3/staff.ron b/assets/common/entity/dungeon/tier-3/staff.ron index 85aa5ea5a1..5066edc088 100644 --- a/assets/common/entity/dungeon/tier-3/staff.ron +++ b/assets/common/entity/dungeon/tier-3/staff.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-3.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.haniwa.gnoll_staff")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.haniwa.gnoll_staff")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-3.haniwa"), diff --git a/assets/common/entity/dungeon/tier-4/boss.ron b/assets/common/entity/dungeon/tier-4/boss.ron index c1f43f164c..0d4da80c24 100644 --- a/assets/common/entity/dungeon/tier-4/boss.ron +++ b/assets/common/entity/dungeon/tier-4/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-4.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-4/bow.ron b/assets/common/entity/dungeon/tier-4/bow.ron index 7e693009e0..a2a220054e 100644 --- a/assets/common/entity/dungeon/tier-4/bow.ron +++ b/assets/common/entity/dungeon/tier-4/bow.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-4.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.myrmidon.adlet_bow")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.myrmidon.adlet_bow")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-4.myrmidon"), diff --git a/assets/common/entity/dungeon/tier-4/miniboss.ron b/assets/common/entity/dungeon/tier-4/miniboss.ron index 23fc8f7ae2..ffe140c084 100644 --- a/assets/common/entity/dungeon/tier-4/miniboss.ron +++ b/assets/common/entity/dungeon/tier-4/miniboss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-4.miniboss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-4/spear.ron b/assets/common/entity/dungeon/tier-4/spear.ron index d0f2335239..1ebf5dec71 100644 --- a/assets/common/entity/dungeon/tier-4/spear.ron +++ b/assets/common/entity/dungeon/tier-4/spear.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-4.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.myrmidon.wooden_spear")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.myrmidon.wooden_spear")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-4.myrmidon"), diff --git a/assets/common/entity/dungeon/tier-4/staff.ron b/assets/common/entity/dungeon/tier-4/staff.ron index 9448b6e1a9..1f174c1924 100644 --- a/assets/common/entity/dungeon/tier-4/staff.ron +++ b/assets/common/entity/dungeon/tier-4/staff.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-4.enemy"), - main_tool: Some(Item("common.items.npc_weapons.biped_small.myrmidon.gnoll_staff")), - second_tool: None, + hands: TwoHanded(Item("common.items.npc_weapons.biped_small.myrmidon.gnoll_staff")), meta: [ LoadoutAsset("common.loadout.dungeon.tier-4.myrmidon"), diff --git a/assets/common/entity/dungeon/tier-5/beastmaster.ron b/assets/common/entity/dungeon/tier-5/beastmaster.ron index 76d28d1746..98c11b8d41 100644 --- a/assets/common/entity/dungeon/tier-5/beastmaster.ron +++ b/assets/common/entity/dungeon/tier-5/beastmaster.ron @@ -5,12 +5,11 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.miniboss"), - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.0, Some(Item("common.items.weapons.axe.malachite_axe-0"))), (1.0, Some(Item("common.items.weapons.sword.bloodsteel-1"))), (1.0, Some(Item("common.items.weapons.bow.velorite"))), ])), - second_tool: None, meta: [ LoadoutAsset("common.loadout.dungeon.tier-5.beastmaster"), diff --git a/assets/common/entity/dungeon/tier-5/boss.ron b/assets/common/entity/dungeon/tier-5/boss.ron index b2289aa240..ebeaebefec 100644 --- a/assets/common/entity/dungeon/tier-5/boss.ron +++ b/assets/common/entity/dungeon/tier-5/boss.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.boss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-5/cultist.ron b/assets/common/entity/dungeon/tier-5/cultist.ron index 8743a20285..1b6728c34f 100644 --- a/assets/common/entity/dungeon/tier-5/cultist.ron +++ b/assets/common/entity/dungeon/tier-5/cultist.ron @@ -5,7 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.enemy"), - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.0, Some(Item("common.items.weapons.axe_1h.orichalcum-0"))), (2.0, Some(Item("common.items.weapons.sword.cultist"))), (1.0, Some(Item("common.items.weapons.hammer.cultist_purp_2h-0"))), @@ -13,7 +13,6 @@ EntityConfig ( (1.0, Some(Item("common.items.weapons.bow.velorite"))), (1.0, Some(Item("common.items.weapons.sceptre.sceptre_velorite_0"))), ])), - second_tool: None, meta: [ LoadoutAsset("common.loadout.dungeon.tier-5.cultist"), diff --git a/assets/common/entity/dungeon/tier-5/hound.ron b/assets/common/entity/dungeon/tier-5/hound.ron index 81b37f01f4..0cbf1e7c8b 100644 --- a/assets/common/entity/dungeon/tier-5/hound.ron +++ b/assets/common/entity/dungeon/tier-5/hound.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.minion"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-5/husk.ron b/assets/common/entity/dungeon/tier-5/husk.ron index a7a00ab6a2..e68a99f04a 100644 --- a/assets/common/entity/dungeon/tier-5/husk.ron +++ b/assets/common/entity/dungeon/tier-5/husk.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.minion"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [ LoadoutAsset("common.loadout.dungeon.tier-5.husk"), diff --git a/assets/common/entity/dungeon/tier-5/husk_brute.ron b/assets/common/entity/dungeon/tier-5/husk_brute.ron index da3e55583c..7e77ad8aca 100644 --- a/assets/common/entity/dungeon/tier-5/husk_brute.ron +++ b/assets/common/entity/dungeon/tier-5/husk_brute.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.miniboss"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-5/turret.ron b/assets/common/entity/dungeon/tier-5/turret.ron index 3991d54909..9470ff47ac 100644 --- a/assets/common/entity/dungeon/tier-5/turret.ron +++ b/assets/common/entity/dungeon/tier-5/turret.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Item("common.items.crafting_ing.twigs"), - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-5/warlock.ron b/assets/common/entity/dungeon/tier-5/warlock.ron index 34c10532c5..3119ad911f 100644 --- a/assets/common/entity/dungeon/tier-5/warlock.ron +++ b/assets/common/entity/dungeon/tier-5/warlock.ron @@ -5,11 +5,10 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.enemy"), - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.5, Some(Item("common.items.npc_weapons.staff.bipedlarge-cultist"))), (1.0, Some(Item("common.items.npc_weapons.bow.bipedlarge-velorite"))), ])), - second_tool: None, meta: [], ) diff --git a/assets/common/entity/dungeon/tier-5/warlord.ron b/assets/common/entity/dungeon/tier-5/warlord.ron index 12a235ab97..07909a78df 100644 --- a/assets/common/entity/dungeon/tier-5/warlord.ron +++ b/assets/common/entity/dungeon/tier-5/warlord.ron @@ -5,11 +5,10 @@ EntityConfig ( loot: LootTable("common.loot_tables.dungeon.tier-5.enemy"), - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.5, Some(Item("common.items.npc_weapons.sword.bipedlarge-cultist"))), (1.0, Some(Item("common.items.npc_weapons.hammer.bipedlarge-cultist"))), ])), - second_tool: None, meta: [], ) diff --git a/assets/common/entity/test.ron b/assets/common/entity/template.ron similarity index 67% rename from assets/common/entity/test.ron rename to assets/common/entity/template.ron index f9ca26fe5d..0a35c81854 100644 --- a/assets/common/entity/test.ron +++ b/assets/common/entity/template.ron @@ -17,12 +17,16 @@ EntityConfig ( /// or Uninit (means it should be specified something in the code) loot: LootTable("common.loot_tables.humanoids"), - /// Main and second tools - /// Can be Option (with asset_specifier for item) - /// or Choice - /// (array of pairs with weight of choosing some item and Option) - main_tool: Some(Item("common.items.weapons.axe_1h.orichalcum-0")), - second_tool: None, + /// Hands: + /// - TwoHanded(ItemSpec) for one weapon 2h or 1h, + /// - Paired(ItemSpec) for two 1h weapons aka berserker mode, + /// - Mix { + /// mainhand: ItemSpec, + /// offhand: ItemSpec, + /// } for two different 1h weapons, + /// - Uninit which means that tool should be specified somewhere in code, + /// Where ItemSpec is taken from loadout_builder module + hands: TwoHanded(Item("common.items.weapons.sword.cultist")), /// Meta Info /// Possible fields: diff --git a/assets/common/entity/village/dummy.ron b/assets/common/entity/village/dummy.ron index 0c4d11eb4b..d9a83aa730 100644 --- a/assets/common/entity/village/dummy.ron +++ b/assets/common/entity/village/dummy.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/village/guard.ron b/assets/common/entity/village/guard.ron index 7aa5297040..d1b7cb2754 100644 --- a/assets/common/entity/village/guard.ron +++ b/assets/common/entity/village/guard.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: Some(Item("common.items.weapons.sword.iron-4")), - second_tool: None, + hands: TwoHanded(Item("common.items.weapons.sword.iron-4")), meta: [ SkillSetAsset("common.skillset.village.guard"), diff --git a/assets/common/entity/village/merchant.ron b/assets/common/entity/village/merchant.ron index 1c6c26fceb..09aaefc238 100644 --- a/assets/common/entity/village/merchant.ron +++ b/assets/common/entity/village/merchant.ron @@ -6,8 +6,7 @@ EntityConfig ( // considering giving some gold/gems/materials? loot: Uninit, - main_tool: Some(Item("common.items.weapons.bow.eldwood-0")), - second_tool: None, + hands: TwoHanded(Item("common.items.weapons.bow.eldwood-0")), meta: [ SkillSetAsset("common.skillset.village.merchant"), diff --git a/assets/common/entity/village/villager.ron b/assets/common/entity/village/villager.ron index 07100a4c2e..eb7e7fbe92 100644 --- a/assets/common/entity/village/villager.ron +++ b/assets/common/entity/village/villager.ron @@ -6,7 +6,7 @@ EntityConfig ( loot: Uninit, - main_tool: Some(Choice([ + hands: TwoHanded(Choice([ (1.0, Some(Item("common.items.weapons.tool.broom"))), (1.0, Some(Item("common.items.weapons.tool.hoe"))), (1.0, Some(Item("common.items.weapons.tool.pickaxe"))), @@ -14,7 +14,6 @@ EntityConfig ( (1.0, Some(Item("common.items.weapons.tool.shovel-0"))), (1.0, Some(Item("common.items.weapons.tool.shovel-1"))), ])), - second_tool: None, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/dreadhorn.ron b/assets/common/entity/wild/aggressive/dreadhorn.ron index 0ae6564a5d..e348d57ad5 100644 --- a/assets/common/entity/wild/aggressive/dreadhorn.ron +++ b/assets/common/entity/wild/aggressive/dreadhorn.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/frostfang.ron b/assets/common/entity/wild/aggressive/frostfang.ron index e0c62a02c6..f3c7376892 100644 --- a/assets/common/entity/wild/aggressive/frostfang.ron +++ b/assets/common/entity/wild/aggressive/frostfang.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/grolgar.ron b/assets/common/entity/wild/aggressive/grolgar.ron index 291c0e451d..47863b0fa8 100644 --- a/assets/common/entity/wild/aggressive/grolgar.ron +++ b/assets/common/entity/wild/aggressive/grolgar.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/mammoth.ron b/assets/common/entity/wild/aggressive/mammoth.ron index 12b75368a1..744cac3adb 100644 --- a/assets/common/entity/wild/aggressive/mammoth.ron +++ b/assets/common/entity/wild/aggressive/mammoth.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/mountain_troll.ron b/assets/common/entity/wild/aggressive/mountain_troll.ron index 9ca4bc236b..8aad271d4c 100644 --- a/assets/common/entity/wild/aggressive/mountain_troll.ron +++ b/assets/common/entity/wild/aggressive/mountain_troll.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/rocksnapper.ron b/assets/common/entity/wild/aggressive/rocksnapper.ron index d4225eb7ef..089828f836 100644 --- a/assets/common/entity/wild/aggressive/rocksnapper.ron +++ b/assets/common/entity/wild/aggressive/rocksnapper.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/roshwalr.ron b/assets/common/entity/wild/aggressive/roshwalr.ron index a68d735114..cda5c15ee3 100644 --- a/assets/common/entity/wild/aggressive/roshwalr.ron +++ b/assets/common/entity/wild/aggressive/roshwalr.ron @@ -8,8 +8,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/snow_leopard.ron b/assets/common/entity/wild/aggressive/snow_leopard.ron index fa62cf44b6..95e9d44d22 100644 --- a/assets/common/entity/wild/aggressive/snow_leopard.ron +++ b/assets/common/entity/wild/aggressive/snow_leopard.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/snow_raptor.ron b/assets/common/entity/wild/aggressive/snow_raptor.ron index f727af4abd..53cfcc3726 100644 --- a/assets/common/entity/wild/aggressive/snow_raptor.ron +++ b/assets/common/entity/wild/aggressive/snow_raptor.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/wendigo.ron b/assets/common/entity/wild/aggressive/wendigo.ron index 465167c043..9cae3b1e53 100644 --- a/assets/common/entity/wild/aggressive/wendigo.ron +++ b/assets/common/entity/wild/aggressive/wendigo.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/wolf.ron b/assets/common/entity/wild/aggressive/wolf.ron index a2e50a60bd..b343a1c642 100644 --- a/assets/common/entity/wild/aggressive/wolf.ron +++ b/assets/common/entity/wild/aggressive/wolf.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/aggressive/yale.ron b/assets/common/entity/wild/aggressive/yale.ron index 0e13c5a8be..fafe4c20c9 100644 --- a/assets/common/entity/wild/aggressive/yale.ron +++ b/assets/common/entity/wild/aggressive/yale.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/alpaca.ron b/assets/common/entity/wild/peaceful/alpaca.ron index b737205ca1..d29584c4f7 100644 --- a/assets/common/entity/wild/peaceful/alpaca.ron +++ b/assets/common/entity/wild/peaceful/alpaca.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/arctic_fox.ron b/assets/common/entity/wild/peaceful/arctic_fox.ron index 9e455bc0c6..45816ff39b 100644 --- a/assets/common/entity/wild/peaceful/arctic_fox.ron +++ b/assets/common/entity/wild/peaceful/arctic_fox.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/arctic_hare.ron b/assets/common/entity/wild/peaceful/arctic_hare.ron index 0b24333750..2e4265de09 100644 --- a/assets/common/entity/wild/peaceful/arctic_hare.ron +++ b/assets/common/entity/wild/peaceful/arctic_hare.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/eagle.ron b/assets/common/entity/wild/peaceful/eagle.ron index 61bf290111..aae26839af 100644 --- a/assets/common/entity/wild/peaceful/eagle.ron +++ b/assets/common/entity/wild/peaceful/eagle.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/highland.ron b/assets/common/entity/wild/peaceful/highland.ron index 7a6ab8fde9..3ddd070faf 100644 --- a/assets/common/entity/wild/peaceful/highland.ron +++ b/assets/common/entity/wild/peaceful/highland.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/llama.ron b/assets/common/entity/wild/peaceful/llama.ron index c4d0373547..2ca5721c68 100644 --- a/assets/common/entity/wild/peaceful/llama.ron +++ b/assets/common/entity/wild/peaceful/llama.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/moose.ron b/assets/common/entity/wild/peaceful/moose.ron index 7bdab79760..f720464d76 100644 --- a/assets/common/entity/wild/peaceful/moose.ron +++ b/assets/common/entity/wild/peaceful/moose.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/mouflon.ron b/assets/common/entity/wild/peaceful/mouflon.ron index 55982414a8..940edec652 100644 --- a/assets/common/entity/wild/peaceful/mouflon.ron +++ b/assets/common/entity/wild/peaceful/mouflon.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/owl.ron b/assets/common/entity/wild/peaceful/owl.ron index 74c918bb4a..f4cfc3118a 100644 --- a/assets/common/entity/wild/peaceful/owl.ron +++ b/assets/common/entity/wild/peaceful/owl.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/tuskram.ron b/assets/common/entity/wild/peaceful/tuskram.ron index 672dc221cf..bd4bc62f6c 100644 --- a/assets/common/entity/wild/peaceful/tuskram.ron +++ b/assets/common/entity/wild/peaceful/tuskram.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/assets/common/entity/wild/peaceful/yak.ron b/assets/common/entity/wild/peaceful/yak.ron index 702cf18607..32ffaba58b 100644 --- a/assets/common/entity/wild/peaceful/yak.ron +++ b/assets/common/entity/wild/peaceful/yak.ron @@ -5,8 +5,7 @@ EntityConfig ( loot: Uninit, - main_tool: None, - second_tool: None, + hands: Uninit, meta: [], ) diff --git a/common/src/comp/inventory/loadout_builder.rs b/common/src/comp/inventory/loadout_builder.rs index 9e1a5da439..7051349812 100644 --- a/common/src/comp/inventory/loadout_builder.rs +++ b/common/src/comp/inventory/loadout_builder.rs @@ -92,17 +92,26 @@ impl ItemSpec { /// /// # Panics /// 1) If weights are invalid - pub fn validate(&self, key: EquipSlot) { + /// 2) If item doesn't correspond to `EquipSlot` + pub fn validate(&self, equip_slot: EquipSlot) { match self { - ItemSpec::Item(specifier) => std::mem::drop(Item::new_from_asset_expect(specifier)), + ItemSpec::Item(specifier) => { + let item = Item::new_from_asset_expect(specifier); + if !equip_slot.can_hold(&item.kind) { + panic!("Tried to place {} into {:?}", specifier, equip_slot); + } + std::mem::drop(item); + }, ItemSpec::Choice(items) => { for (p, entry) in items { if p <= &0.0 { - let err = - format!("Weight is less or equal to 0.0.\n ({:?}: {:?})", key, self,); + let err = format!( + "Weight is less or equal to 0.0.\n ({:?}: {:?})", + equip_slot, self + ); panic!("\n\n{}\n\n", err); } else { - entry.as_ref().map(|e| e.validate(key)); + entry.as_ref().map(|e| e.validate(equip_slot)); } } }, @@ -389,13 +398,13 @@ impl LoadoutBuilder { .with_default_equipment(body) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] /// Set default active mainhand weapon based on `body` pub fn with_default_maintool(self, body: &Body) -> Self { self.active_mainhand(Some(default_main_tool(body))) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] /// Set default equipement based on `body` pub fn with_default_equipment(self, body: &Body) -> Self { let chest = match body { @@ -466,7 +475,7 @@ impl LoadoutBuilder { } } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn with_preset(mut self, preset: Preset) -> Self { let rng = &mut rand::thread_rng(); match preset { @@ -478,7 +487,7 @@ impl LoadoutBuilder { self } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn with_creator( mut self, creator: fn(LoadoutBuilder, Option<&SiteInformation>) -> LoadoutBuilder, @@ -497,7 +506,7 @@ impl LoadoutBuilder { /// 1) Will panic if there is no asset with such `asset_specifier` /// 2) Will panic if path to item specified in loadout file doesn't exist /// 3) Will panic while runs in tests and asset doesn't have "correct" form - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn with_asset_expect(mut self, asset_specifier: &str, rng: &mut impl Rng) -> Self { let spec = LoadoutSpec::load_expect(asset_specifier).read().0.clone(); for (key, entry) in spec { @@ -573,88 +582,96 @@ impl LoadoutBuilder { /// Set default armor items for the loadout. This may vary with game /// updates, but should be safe defaults for a new character. - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn defaults(self) -> Self { let rng = &mut rand::thread_rng(); self.with_asset_expect("common.loadout.default", rng) } + #[must_use = "Method consumes builder and returns updated builder."] fn with_equipment(mut self, equip_slot: EquipSlot, item: Option) -> Self { + // Panic if item doesn't correspond to slot + assert!( + item.as_ref() + .map_or(true, |item| equip_slot.can_hold(&item.kind)) + ); + self.0.swap(equip_slot, item); self } - #[must_use] - pub fn active_mainhand(self, item: Option) -> Self { - self.with_equipment(EquipSlot::ActiveMainhand, item) - } - - #[must_use] - pub fn active_offhand(self, item: Option) -> Self { - self.with_equipment(EquipSlot::ActiveOffhand, item) - } - - #[must_use] - pub fn inactive_mainhand(self, item: Option) -> Self { - self.with_equipment(EquipSlot::InactiveMainhand, item) - } - - #[must_use] - pub fn inactive_offhand(self, item: Option) -> Self { - self.with_equipment(EquipSlot::InactiveOffhand, item) - } - + #[must_use = "Method consumes builder and returns updated builder."] fn with_armor(self, armor_slot: ArmorSlot, item: Option) -> Self { self.with_equipment(EquipSlot::Armor(armor_slot), item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] + pub fn active_mainhand(self, item: Option) -> Self { + self.with_equipment(EquipSlot::ActiveMainhand, item) + } + + #[must_use = "Method consumes builder and returns updated builder."] + pub fn active_offhand(self, item: Option) -> Self { + self.with_equipment(EquipSlot::ActiveOffhand, item) + } + + #[must_use = "Method consumes builder and returns updated builder."] + pub fn inactive_mainhand(self, item: Option) -> Self { + self.with_equipment(EquipSlot::InactiveMainhand, item) + } + + #[must_use = "Method consumes builder and returns updated builder."] + pub fn inactive_offhand(self, item: Option) -> Self { + self.with_equipment(EquipSlot::InactiveOffhand, item) + } + + #[must_use = "Method consumes builder and returns updated builder."] pub fn shoulder(self, item: Option) -> Self { self.with_armor(ArmorSlot::Shoulders, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn chest(self, item: Option) -> Self { self.with_armor(ArmorSlot::Chest, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn belt(self, item: Option) -> Self { self.with_armor(ArmorSlot::Belt, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn hands(self, item: Option) -> Self { self.with_armor(ArmorSlot::Hands, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn pants(self, item: Option) -> Self { self.with_armor(ArmorSlot::Legs, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn feet(self, item: Option) -> Self { self.with_armor(ArmorSlot::Feet, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn back(self, item: Option) -> Self { self.with_armor(ArmorSlot::Back, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn ring1(self, item: Option) -> Self { self.with_armor(ArmorSlot::Ring1, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn ring2(self, item: Option) -> Self { self.with_armor(ArmorSlot::Ring2, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn neck(self, item: Option) -> Self { self.with_armor(ArmorSlot::Neck, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn lantern(self, item: Option) -> Self { self.with_equipment(EquipSlot::Lantern, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn glider(self, item: Option) -> Self { self.with_equipment(EquipSlot::Glider, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn head(self, item: Option) -> Self { self.with_armor(ArmorSlot::Head, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn tabard(self, item: Option) -> Self { self.with_armor(ArmorSlot::Tabard, item) } - #[must_use] + #[must_use = "Method consumes builder and returns updated builder."] pub fn bag(self, which: ArmorSlot, item: Option) -> Self { self.with_armor(which, item) } #[must_use] diff --git a/common/src/generation.rs b/common/src/generation.rs index 9c6e6f4b9b..32b7fde77b 100644 --- a/common/src/generation.rs +++ b/common/src/generation.rs @@ -40,14 +40,23 @@ enum Meta { } #[derive(Debug, Deserialize, Clone)] -struct EntityConfig { +enum Hands { + TwoHanded(ItemSpec), + Paired(ItemSpec), + Mix { + mainhand: ItemSpec, + offhand: ItemSpec, + }, + Uninit, +} + +#[derive(Debug, Deserialize, Clone)] +pub struct EntityConfig { name: Option, body: BodyBuilder, alignment: AlignmentMark, loot: LootKind, - // TODO: replace with `hands` field to support one 2h weapon/ pair 1h weapons - main_tool: Option, - second_tool: Option, + hands: Hands, // Meta fields meta: Vec, } @@ -58,6 +67,13 @@ impl assets::Asset for EntityConfig { const EXTENSION: &'static str = "ron"; } +impl EntityConfig { + pub fn from_asset_expect(asset_specifier: &str) -> EntityConfig { + Self::load_owned(asset_specifier) + .unwrap_or_else(|e| panic!("Failed to load {}. Error: {}", asset_specifier, e)) + } +} + #[derive(Clone)] pub struct EntityInfo { pub pos: Vec3, @@ -114,14 +130,13 @@ impl EntityInfo { } // helper function to apply config - fn with_entity_config(mut self, config: EntityConfig, asset_specifier: Option<&str>) -> Self { + fn with_entity_config(mut self, config: EntityConfig, config_asset: Option<&str>) -> Self { let EntityConfig { name, body, alignment, loot, - main_tool, - second_tool, + hands, meta, } = config; @@ -161,15 +176,36 @@ impl EntityInfo { } let rng = &mut rand::thread_rng(); - if let Some(main_tool) = - main_tool.and_then(|i| i.try_to_item(asset_specifier.unwrap_or("??"), rng)) - { - self = self.with_main_tool(main_tool); - } - if let Some(second_tool) = - second_tool.and_then(|i| i.try_to_item(asset_specifier.unwrap_or("??"), rng)) - { - self = self.with_main_tool(second_tool); + match hands { + Hands::TwoHanded(main_tool) => { + let tool = main_tool.try_to_item(config_asset.unwrap_or("??"), rng); + if let Some(tool) = tool { + self = self.with_main_tool(tool); + } + }, + Hands::Paired(tool) => { + //FIXME: very stupid code, which just tries same item two times + //figure out reasonable way to clone item + let main_tool = tool.try_to_item(config_asset.unwrap_or("??"), rng); + let second_tool = tool.try_to_item(config_asset.unwrap_or("??"), rng); + if let Some(main_tool) = main_tool { + self = self.with_main_tool(main_tool); + } + if let Some(second_tool) = second_tool { + self = self.with_second_tool(second_tool); + } + }, + Hands::Mix { mainhand, offhand } => { + let main_tool = mainhand.try_to_item(config_asset.unwrap_or("??"), rng); + let second_tool = offhand.try_to_item(config_asset.unwrap_or("??"), rng); + if let Some(main_tool) = main_tool { + self = self.with_main_tool(main_tool); + } + if let Some(second_tool) = second_tool { + self = self.with_second_tool(second_tool); + } + }, + Hands::Uninit => {}, } for field in meta { @@ -337,24 +373,32 @@ mod tests { #[test] fn test_all_entity_assets() { // It just load everything that could - let entity_configs = assets::read_expect_dir::("common.entity", true); - for config in entity_configs { + let entity_configs = assets::load_dir::("common.entity", true) + .expect("Failed to access entity directory"); + for config_asset in entity_configs.ids() { + println!("{}:", config_asset); let EntityConfig { - main_tool, - second_tool, + hands, loot, body, meta, name: _name, // can't fail if serialized, it's a boring String alignment: _alignment, // can't fail if serialized, it's a boring enum - } = config.clone(); + } = EntityConfig::from_asset_expect(config_asset); - if let Some(main_tool) = main_tool { - main_tool.validate(EquipSlot::ActiveMainhand); - } - - if let Some(second_tool) = second_tool { - second_tool.validate(EquipSlot::ActiveOffhand); + match hands { + Hands::TwoHanded(main_tool) => { + main_tool.validate(EquipSlot::ActiveMainhand); + }, + Hands::Paired(tool) => { + tool.validate(EquipSlot::ActiveMainhand); + tool.validate(EquipSlot::ActiveOffhand); + }, + Hands::Mix { mainhand, offhand } => { + mainhand.validate(EquipSlot::ActiveMainhand); + offhand.validate(EquipSlot::ActiveOffhand); + }, + Hands::Uninit => {}, } match body {