Merge branch 'floppy-music-instruments' into 'master'

Music Instruments

See merge request veloren/veloren!3535
This commit is contained in:
Samuel Keiffer 2022-08-28 18:48:18 +00:00
commit 52ce12f383
101 changed files with 1344 additions and 23 deletions

View File

@ -422,6 +422,46 @@
secondary: "common.abilities.tool.golf_club.charged",
abilities: [],
),
Custom("Bass"): (
primary: "common.abilities.music.bass",
secondary: "common.abilities.music.bass",
abilities: [],
),
Custom("Flute"): (
primary: "common.abilities.music.flute",
secondary: "common.abilities.music.flute",
abilities: [],
),
Custom("Harp"): (
primary: "common.abilities.music.harp",
secondary: "common.abilities.music.harp",
abilities: [],
),
Custom("Perc"): (
primary: "common.abilities.music.perc",
secondary: "common.abilities.music.perc",
abilities: [],
),
Custom("Kalimba"): (
primary: "common.abilities.music.kalimba",
secondary: "common.abilities.music.kalimba",
abilities: [],
),
Custom("Melodica"): (
primary: "common.abilities.music.melodica",
secondary: "common.abilities.music.melodica",
abilities: [],
),
Custom("Lute"): (
primary: "common.abilities.music.lute",
secondary: "common.abilities.music.lute",
abilities: [],
),
Custom("Sitar"): (
primary: "common.abilities.music.sitar",
secondary: "common.abilities.music.sitar",
abilities: [],
),
Tool(Debug): (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,6 @@
Music(
buildup_duration: 0.1,
play_duration: 0.1,
recover_duration: 0.1,
ori_modifier: 1.0,
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Bass",
description: "Common Bass.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Bass")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Flute",
description: "Common Flute.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Flute")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Harp",
description: "Common Harp.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Harp")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Kalimba",
description: "Common Kalimba.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Kalimba")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Lute",
description: "Common Lute.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Lute")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Melodica",
description: "Common Melodica.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Melodica")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Waschbrett",
description: "Waschbrett.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Perc")),
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Sitar",
description: "Common Sitar.",
kind: Tool((
kind: Instrument,
hands: Two,
stats: (
equip_time_secs: 0.4,
power: 0.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0,
range: 0.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
ability_spec: Some(Custom("Sitar")),
)

View File

@ -525,6 +525,119 @@
threshold: 0.3,
),
//
// Instruments
Wield(Instrument): (
files: [
"voxygen.audio.sfx.weapon.weapon_out",
],
threshold: 0.5,
),
Unwield(Instrument): (
files: [
"voxygen.audio.sfx.weapon.weapon_in",
],
threshold: 0.5,
),
Music(Instrument, Custom("Bass")): (
files: [
"voxygen.audio.sfx.instrument.bass.bass_c",
"voxygen.audio.sfx.instrument.bass.bass_g",
"voxygen.audio.sfx.instrument.bass.bass_d",
"voxygen.audio.sfx.instrument.bass.bass_a",
"voxygen.audio.sfx.instrument.bass.bass_e",
"voxygen.audio.sfx.instrument.bass.bass_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Flute")): (
files: [
"voxygen.audio.sfx.instrument.flute.flute_c",
"voxygen.audio.sfx.instrument.flute.flute_g",
"voxygen.audio.sfx.instrument.flute.flute_d",
"voxygen.audio.sfx.instrument.flute.flute_a",
"voxygen.audio.sfx.instrument.flute.flute_e",
"voxygen.audio.sfx.instrument.flute.flute_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Harp")): (
files: [
"voxygen.audio.sfx.instrument.harp.harp_c",
"voxygen.audio.sfx.instrument.harp.harp_g",
"voxygen.audio.sfx.instrument.harp.harp_d",
"voxygen.audio.sfx.instrument.harp.harp_a",
"voxygen.audio.sfx.instrument.harp.harp_e",
"voxygen.audio.sfx.instrument.harp.harp_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Kalimba")): (
files: [
"voxygen.audio.sfx.instrument.kalimba.kalimba_c",
"voxygen.audio.sfx.instrument.kalimba.kalimba_g",
"voxygen.audio.sfx.instrument.kalimba.kalimba_d",
"voxygen.audio.sfx.instrument.kalimba.kalimba_a",
"voxygen.audio.sfx.instrument.kalimba.kalimba_e",
"voxygen.audio.sfx.instrument.kalimba.kalimba_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Melodica")): (
files: [
"voxygen.audio.sfx.instrument.melodica.melodica_c",
"voxygen.audio.sfx.instrument.melodica.melodica_g",
"voxygen.audio.sfx.instrument.melodica.melodica_d",
"voxygen.audio.sfx.instrument.melodica.melodica_a",
"voxygen.audio.sfx.instrument.melodica.melodica_e",
"voxygen.audio.sfx.instrument.melodica.melodica_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Lute")): (
files: [
"voxygen.audio.sfx.instrument.lute.lute_c",
"voxygen.audio.sfx.instrument.lute.lute_g",
"voxygen.audio.sfx.instrument.lute.lute_d",
"voxygen.audio.sfx.instrument.lute.lute_a",
"voxygen.audio.sfx.instrument.lute.lute_e",
"voxygen.audio.sfx.instrument.lute.lute_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Sitar")): (
files: [
"voxygen.audio.sfx.instrument.sitar.sitar_c",
"voxygen.audio.sfx.instrument.sitar.sitar_g",
"voxygen.audio.sfx.instrument.sitar.sitar_d",
"voxygen.audio.sfx.instrument.sitar.sitar_a",
"voxygen.audio.sfx.instrument.sitar.sitar_e",
"voxygen.audio.sfx.instrument.sitar.sitar_c1",
],
threshold: 0.5,
),
Music(Instrument, Custom("Perc")): (
files: [
"voxygen.audio.sfx.instrument.perc.perc_c",
"voxygen.audio.sfx.instrument.perc.perc_g",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_d",
"voxygen.audio.sfx.instrument.perc.perc_a",
"voxygen.audio.sfx.instrument.perc.perc_e",
],
threshold: 0.5,
),
Inventory(CollectedTool(Instrument)): (
files: [
"voxygen.audio.sfx.inventory.add_item",
],
threshold: 0.3,
),
//
// Dagger
//

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/bass/bass_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/flute/flute_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/harp/harp_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/kalimba/kalimba_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/lute/lute_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/melodica/melodica_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/perc/perc_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/perc/perc_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/perc/perc_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/perc/perc_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/perc/perc_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_a.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_c.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_c1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_d.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_e.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/instrument/sitar/sitar_g.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/skills/music.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -75,6 +75,7 @@ common-tool-debug = Debug
common-tool-farming = Farming Tool
common-tool-pick = Pickaxe
common-tool-mining = Mining
common-tool-instrument = Instrument
common-kind-modular_component = Modular Component
common-kind-modular_component_partial = Component
common-kind-glider = Glider

View File

@ -1618,6 +1618,38 @@
"voxel.weapon.tool.shovel_gold",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 1.2,
),
Simple("common.items.tool.instruments.harp"): VoxTrans(
"voxel.weapon.tool.harp",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 1.0,
),
Simple("common.items.tool.instruments.flute"): VoxTrans(
"voxel.weapon.tool.flute",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 1.0,
),
Simple("common.items.tool.instruments.bass"): VoxTrans(
"voxel.weapon.tool.bass",
(0.0, 0.0, 0.0), (45.0, 90.0, 0.0), 1.4,
),
Simple("common.items.tool.instruments.perc"): VoxTrans(
"voxel.weapon.tool.perc",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 0.8,
),
Simple("common.items.tool.instruments.kalimba"): VoxTrans(
"voxel.weapon.tool.kalimba",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 0.8,
),
Simple("common.items.tool.instruments.melodica"): VoxTrans(
"voxel.weapon.tool.melodica",
(0.0, 0.0, 0.0), (45.0, 90.0, 0.0), 0.9,
),
Simple("common.items.tool.instruments.lute"): VoxTrans(
"voxel.weapon.tool.lute",
(0.0, 0.0, 0.0), (45.0, 90.0, 0.0), 1.0,
),
Simple("common.items.tool.instruments.sitar"): VoxTrans(
"voxel.weapon.tool.sitar",
(0.0, 0.0, 0.0), (45.0, 90.0, 0.0), 1.2,
),
// Picks
Simple("common.items.tool.pickaxe_stone"): VoxTrans(
"voxel.weapon.tool.pickaxe_green-0",

View File

@ -1120,6 +1120,38 @@
vox_spec: ("weapon.tool.shovel_gold", (-1.0, -2.5, -4.0)),
color: None
),
Tool("common.items.tool.instruments.harp"): (
vox_spec: ("weapon.tool.harp", (-3.5, -7.0, 6.0)),
color: None
),
Tool("common.items.tool.instruments.flute"): (
vox_spec: ("weapon.tool.flute", (-4.5, -4.5, 8.0)),
color: None
),
Tool("common.items.tool.instruments.bass"): (
vox_spec: ("weapon.tool.bass", (-3.5, -6.0, 0.0)),
color: None
),
Tool("common.items.tool.instruments.perc"): (
vox_spec: ("weapon.tool.perc", (-3.0, -6.0, 9.0)),
color: None
),
Tool("common.items.tool.instruments.kalimba"): (
vox_spec: ("weapon.tool.kalimba", (-3.5, -7.0, 6.0)),
color: None
),
Tool("common.items.tool.instruments.melodica"): (
vox_spec: ("weapon.tool.melodica", (-3.5, -4.5, 8.0)),
color: None
),
Tool("common.items.tool.instruments.lute"): (
vox_spec: ("weapon.tool.lute", (-2.5, -6.0, 4.0)),
color: None
),
Tool("common.items.tool.instruments.sitar"): (
vox_spec: ("weapon.tool.sitar", (-4.0, -6.0, 5.0)),
color: None
),
// Staves
Modular(("common.items.modular.weapon.primary.staff.brand", "common.items.log.wood", Two)): (
vox_spec: ("weapon.staff.brand.wood", (-1.0, -2.5, -4.0)),

View File

@ -397,6 +397,15 @@
// Picks
Simple("common.items.tool.pickaxe_stone"): "voxel.weapon.tool.pickaxe_green-0",
Simple("common.items.tool.pickaxe_steel"): "voxel.weapon.tool.pickaxe_green-1",
// Instruments
Simple("common.items.tool.instruments.bass"): "voxel.weapon.tool.bass",
Simple("common.items.tool.instruments.flute"): "voxel.weapon.tool.flute",
Simple("common.items.tool.instruments.harp"): "voxel.weapon.tool.harp",
Simple("common.items.tool.instruments.perc"): "voxel.weapon.tool.perc",
Simple("common.items.tool.instruments.kalimba"): "voxel.weapon.tool.kalimba",
Simple("common.items.tool.instruments.melodica"): "voxel.weapon.tool.melodica",
Simple("common.items.tool.instruments.lute"): "voxel.weapon.tool.lute",
Simple("common.items.tool.instruments.sitar"): "voxel.weapon.tool.sitar",
// Other
Simple("common.items.utility.coins"): "voxel.object.v-coin",
Simple("common.items.utility.collar"): "voxel.object.collar",

BIN
assets/voxygen/voxel/weapon/tool/bass.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/flute.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/harp.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/kalimba.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/lute.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/melodica.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/perc.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/tool/sitar.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -174,6 +174,7 @@ fn get_tool_kind(kind: &ToolKind) -> String {
ToolKind::Debug => "Debug".to_string(),
ToolKind::Farming => "Farming".to_string(),
ToolKind::Pick => "Pick".to_string(),
ToolKind::Instrument => "Instrument".to_string(),
ToolKind::Natural => "Natural".to_string(),
ToolKind::Organ => "Organ".to_string(),
ToolKind::Empty => "Empty".to_string(),

View File

@ -359,6 +359,7 @@ pub enum CharacterAbilityType {
ComboMelee(StageSection, u32),
LeapMelee(StageSection),
SpinMelee(StageSection),
Music(StageSection),
Shockwave,
BasicBeam,
RepeaterRanged,
@ -385,6 +386,7 @@ impl From<&CharacterState> for CharacterAbilityType {
CharacterState::RepeaterRanged(_) => Self::RepeaterRanged,
CharacterState::BasicAura(_) => Self::BasicAura,
CharacterState::SelfBuff(_) => Self::SelfBuff,
CharacterState::Music(data) => Self::Music(data.stage_section),
CharacterState::Idle(_)
| CharacterState::Climb(_)
| CharacterState::Sit
@ -611,6 +613,12 @@ pub enum CharacterAbility {
summon_distance: (f32, f32),
sparseness: f64,
},
Music {
buildup_duration: f32,
play_duration: f32,
recover_duration: f32,
ori_modifier: f32,
},
}
impl Default for CharacterAbility {
@ -684,6 +692,7 @@ impl CharacterAbility {
| CharacterAbility::Boost { .. }
| CharacterAbility::BasicBeam { .. }
| CharacterAbility::Blink { .. }
| CharacterAbility::Music { .. }
| CharacterAbility::BasicSummon { .. }
| CharacterAbility::SpriteSummon { .. } => true,
}
@ -1063,6 +1072,16 @@ impl CharacterAbility {
*inner_dist *= stats.range;
*outer_dist *= stats.range;
},
Music {
ref mut buildup_duration,
ref mut play_duration,
ref mut recover_duration,
ori_modifier: _,
} => {
*buildup_duration /= stats.speed;
*play_duration /= stats.speed;
*recover_duration /= stats.speed;
},
}
self
}
@ -1093,6 +1112,7 @@ impl CharacterAbility {
Boost { .. }
| ComboMelee { .. }
| Blink { .. }
| Music { .. }
| BasicSummon { .. }
| SpriteSummon { .. } => 0.0,
}
@ -2207,6 +2227,23 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
stage_section: StageSection::Buildup,
achieved_radius: summon_distance.0.floor() as i32 - 1,
}),
CharacterAbility::Music {
buildup_duration,
play_duration,
recover_duration,
ori_modifier,
} => CharacterState::Music(music::Data {
static_data: music::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
play_duration: Duration::from_secs_f32(*play_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
ori_modifier: *ori_modifier,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
exhausted: false,
}),
}
}
}

View File

@ -125,6 +125,8 @@ pub enum CharacterState {
Wallrun(wallrun::Data),
/// Ice skating or skiing
Skate(skate::Data),
/// Play music instrument
Music(music::Data),
}
impl CharacterState {
@ -147,6 +149,7 @@ impl CharacterState {
| CharacterState::BasicAura(_)
| CharacterState::SelfBuff(_)
| CharacterState::Blink(_)
| CharacterState::Music(_)
| CharacterState::BasicSummon(_)
| CharacterState::SpriteSummon(_)
| CharacterState::Roll(roll::Data {
@ -240,6 +243,8 @@ impl CharacterState {
pub fn is_skate(&self) -> bool { matches!(self, CharacterState::Skate(_)) }
pub fn is_music(&self) -> bool { matches!(self, CharacterState::Music(_)) }
pub fn is_melee_dodge(&self) -> bool {
matches!(self, CharacterState::Roll(d) if d.static_data.immune_melee)
}
@ -278,6 +283,7 @@ impl CharacterState {
| CharacterState::SpriteSummon(_)
| CharacterState::UseItem(_)
| CharacterState::SpriteInteract(_)
| CharacterState::Music(_)
)
}
@ -339,6 +345,7 @@ impl CharacterState {
CharacterState::UseItem(data) => data.behavior(j, output_events),
CharacterState::SpriteInteract(data) => data.behavior(j, output_events),
CharacterState::Skate(data) => data.behavior(j, output_events),
CharacterState::Music(data) => data.behavior(j, output_events),
}
}
@ -386,6 +393,7 @@ impl CharacterState {
CharacterState::UseItem(data) => data.handle_event(j, output_events, action),
CharacterState::SpriteInteract(data) => data.handle_event(j, output_events, action),
CharacterState::Skate(data) => data.handle_event(j, output_events, action),
CharacterState::Music(data) => data.handle_event(j, output_events, action),
}
}

View File

@ -36,6 +36,9 @@ pub enum ToolKind {
Natural,
Organ,
/// This is an placeholder item, it is used by non-humanoid npcs to attack
/// Music Instruments
Instrument,
/// This is an placeholder item, it is used by non-humanoid npcs to attack
Empty,
}
@ -57,6 +60,7 @@ impl ToolKind {
ToolKind::Farming => "farming",
ToolKind::Pick => "pickaxe",
ToolKind::Organ => "organ",
ToolKind::Instrument => "instrument",
ToolKind::Empty => "empty",
}
}

View File

@ -18,6 +18,7 @@ pub mod glide;
pub mod glide_wield;
pub mod idle;
pub mod leap_melee;
pub mod music;
pub mod repeater_ranged;
pub mod roll;
pub mod self_buff;

133
common/src/states/music.rs Normal file
View File

@ -0,0 +1,133 @@
use crate::{
comp::{character_state::OutputEvents, CharacterState, Melee, StateUpdate},
states::{
behavior::{CharacterBehavior, JoinData},
utils::*,
wielding,
},
};
use serde::{Deserialize, Serialize};
use std::time::Duration;
/// Separated out to condense update portions of character state
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StaticData {
/// How long until state should make sound
pub buildup_duration: Duration,
/// How long the state is playing for
pub play_duration: Duration,
/// How long the state has until exiting
pub recover_duration: Duration,
/// Adjusts turning rate during the attack
pub ori_modifier: f32,
/// What key is used to press ability
pub ability_info: AbilityInfo,
}
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Data {
/// Struct containing data that does not change over the course of the
/// character state
pub static_data: StaticData,
/// Timer for each stage
pub timer: Duration,
/// What section the character stage is in
pub stage_section: StageSection,
/// Whether the attack can deal more damage
pub exhausted: bool,
}
impl CharacterBehavior for Data {
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_orientation(data, &mut update, self.static_data.ori_modifier, None);
handle_move(data, &mut update, 0.7);
handle_jump(data, output_events, &mut update, 1.0);
match self.stage_section {
StageSection::Buildup => {
if self.timer < self.static_data.buildup_duration {
// Build up
update.character = CharacterState::Music(Data {
timer: tick_attack_or_default(data, self.timer, None),
..*self
});
} else {
// Transitions to play section of stage
update.character = CharacterState::Music(Data {
timer: Duration::default(),
stage_section: StageSection::Action,
..*self
});
}
},
StageSection::Action => {
if !self.exhausted {
update.character = CharacterState::Music(Data {
timer: Duration::default(),
exhausted: true,
..*self
});
} else if self.timer < self.static_data.play_duration {
// Play
update.character = CharacterState::Music(Data {
timer: tick_attack_or_default(data, self.timer, None),
..*self
});
} else {
// Transitions to recover section of stage
update.character = CharacterState::Music(Data {
timer: Duration::default(),
stage_section: StageSection::Recover,
..*self
});
}
},
StageSection::Recover => {
if self.timer < self.static_data.recover_duration {
// Recovery
update.character = CharacterState::Music(Data {
timer: tick_attack_or_default(data, self.timer, None),
..*self
});
} else {
// Done
if input_is_pressed(data, self.static_data.ability_info.input) {
reset_state(self, data, output_events, &mut update);
} else {
update.character =
CharacterState::Wielding(wielding::Data { is_sneaking: false });
}
}
},
_ => {
// If it somehow ends up in an incorrect stage section
update.character = CharacterState::Wielding(wielding::Data { is_sneaking: false });
// Make sure attack component is removed
data.updater.remove::<Melee>(data.entity);
},
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_state_interrupt(data, &mut update, false);
}
update
}
}
fn reset_state(
data: &Data,
join: &JoinData,
output_events: &mut OutputEvents,
update: &mut StateUpdate,
) {
handle_input(
join,
output_events,
update,
data.static_data.ability_info.input,
);
}

View File

@ -1050,6 +1050,9 @@ pub fn is_strafing(data: &JoinData<'_>, update: &StateUpdate) -> bool {
// TODO: Don't always check `character.is_aimed()`, allow the frontend to
// control whether the player strafes during an aimed `CharacterState`.
(update.character.is_aimed() || update.should_strafe) && data.body.can_strafe()
// no strafe with music instruments equipped in ActiveMainhand
&& !matches!(unwrap_tool_data(data, EquipSlot::ActiveMainhand),
Some((ToolKind::Instrument, _)))
}
/// Returns tool and components

View File

@ -185,6 +185,7 @@ impl<'a> System<'a> for Sys {
| CharacterState::SpinMelee { .. }
| CharacterState::ComboMelee { .. }
| CharacterState::BasicRanged { .. }
| CharacterState::Music { .. }
| CharacterState::ChargedMelee { .. }
| CharacterState::ChargedRanged { .. }
| CharacterState::RepeaterRanged { .. }

View File

@ -84,6 +84,7 @@ pub fn skill_group_to_db_string(skill_group: comp::skillset::SkillGroupKind) ->
| Weapon(ToolKind::Blowgun)
| Weapon(ToolKind::Debug)
| Weapon(ToolKind::Farming)
| Weapon(ToolKind::Instrument)
| Weapon(ToolKind::Empty)
| Weapon(ToolKind::Natural)
| Weapon(ToolKind::Organ) => panic!(
@ -205,6 +206,7 @@ fn tool_kind_to_string(tool: Option<comp::item::tool::ToolKind>) -> String {
Some(Farming) => "Farming",
Some(Debug) => "Debug",
Some(Natural) => "Natural",
Some(Instrument) => "Instrument",
Some(Organ) => "Organ",
Some(Empty) => "Empty",
None => "None",

View File

@ -3,20 +3,20 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::{
comp::item::{Hands, ToolKind},
comp::item::{AbilitySpec, Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
use core::f32::consts::PI;
pub struct AlphaAnimation;
type AlphaAnimationDependency = (
type AlphaAnimationDependency<'a> = (
(Option<Hands>, Option<Hands>),
Option<StageSection>,
Option<AbilityInfo>,
(Option<AbilityInfo>, Option<&'a AbilitySpec>),
);
impl Animation for AlphaAnimation {
type Dependency<'a> = AlphaAnimationDependency;
type Dependency<'a> = AlphaAnimationDependency<'a>;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -25,7 +25,7 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(hands, stage_section, ability_info): Self::Dependency<'a>,
(hands, stage_section, (ability_info, active_tool_spec)): Self::Dependency<'a>,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -78,6 +78,53 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(0.0 + move1 * 1.5 + move2 * -2.5);
next.head.orientation = Quaternion::rotation_z(0.0 + move1 * -1.5 + move2 * 2.5);
},
// TODO: create Instrument SubToolKinds to distinguish instruments
Some(ToolKind::Instrument) => {
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
match spec.as_str() {
"Flute" => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.head.position =
Vec3::new(move2 * 0.1, s_a.head.0 + move2 * 0.2, s_a.head.1);
next.chest.orientation = Quaternion::rotation_x(
0.0 + move1 * 0.2 + move2 * -0.2 + move3 * 0.1,
) * Quaternion::rotation_y(
0.0 + move1 * 0.0 + move2 * 0.0 + move3 * 0.0,
) * Quaternion::rotation_z(
0.0 + move1 * 0.1 + move2 * -0.1 + move3 * 0.1,
);
next.head.orientation = Quaternion::rotation_z(
0.0 + move1 * -0.1 + move2 * 0.1 + move3 * -0.2,
);
},
_ => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.head.position =
Vec3::new(move2 * 1.0, s_a.head.0 + move2 * 1.0, s_a.head.1);
next.chest.orientation = Quaternion::rotation_x(
0.0 + move1 * 0.2 + move2 * -0.2 + move3 * 0.1,
) * Quaternion::rotation_y(
0.0 + move1 * 0.0 + move2 * 0.0 + move3 * 0.0,
) * Quaternion::rotation_z(
0.0 + move1 * 0.3 + move2 * -0.3 + move3 * 0.2,
);
next.head.orientation = Quaternion::rotation_z(
0.0 + move1 * -0.1 + move2 * 0.1 + move3 * -0.2,
);
},
}
}
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
let (move1, move2, move3) = match stage_section {
@ -156,6 +203,205 @@ impl Animation for AlphaAnimation {
s_a.ac.5 + move1 * -2.0 + move2 * -1.0 + move3 * 2.5,
)
},
Some(ToolKind::Instrument) => {
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
match spec.as_str() {
"Bass" => {
next.hand_r.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.40);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(-4.0, 6.0, 14.0);
next.main.orientation = Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(3.0)
* Quaternion::rotation_z(PI / -3.0);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
next.hand_l.position = Vec3::new(
s_a.ahl.0 + move1 * -5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.1 + move1 * 6.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
},
"Lute" => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.40);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(-14.0, 6.0, 4.0);
next.main.orientation = Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(2.0)
* Quaternion::rotation_z(PI / -3.0);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
next.hand_l.position = Vec3::new(
s_a.ahl.0 + move1 * -5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.1 + move1 * 6.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.2 + move1 * -6.0 + move2 * 0.0 + move3 * 0.0,
);
},
"Sitar" => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.40);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(-14.0, 6.0, 4.0);
next.main.orientation = Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(2.0)
* Quaternion::rotation_z(PI / -3.0);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
next.hand_l.position = Vec3::new(
s_a.ahl.0 + move1 * -5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.1 + move1 * 6.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahl.2 + move1 * -6.0 + move2 * 0.0 + move3 * 0.0,
);
},
"Flute" => {
next.hand_l.position = Vec3::new(-4.0, 6.0, 4.5);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.40);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(-2.5, 10.0, -12.0);
next.main.orientation = Quaternion::rotation_x(3.5)
* Quaternion::rotation_y(PI)
* Quaternion::rotation_z(0.05);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
},
"Kalimba" => {
next.hand_l.position = Vec3::new(-4.0, 6.0, 2.0);
next.hand_l.orientation = Quaternion::rotation_x(1.00)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.20);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.75)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(8.0, 12.0, -6.0);
next.main.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(PI - 0.2);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 3.0 + move2 * 0.0 + move3 * 0.0,
);
},
"Melodica" => {
next.hand_l.position = Vec3::new(-3.0, 6.0, 3.5);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.40);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(-1.0, 2.0, 15.0);
next.main.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(PI)
* Quaternion::rotation_z(PI / -2.0);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 1.0 + move2 * 0.0 + move3 * 0.0,
);
},
_ => {
next.hand_l.position = Vec3::new(-4.0, 6.0, 2.0);
next.hand_l.orientation = Quaternion::rotation_x(1.00)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.20);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(1.75)
* Quaternion::rotation_y(0.75)
* Quaternion::rotation_z(-0.40);
next.main.position = Vec3::new(8.0, 14.0, -6.0);
next.main.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(-0.75)
* Quaternion::rotation_z(0.20);
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.hand_r.position = Vec3::new(
s_a.ahr.0 + move1 * 5.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.1 + move1 * 8.0 + move2 * 0.0 + move3 * 0.0,
s_a.ahr.2 + move1 * 3.0 + move2 * 0.0 + move3 * 0.0,
);
},
}
}
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),

View File

@ -51,6 +51,9 @@ impl Animation for EquipAnimation {
next.hand_l.position = Vec3::new(-3.0, -5.0, 9.0);
next.hand_r.position = Vec3::new(-1.75, -4.5, 7.0);
},
Some(ToolKind::Instrument) => {
next.hand_l.position = Vec3::new(-5.0, -5.0, 8.0);
},
_ => {},
}

View File

@ -103,7 +103,7 @@ impl Animation for RollAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Instrument) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)

View File

@ -191,6 +191,9 @@ impl Animation for SneakEquipAnimation {
next.hand_l.position = Vec3::new(-3.0, -5.0, 9.0);
next.hand_r.position = Vec3::new(-1.75, -4.5, 7.0);
},
Some(ToolKind::Instrument) => {
next.hand_l.position = Vec3::new(-3.0, -5.0, 10.0);
},
_ => {},
}
next

View File

@ -2,14 +2,14 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::comp::item::{AbilitySpec, Hands, ToolKind};
use core::{f32::consts::PI, ops::Mul};
pub struct SneakWieldAnimation;
impl Animation for SneakWieldAnimation {
type Dependency<'a> = (
Option<ToolKind>,
(Option<ToolKind>, Option<&'a AbilitySpec>),
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
Vec3<f32>,
@ -25,9 +25,15 @@ impl Animation for SneakWieldAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_sneakwield")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
( active_tool_kind,
(
(active_tool_kind, active_tool_spec),
second_tool_kind,
hands, velocity, orientation, last_ori, global_time): Self::Dependency<'a>,
hands,
velocity,
orientation,
last_ori,
global_time,
): Self::Dependency<'a>,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -283,6 +289,24 @@ impl Animation for SneakWieldAnimation {
* Quaternion::rotation_y(s_a.bc.4)
* Quaternion::rotation_z(s_a.bc.5);
},
Some(ToolKind::Instrument) => {
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
match spec.as_str() {
"Perc" => {
next.hand_l.position = Vec3::new(-7.0, 0.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, -4.5, -5.0);
next.main.orientation = Quaternion::rotation_x(5.5);
},
_ => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
},
}
}
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);

View File

@ -162,6 +162,12 @@ impl Animation for StaggeredAnimation {
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
Some(ToolKind::Instrument) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
},
_ => {},
}
},

View File

@ -155,9 +155,14 @@ impl Animation for StunnedAnimation {
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
Some(ToolKind::Instrument) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
},
_ => {},
},
(_, _) => {},

View File

@ -3,15 +3,15 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::{
comp::item::{Hands, ToolKind},
comp::item::{AbilitySpec, Hands, ToolKind},
util::Dir,
};
use core::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
type WieldAnimationDependency = (
Option<ToolKind>,
type WieldAnimationDependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
Vec3<f32>,
@ -21,7 +21,7 @@ type WieldAnimationDependency = (
f32,
);
impl Animation for WieldAnimation {
type Dependency<'a> = WieldAnimationDependency;
type Dependency<'a> = WieldAnimationDependency<'a>;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -31,7 +31,7 @@ impl Animation for WieldAnimation {
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(
active_tool_kind,
(active_tool_kind, active_tool_spec),
second_tool_kind,
hands,
orientation,
@ -281,6 +281,194 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
Some(ToolKind::Instrument) => {
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
match spec.as_str() {
"Harp" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(0.0, 2.0, -4.0);
next.hand_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-4.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-2.0, 10.0, 12.0);
next.main.orientation = Quaternion::rotation_y(PI);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Flute" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-1.0, 2.0, -2.0);
next.hand_l.orientation = Quaternion::rotation_x(2.5)
* Quaternion::rotation_y(0.9)
* Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-4.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(12.0, 3.0, 4.0);
next.main.orientation =
Quaternion::rotation_x(PI) * Quaternion::rotation_y(-1.2);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Bass" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-6.0, 5.0, -5.0);
next.hand_l.orientation = Quaternion::rotation_x((PI / 2.0) + 0.3)
* Quaternion::rotation_y(0.7)
* Quaternion::rotation_y(0.25)
* Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-2.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-14.0, 4.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.2)
* Quaternion::rotation_y(1.2)
* Quaternion::rotation_z(-1.2);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Perc" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(0.0, 2.0, -4.0);
next.hand_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-4.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-2.0, 10.0, 12.0);
next.main.orientation = Quaternion::rotation_y(PI);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Kalimba" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-2.0, 2.0, -4.0);
next.hand_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-4.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-2.0, 7.0, 12.0);
next.main.orientation =
Quaternion::rotation_y(PI) * Quaternion::rotation_z(PI);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Lute" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-2.0, 5.0, -5.0);
next.hand_l.orientation = Quaternion::rotation_x((PI / 2.0) + 0.3)
* Quaternion::rotation_y(0.7)
* Quaternion::rotation_y(0.25)
* Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-5.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-2.0, 4.0, -12.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.2)
* Quaternion::rotation_z(-1.3);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Melodica" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-1.0, 3.0, -2.0);
next.hand_l.orientation = Quaternion::rotation_x(2.0)
* Quaternion::rotation_z(-0.5)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-4.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(1.2)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(1.5);
next.main.position = Vec3::new(-14.0, 3.0, -6.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(1.1)
* Quaternion::rotation_z(-1.5);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
"Sitar" => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(
0.0 + head_look.y.abs() + look_dir.z * 0.7,
);
}
next.hand_l.position = Vec3::new(-1.0, 5.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x((PI / 2.0) + 0.3)
* Quaternion::rotation_y(0.2)
* Quaternion::rotation_y(0.25)
* Quaternion::rotation_z(PI);
next.hand_r.position = Vec3::new(-5.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-2.0, 4.0, -12.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.2)
* Quaternion::rotation_z(-1.3);
next.control.position = Vec3::new(-2.0 + slow * 0.5, 0.5, 0.8);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(2.0 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
_ => {},
}
}
},
_ => {},
},
((_, _), _, _) => {},

View File

@ -152,6 +152,13 @@ impl CombatEventMapper {
CharacterAbilityType::from(character_state),
data.kind,
);
} else if character_state.is_music() {
if let Some(ability_spec) = item
.ability_spec()
.map(|ability_spec| ability_spec.into_owned())
{
return SfxEvent::Music(data.kind, ability_spec);
}
} else if let Some(wield_event) = match (
previous_state.weapon_drawn,
Self::weapon_drawn(character_state),

View File

@ -94,7 +94,7 @@ use common::{
assets::{self, AssetExt, AssetHandle},
comp::{
beam, biped_large, biped_small, humanoid,
item::{ItemDefinitionId, ItemKind, ToolKind},
item::{AbilitySpec, ItemDefinitionId, ItemKind, ToolKind},
object,
poise::PoiseState,
quadruped_low, quadruped_medium, quadruped_small, Body, CharacterAbilityType, Health,
@ -192,6 +192,7 @@ pub enum SfxEvent {
GroundSlam,
Utterance(UtteranceKind, VoiceKind),
Lightning,
Music(ToolKind, AbilitySpec),
}
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Hash, Eq)]

View File

@ -2833,6 +2833,7 @@ fn unlock_skill_strings(group: SkillGroupKind) -> SkillStrings<'static> {
| ToolKind::Blowgun
| ToolKind::Debug
| ToolKind::Farming
| ToolKind::Instrument
| ToolKind::Pick
| ToolKind::Natural
| ToolKind::Organ

View File

@ -548,6 +548,7 @@ image_ids! {
skill_axe_leap_slash: "voxygen.element.skills.skill_axe_leap_slash",
skill_bow_jump_burst: "voxygen.element.skills.skill_bow_jump_burst",
skill_sceptre_aura: "voxygen.element.skills.sceptre_protection",
instrument: "voxygen.element.skills.music",
missing_icon: "voxygen.element.missing_icon_grey",
// Buttons

View File

@ -256,6 +256,7 @@ fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
ToolKind::Natural => i18n.get_msg("common-weapons-natural"),
ToolKind::Debug => i18n.get_msg("common-tool-debug"),
ToolKind::Farming => i18n.get_msg("common-tool-farming"),
ToolKind::Instrument => i18n.get_msg("common-tool-instrument"),
ToolKind::Pick => i18n.get_msg("common-tool-pick"),
ToolKind::Empty => i18n.get_msg("common-empty"),
};
@ -351,6 +352,15 @@ pub fn ability_image(imgs: &img_ids::Imgs, ability_id: &str) -> image::Id {
"common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
// Pickaxe
"common.abilities.pick.swing" => imgs.mining,
// Instruments
"common.abilities.music.bass" => imgs.instrument,
"common.abilities.music.flute" => imgs.instrument,
"common.abilities.music.harp" => imgs.instrument,
"common.abilities.music.perc" => imgs.instrument,
"common.abilities.music.kalimba" => imgs.instrument,
"common.abilities.music.melodica" => imgs.instrument,
"common.abilities.music.lute" => imgs.instrument,
"common.abilities.music.sitar" => imgs.instrument,
_ => imgs.not_found,
}
}

Some files were not shown because too many files have changed in this diff Show More