Successful build

This commit is contained in:
AdamWhitehurst 2019-12-30 05:56:42 -08:00
parent 9c6ce9babd
commit ba7ca785f6
12 changed files with 86 additions and 81 deletions

View File

@ -3,7 +3,9 @@ Item(
description: "The sky is the limit.", description: "The sky is the limit.",
kind: Tool( kind: Tool(
kind: Debug(Boost), kind: Debug(Boost),
power: 0, equip_time_millis: 0,
attack_buildup_millis: 0,
attack_recover_millis: 0,
), ),
) )
// And the ground is pretty hard at maximum velocity... // And the ground is pretty hard at maximum velocity...

View File

@ -3,7 +3,9 @@ Item(
description: "It's fixed on my branch.", description: "It's fixed on my branch.",
kind: Tool( kind: Tool(
kind: Debug(Possess), kind: Debug(Possess),
power: 0, equip_time_millis: 0,
attack_buildup_millis: 0,
attack_recover_millis: 0,
), ),
) )
// ... as zesterer always uses to tell us. // ... as zesterer always uses to tell us.

View File

@ -7,7 +7,7 @@ use std::time::Duration;
#[derive(Clone, Copy, Default, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)] #[derive(Clone, Copy, Default, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct BasicAttackState { pub struct BasicAttackState {
/// How long the state has until exitting /// How long the state has until exitting
remaining_duration: Duration, pub remaining_duration: Duration,
} }
impl StateHandle for BasicAttackState { impl StateHandle for BasicAttackState {

View File

@ -7,7 +7,7 @@ use vek::Vec2;
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct BasicBlockState { pub struct BasicBlockState {
/// How long the blocking state has been active /// How long the blocking state has been active
active_duration: Duration, pub active_duration: Duration,
} }
impl StateHandle for BasicBlockState { impl StateHandle for BasicBlockState {

View File

@ -1,4 +1,5 @@
use crate::comp::{ActionState::*, EcsStateData, IdleState, StateHandle, StateUpdate}; use crate::comp::{ActionState::*, EcsStateData, IdleState, StateHandle, StateUpdate};
use crate::util::movement_utils::*;
use std::time::Duration; use std::time::Duration;
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
@ -29,7 +30,7 @@ impl StateHandle for WieldState {
// Try weapon actions // Try weapon actions
if ecs_data.inputs.primary.is_pressed() { if ecs_data.inputs.primary.is_pressed() {
// TODO: PrimaryStart update.character.action_state = determine_primary_ability(ecs_data.stats);
} else if ecs_data.inputs.secondary.is_pressed() { } else if ecs_data.inputs.secondary.is_pressed() {
// TODO: SecondaryStart // TODO: SecondaryStart
} }

View File

@ -25,7 +25,7 @@ pub fn determine_primary_ability(stats: &Stats) -> ActionState {
pub fn determine_secondary_ability(stats: &Stats) -> ActionState { pub fn determine_secondary_ability(stats: &Stats) -> ActionState {
if let Some(Tool(data)) = stats.equipment.main.as_ref().map(|i| &i.kind) { if let Some(Tool(data)) = stats.equipment.main.as_ref().map(|i| &i.kind) {
Block(BasicBlock(BasicBlockState { Block(BasicBlock(BasicBlockState {
active_duration:: Duration::default(), active_duration: Duration::default(),
})) }))
} else { } else {
Idle(IdleState) Idle(IdleState)

View File

@ -11,7 +11,7 @@ pub mod quadruped_medium;
pub mod quadruped_small; pub mod quadruped_small;
use crate::render::FigureBoneData; use crate::render::FigureBoneData;
use common::comp::{self, item::Tool}; use common::comp::{self, ToolKind};
use vek::*; use vek::*;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
@ -158,27 +158,27 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
(Danari, Male) => 0.0, (Danari, Male) => 0.0,
(Danari, Female) => 0.0, (Danari, Female) => 0.0,
}, },
weapon_x: match Tool::Hammer { weapon_x: match ToolKind::Hammer {
// TODO: Inventory // TODO: Inventory
Tool::Sword => 0.0, ToolKind::Sword(_) => 0.0,
Tool::Axe => 3.0, ToolKind::Axe => 3.0,
Tool::Hammer => 0.0, ToolKind::Hammer => 0.0,
Tool::Shield => 3.0, ToolKind::Shield => 3.0,
Tool::Staff => 3.0, ToolKind::Staff => 3.0,
Tool::Bow => 0.0, ToolKind::Bow => 0.0,
Tool::Dagger => 0.0, ToolKind::Dagger => 0.0,
Tool::Debug(_) => 0.0, ToolKind::Debug(_) => 0.0,
}, },
weapon_y: match Tool::Hammer { weapon_y: match ToolKind::Hammer {
// TODO: Inventory // TODO: Inventory
Tool::Sword => -1.25, ToolKind::Sword(_) => -1.25,
Tool::Axe => 0.0, ToolKind::Axe => 0.0,
Tool::Hammer => -2.0, ToolKind::Hammer => -2.0,
Tool::Shield => 0.0, ToolKind::Shield => 0.0,
Tool::Staff => 0.0, ToolKind::Staff => 0.0,
Tool::Bow => -2.0, ToolKind::Bow => -2.0,
Tool::Dagger => -2.0, ToolKind::Dagger => -2.0,
Tool::Debug(_) => 0.0, ToolKind::Debug(_) => 0.0,
}, },
} }
} }

View File

@ -7,7 +7,7 @@ use common::{
comp::{ comp::{
ActionState, AttackKind::*, BasicAttackState, Body, CharacterState, DodgeKind::*, ActionState, AttackKind::*, BasicAttackState, Body, CharacterState, DodgeKind::*,
FallState, GlideState, IdleState, ItemKind, MoveState, Pos, RollState, RunState, FallState, GlideState, IdleState, ItemKind, MoveState, Pos, RollState, RunState,
StandState, Stats, StandState, Stats, ToolData,
}, },
event::{EventBus, SfxEvent, SfxEventItem}, event::{EventBus, SfxEvent, SfxEventItem},
}; };
@ -183,7 +183,7 @@ impl SfxEventMapper {
} }
(_, ActionState::Attack { .. }, _, stats) => { (_, ActionState::Attack { .. }, _, stats) => {
match &stats.equipment.main.as_ref().map(|i| &i.kind) { match &stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => SfxEvent::Attack(*kind), Some(ItemKind::Tool(ToolData { kind, .. })) => SfxEvent::Attack(*kind),
_ => SfxEvent::Idle, _ => SfxEvent::Idle,
} }
} }
@ -197,7 +197,7 @@ mod tests {
use super::*; use super::*;
use common::{ use common::{
assets, assets,
comp::{item::Tool, ActionState, MoveState, Stats}, comp::{ActionState, MoveState, Stats},
event::SfxEvent, event::SfxEvent,
}; };
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};

View File

@ -1,7 +1,7 @@
use crate::ui::{Graphic, Transform, Ui}; use crate::ui::{Graphic, Transform, Ui};
use common::{ use common::{
assets::{self, watch::ReloadIndicator, Asset}, assets::{self, watch::ReloadIndicator, Asset},
comp::item::{Armor, Consumable, Ingredient, Item, ItemKind, Tool}, comp::item::{Armor, Consumable, Ingredient, Item, ItemKind, ToolData, ToolKind},
}; };
use conrod_core::image::Id; use conrod_core::image::Id;
use dot_vox::DotVoxData; use dot_vox::DotVoxData;
@ -14,7 +14,7 @@ use vek::*;
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ItemKey { pub enum ItemKey {
Tool(Tool), Tool(ToolKind),
Armor(Armor), Armor(Armor),
Consumable(Consumable), Consumable(Consumable),
Ingredient(Ingredient), Ingredient(Ingredient),
@ -22,7 +22,7 @@ pub enum ItemKey {
impl From<&Item> for ItemKey { impl From<&Item> for ItemKey {
fn from(item: &Item) -> Self { fn from(item: &Item) -> Self {
match &item.kind { match &item.kind {
ItemKind::Tool { kind, .. } => ItemKey::Tool(kind.clone()), ItemKind::Tool(ToolData { kind, .. }) => ItemKey::Tool(kind.clone()),
ItemKind::Armor { kind, .. } => ItemKey::Armor(kind.clone()), ItemKind::Armor { kind, .. } => ItemKey::Armor(kind.clone()),
ItemKind::Consumable { kind, .. } => ItemKey::Consumable(kind.clone()), ItemKind::Consumable { kind, .. } => ItemKey::Consumable(kind.clone()),
ItemKind::Ingredient(kind) => ItemKey::Ingredient(kind.clone()), ItemKind::Ingredient(kind) => ItemKey::Ingredient(kind.clone()),

View File

@ -3,7 +3,7 @@ use super::{
/*FOCUS_COLOR, RAGE_COLOR,*/ HP_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR, /*FOCUS_COLOR, RAGE_COLOR,*/ HP_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR,
}; };
use crate::GlobalState; use crate::GlobalState;
use common::comp::{item::Debug, item::Tool, ItemKind, Stats}; use common::comp::{item::Debug, item::ToolData, item::ToolKind, Equipment, ItemKind, Stats};
use conrod_core::{ use conrod_core::{
color, color,
widget::{self, Button, Image, Rectangle, Text}, widget::{self, Button, Image, Rectangle, Text},
@ -105,10 +105,10 @@ impl<'a> Skillbar<'a> {
stats: &'a Stats, stats: &'a Stats,
) -> Self { ) -> Self {
Self { Self {
imgs,
fonts: fonts,
stats,
global_state, global_state,
imgs,
fonts,
stats,
current_resource: ResourceType::Mana, current_resource: ResourceType::Mana,
common: widget::CommonBuilder::default(), common: widget::CommonBuilder::default(),
} }
@ -506,9 +506,9 @@ impl<'a> Widget for Skillbar<'a> {
Image::new(self.imgs.skillbar_slot_big_bg) Image::new(self.imgs.skillbar_slot_big_bg)
.w_h(36.0 * scale, 36.0 * scale) .w_h(36.0 * scale, 36.0 * scale)
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => Some(BG_COLOR_2), ToolKind::Bow => Some(BG_COLOR_2),
Tool::Staff => Some(BG_COLOR_2), ToolKind::Staff => Some(BG_COLOR_2),
_ => Some(BG_COLOR_2), _ => Some(BG_COLOR_2),
}, },
_ => Some(BG_COLOR_2), _ => Some(BG_COLOR_2),
@ -516,29 +516,29 @@ impl<'a> Widget for Skillbar<'a> {
.middle_of(state.ids.m1_slot) .middle_of(state.ids.m1_slot)
.set(state.ids.m1_slot_bg, ui); .set(state.ids.m1_slot_bg, ui);
Button::image(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { Button::image(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Sword => self.imgs.twohsword_m1, ToolKind::Sword(_) => self.imgs.twohsword_m1,
Tool::Hammer => self.imgs.twohhammer_m1, ToolKind::Hammer => self.imgs.twohhammer_m1,
Tool::Axe => self.imgs.twohaxe_m1, ToolKind::Axe => self.imgs.twohaxe_m1,
Tool::Bow => self.imgs.bow_m1, ToolKind::Bow => self.imgs.bow_m1,
Tool::Staff => self.imgs.staff_m1, ToolKind::Staff => self.imgs.staff_m1,
Tool::Debug(Debug::Boost) => self.imgs.flyingrod_m1, ToolKind::Debug(Debug::Boost) => self.imgs.flyingrod_m1,
_ => self.imgs.twohaxe_m1, _ => self.imgs.twohaxe_m1,
}, },
_ => self.imgs.twohaxe_m1, _ => self.imgs.twohaxe_m1,
}) // Insert Icon here }) // Insert Icon here
.w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => 30.0 * scale, ToolKind::Bow => 30.0 * scale,
Tool::Staff => 30.0 * scale, ToolKind::Staff => 30.0 * scale,
_ => 38.0 * scale, _ => 38.0 * scale,
}, },
_ => 38.0 * scale, _ => 38.0 * scale,
}) })
.h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => 30.0 * scale, ToolKind::Bow => 30.0 * scale,
Tool::Staff => 36.0 * scale, ToolKind::Staff => 36.0 * scale,
_ => 38.0 * scale, _ => 38.0 * scale,
}, },
_ => 38.0 * scale, _ => 38.0 * scale,
@ -553,9 +553,9 @@ impl<'a> Widget for Skillbar<'a> {
Image::new(self.imgs.skillbar_slot_big_bg) Image::new(self.imgs.skillbar_slot_big_bg)
.w_h(36.0 * scale, 36.0 * scale) .w_h(36.0 * scale, 36.0 * scale)
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => Some(BG_COLOR_2), ToolKind::Bow => Some(BG_COLOR_2),
Tool::Staff => Some(BG_COLOR_2), ToolKind::Staff => Some(BG_COLOR_2),
_ => Some(BG_COLOR_2), _ => Some(BG_COLOR_2),
}, },
_ => Some(BG_COLOR_2), _ => Some(BG_COLOR_2),
@ -563,29 +563,29 @@ impl<'a> Widget for Skillbar<'a> {
.middle_of(state.ids.m2_slot) .middle_of(state.ids.m2_slot)
.set(state.ids.m2_slot_bg, ui); .set(state.ids.m2_slot_bg, ui);
Button::image(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { Button::image(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Sword => self.imgs.twohsword_m2, ToolKind::Sword(_) => self.imgs.twohsword_m2,
Tool::Hammer => self.imgs.twohhammer_m2, ToolKind::Hammer => self.imgs.twohhammer_m2,
Tool::Axe => self.imgs.twohaxe_m2, ToolKind::Axe => self.imgs.twohaxe_m2,
Tool::Bow => self.imgs.bow_m2, ToolKind::Bow => self.imgs.bow_m2,
Tool::Staff => self.imgs.staff_m2, ToolKind::Staff => self.imgs.staff_m2,
Tool::Debug(Debug::Boost) => self.imgs.flyingrod_m2, ToolKind::Debug(Debug::Boost) => self.imgs.flyingrod_m2,
_ => self.imgs.twohaxe_m2, _ => self.imgs.twohaxe_m2,
}, },
_ => self.imgs.twohaxe_m2, _ => self.imgs.twohaxe_m2,
}) // Insert Icon here }) // Insert Icon here
.w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => 30.0 * scale, ToolKind::Bow => 30.0 * scale,
Tool::Staff => 30.0 * scale, ToolKind::Staff => 30.0 * scale,
_ => 38.0 * scale, _ => 38.0 * scale,
}, },
_ => 38.0 * scale, _ => 38.0 * scale,
}) })
.h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) { .h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
Some(ItemKind::Tool { kind, .. }) => match kind { Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
Tool::Bow => 30.0 * scale, ToolKind::Bow => 30.0 * scale,
Tool::Staff => 30.0 * scale, ToolKind::Staff => 30.0 * scale,
_ => 38.0 * scale, _ => 38.0 * scale,
}, },
_ => 38.0 * scale, _ => 38.0 * scale,

View File

@ -10,7 +10,7 @@ use common::{
humanoid::{ humanoid::{
Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin,
}, },
item::Tool, item::{ToolData, ToolKind},
object, quadruped_medium, quadruped_small, Item, ItemKind, object, quadruped_medium, quadruped_small, Item, ItemKind,
}, },
figure::{DynaUnionizer, MatSegment, Material, Segment}, figure::{DynaUnionizer, MatSegment, Material, Segment},
@ -513,15 +513,15 @@ impl HumArmorFootSpec {
pub fn mesh_main(item: Option<&Item>) -> Mesh<FigurePipeline> { pub fn mesh_main(item: Option<&Item>) -> Mesh<FigurePipeline> {
if let Some(item) = item { if let Some(item) = item {
let (name, offset) = match item.kind { let (name, offset) = match item.kind {
ItemKind::Tool { kind, .. } => match kind { ItemKind::Tool(ToolData { kind, .. }) => match kind {
Tool::Sword => ("weapon.sword.rusty_2h", Vec3::new(-1.5, -6.5, -4.0)), ToolKind::Sword(_) => ("weapon.sword.rusty_2h", Vec3::new(-1.5, -6.5, -4.0)),
Tool::Axe => ("weapon.axe.rusty_2h", Vec3::new(-1.5, -5.0, -4.0)), ToolKind::Axe => ("weapon.axe.rusty_2h", Vec3::new(-1.5, -5.0, -4.0)),
Tool::Hammer => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)), ToolKind::Hammer => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Dagger => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)), ToolKind::Dagger => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Shield => ("weapon.axe.rusty_2h", Vec3::new(-2.5, -6.5, -2.0)), ToolKind::Shield => ("weapon.axe.rusty_2h", Vec3::new(-2.5, -6.5, -2.0)),
Tool::Bow => ("weapon.bow.simple-bow", Vec3::new(-1.0, -6.0, -2.0)), ToolKind::Bow => ("weapon.bow.simple-bow", Vec3::new(-1.0, -6.0, -2.0)),
Tool::Staff => ("weapon.staff.wood-fire", Vec3::new(-1.0, -6.0, -3.0)), ToolKind::Staff => ("weapon.staff.wood-fire", Vec3::new(-1.0, -6.0, -3.0)),
Tool::Debug(_) => ("weapon.debug_wand", Vec3::new(-1.5, -9.5, -4.0)), ToolKind::Debug(_) => ("weapon.debug_wand", Vec3::new(-1.5, -9.5, -4.0)),
}, },
_ => return Mesh::new(), _ => return Mesh::new(),
}; };

View File

@ -19,7 +19,7 @@ use client::Client;
use common::{ use common::{
comp::{ comp::{
ActionState::*, AttackKind::*, Body, CharacterState, ItemKind, Last, MoveState::*, Ori, ActionState::*, AttackKind::*, Body, CharacterState, ItemKind, Last, MoveState::*, Ori,
Pos, Scale, Stats, Vel, Pos, Scale, Stats, ToolData, Vel,
}, },
terrain::TerrainChunk, terrain::TerrainChunk,
vol::RectRasterableVol, vol::RectRasterableVol,
@ -169,7 +169,7 @@ impl FigureMgr {
.cloned() .cloned()
.unwrap_or_default(); .unwrap_or_default();
let active_tool_kind = if let Some(ItemKind::Tool { kind, .. }) = stats let active_tool_kind = if let Some(ItemKind::Tool(ToolData { kind, .. })) = stats
.and_then(|s| s.equipment.main.as_ref()) .and_then(|s| s.equipment.main.as_ref())
.map(|i| &i.kind) .map(|i| &i.kind)
{ {