Merge branch 'combat' of https://gitlab.com/veloren/veloren into combat

This commit is contained in:
AdamWhitehurst 2020-03-27 10:40:19 -07:00
commit 01264ce167
23 changed files with 79 additions and 34 deletions

View File

@ -2,11 +2,11 @@ Item(
name: "Apple",
description: "Red and juicy.
Restores 2 Health.",
Restores 20 Health.",
kind: Consumable(
kind: Apple,
effect: Health((
amount: 2,
amount: 20,
cause: Item,
)),
),

BIN
assets/voxygen/element/help.png (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,6 +55,7 @@ pub enum Body {
BoltFire = 49,
ArrowSnake = 50,
CampfireLit = 51,
BoltFireBig = 52,
}
impl Body {
@ -64,7 +65,7 @@ impl Body {
}
}
const ALL_OBJECTS: [Body; 51] = [
const ALL_OBJECTS: [Body; 52] = [
Body::Arrow,
Body::Bomb,
Body::Scarecrow,
@ -115,5 +116,6 @@ const ALL_OBJECTS: [Body; 51] = [
Body::CarpetHumanSquircle,
Body::CraftingBench,
Body::BoltFire,
Body::BoltFireBig,
Body::ArrowSnake,
];

View File

@ -118,6 +118,7 @@ impl ToolData {
cause: HealthSource::Projectile { owner: None },
}),
projectile::Effect::Knockback(10.0),
projectile::Effect::RewardEnergy(100),
projectile::Effect::Vanish,
],
time_left: Duration::from_secs(15),
@ -158,6 +159,7 @@ impl ToolData {
amount: -1,
cause: HealthSource::Projectile { owner: None },
}),
projectile::Effect::RewardEnergy(100),
projectile::Effect::Vanish,
],
time_left: Duration::from_secs(20),
@ -175,7 +177,7 @@ impl ToolData {
energy_cost: 400,
holdable: false,
prepare_duration: Duration::from_millis(800),
recover_duration: Duration::from_millis(300),
recover_duration: Duration::from_millis(50),
projectile: Projectile {
hit_ground: vec![
projectile::Effect::Explode { power: 1.4 },
@ -192,7 +194,7 @@ impl ToolData {
time_left: Duration::from_secs(20),
owner: None,
},
projectile_body: Body::Object(object::Body::BoltFire),
projectile_body: Body::Object(object::Body::BoltFireBig),
projectile_light: Some(LightEmitter {
col: (0.72, 0.11, 0.11).into(),
..Default::default()

View File

@ -7,6 +7,7 @@ use std::time::Duration;
pub enum Effect {
Damage(comp::HealthChange),
Knockback(f32),
RewardEnergy(u32),
Explode { power: f32 },
Vanish,
Stick,

View File

@ -28,7 +28,7 @@ impl CharacterBehavior for Data {
fn behavior(&self, data: &JoinData) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_move(data, &mut update, 0.2);
handle_move(data, &mut update, 0.3);
handle_jump(data, &mut update);
if self.prepare_timer < self.prepare_duration

View File

@ -9,8 +9,8 @@ use vek::vec::Vec2;
pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0;
const BASE_HUMANOID_ACCEL: f32 = 100.0;
const BASE_HUMANOID_SPEED: f32 = 150.0;
const NPC_HUMANOID_SPEED: f32 = 150.0;
const BASE_HUMANOID_SPEED: f32 = 170.0;
const NPC_HUMANOID_SPEED: f32 = 170.0;
const BASE_HUMANOID_AIR_ACCEL: f32 = 15.0;
const BASE_HUMANOID_AIR_SPEED: f32 = 8.0;
const BASE_HUMANOID_WATER_ACCEL: f32 = 70.0;

View File

@ -1,5 +1,7 @@
use crate::{
comp::{projectile, HealthSource, Ori, PhysicsState, Pos, Projectile, Vel},
comp::{
projectile, Energy, EnergySource, HealthSource, Ori, PhysicsState, Pos, Projectile, Vel,
},
event::{EventBus, LocalEvent, ServerEvent},
state::DeltaTime,
sync::UidAllocator,
@ -22,6 +24,7 @@ impl<'a> System<'a> for Sys {
ReadStorage<'a, Vel>,
WriteStorage<'a, Ori>,
WriteStorage<'a, Projectile>,
WriteStorage<'a, Energy>,
);
fn run(
@ -37,6 +40,7 @@ impl<'a> System<'a> for Sys {
velocities,
mut orientations,
mut projectiles,
mut energies,
): Self::SystemData,
) {
let mut local_emitter = local_bus.emitter();
@ -108,6 +112,15 @@ impl<'a> System<'a> for Sys {
});
}
},
projectile::Effect::RewardEnergy(energy) => {
if let Some(energy_mut) = projectile
.owner
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
.and_then(|o| energies.get_mut(o))
{
energy_mut.change_by(energy as i32, EnergySource::HitEnemy);
}
},
projectile::Effect::Explode { power } => {
server_emitter.emit(ServerEvent::Explosion {
pos: pos.0,

View File

@ -194,7 +194,7 @@ pub fn handle_respawn(server: &Server, entity: EcsEntity) {
pub fn handle_explosion(server: &Server, pos: Vec3<f32>, power: f32, owner: Option<Uid>) {
// Go through all other entities
let hit_range = 2.0 * power;
let hit_range = 3.0 * power;
let ecs = &server.state.ecs();
for (pos_b, ori_b, character_b, stats_b) in (
&ecs.read_storage::<comp::Pos>(),

View File

@ -117,7 +117,7 @@ impl PlayState for CharSelectionState {
global_state.window.renderer_mut(),
self.client.borrow().get_tick(),
humanoid_body.clone(),
loadout,
loadout.as_ref(),
);
// Draw the UI to the screen.

View File

@ -333,9 +333,31 @@ impl CharSelectionUi {
}
}
pub fn get_loadout(&mut self) -> Option<&comp::Loadout> {
pub fn get_loadout(&mut self) -> Option<comp::Loadout> {
match &mut self.mode {
Mode::Select(_) => None,
Mode::Select(characterdata) => {
let loadout = comp::Loadout {
active_item: characterdata
.as_ref()
.and_then(|d| d.tool.as_ref())
.map(|tool| comp::ItemConfig {
item: (*load_expect::<comp::Item>(&tool)).clone(),
ability1: None,
ability2: None,
ability3: None,
block_ability: None,
dodge_ability: None,
}),
second_item: None,
shoulder: None,
chest: None,
belt: None,
hand: None,
pants: None,
foot: None,
};
Some(loadout)
},
Mode::Create { loadout, tool, .. } => {
loadout.active_item = tool.map(|tool| comp::ItemConfig {
item: (*load_expect::<comp::Item>(tool)).clone(),
@ -345,7 +367,7 @@ impl CharSelectionUi {
block_ability: None,
dodge_ability: None,
});
Some(loadout)
Some(loadout.clone())
},
}
}

View File

@ -1869,7 +1869,8 @@ pub fn mesh_object(obj: object::Body) -> Mesh<FigurePipeline> {
Body::Pouch => ("object.pouch", Vec3::new(-5.5, -4.5, 0.0)),
Body::CraftingBench => ("object.crafting_bench", Vec3::new(-9.5, -7.0, 0.0)),
Body::ArrowSnake => ("weapon.projectile.snake-arrow", Vec3::new(-1.5, -6.5, 0.0)),
Body::BoltFire => ("weapon.projectile.fire-bolt", Vec3::new(-3.0, -5.5, -3.0)),
Body::BoltFire => ("weapon.projectile.fire-bolt-0", Vec3::new(-3.0, -5.5, -3.0)),
Body::BoltFireBig => ("weapon.projectile.fire-bolt-1", Vec3::new(-6.0, -6.0, -6.0)),
};
load_mesh(name, offset)
}

View File

@ -365,7 +365,7 @@ impl Default for GameplaySettings {
chat_transp: 0.4,
crosshair_type: CrosshairType::Round,
intro_show: Intro::Show,
xp_bar: XpBar::OnGain,
xp_bar: XpBar::Always,
shortcut_numbers: ShortcutNumbers::On,
bar_numbers: BarNumbers::Off,
ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()),

View File

@ -628,7 +628,11 @@ pub fn block_from_structure(
)
.map(|e| e as u8),
)),
StructureBlock::Fruit => Some(Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))),
StructureBlock::Fruit => Some(if field.get(pos + structure_pos) % 3 > 0 {
Block::empty()
} else {
Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))
}),
StructureBlock::Chest => Some(if structure_seed % 10 < 7 {
Block::empty()
} else {

View File

@ -56,7 +56,7 @@ pub fn structure_gen<'a>(
ForestKind::Palm => &PALMS,
ForestKind::Savannah => &ACACIAS,
ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 16 == 7 => &OAK_STUMPS,
ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 8 == 7 => &FRUIT_TREES,
ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 19 == 7 => &FRUIT_TREES,
ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 14 == 7 => &BIRCHES,
ForestKind::Oak => &OAKS,
ForestKind::Pine => &PINES,