Implement modular weapons.

- Add ItemKind::ModularComponent, Item::components.
- Add tool::StatKind::{Direct,Modular} for the modular weapons themselves.
- Move ItemConfig from ItemDesc to Item, so components' stats can be taken into account.
- Crafting stores into the components field.
- Components/recipes/placeholders are created dynamically.
- Show which components a modular weapon contains in the tooltip in voxygen.

Squashed fixes:
- `Item::duplicate` components in `Item::new_from_item_def`.
- Speed of 1.0 for now.
This commit is contained in:
Avi Weinstock
2021-02-16 23:23:08 -05:00
parent 63c72f77f1
commit 8bdbf4f7c9
187 changed files with 959 additions and 489 deletions

View File

@ -294,14 +294,14 @@ pub fn handle_wield(data: &JoinData, update: &mut StateUpdate) {
/// If a tool is equipped, goes into Equipping state, otherwise goes to Idle
pub fn attempt_wield(data: &JoinData, update: &mut StateUpdate) {
if let Some(ItemKind::Tool(tool)) = data
if let Some((item, ItemKind::Tool(tool))) = data
.inventory
.equipped(EquipSlot::Mainhand)
.map(|i| i.kind())
.map(|i| (i, i.kind()))
{
update.character = CharacterState::Equipping(equipping::Data {
static_data: equipping::StaticData {
buildup_duration: tool.equip_time(),
buildup_duration: tool.equip_time(item.components()),
},
timer: Duration::default(),
});