Merge branch 'pfauenauge/more_sprites' into 'master'

More sprites, ui fixes, lianas

See merge request veloren/veloren!472
This commit is contained in:
Joshua Barretto 2019-09-01 19:04:03 +00:00
commit 8a3ce232fa
47 changed files with 578 additions and 303 deletions

1
Cargo.lock generated
View File

@ -3155,6 +3155,7 @@ name = "veloren-voxygen"
version = "0.3.0"
dependencies = [
"backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)",
"conrod_winit 0.63.0 (git+https://gitlab.com/veloren/conrod.git)",
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -34,11 +34,11 @@ void main() {
sin(tick.x * 1.5 + f_pos.y * 0.1) * sin(tick.x * 0.35),
sin(tick.x * 1.5 + f_pos.x * 0.1) * sin(tick.x * 0.25),
0.0
) * pow(v_pos.z * SCALE, 1.3) * 0.2;
) * pow(abs(v_pos.z) * SCALE, 1.3) * 0.2;
f_norm = (inst_mat * vec4(v_norm, 0)).xyz;
f_col = v_col * inst_col;
f_col = srgb_to_linear(v_col) * srgb_to_linear(inst_col);
f_light = 1.0;

BIN
assets/voxygen/voxel/sprite/cacti/cactus_round.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cacti/cactus_short.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cacti/flat_cactus_med.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cacti/flat_cactus_short.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flowers/flower_blue_3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flowers/flower_blue_4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flowers/flower_blue_5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_4.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flowers/flower_red_2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/grass/grass_long_6.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/grass/grass_long_7.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/lianas/liana-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/lianas/liana-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-6.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-7.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-8.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/mushrooms/mushroom-9.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/world/tree/mangroves/1.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/2.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/3.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/4.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/5.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/6.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/7.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/world/tree/mangroves/8.vox (Stored with Git LFS)

Binary file not shown.

View File

@ -12,6 +12,10 @@ pub enum BlockKind {
Water,
LargeCactus,
BarrelCactus,
RoundCactus,
ShortCactus,
MedFlatCactus,
ShortFlatCactus,
BlueFlower,
PinkFlower,
PurpleFlower,
@ -23,6 +27,8 @@ pub enum BlockKind {
MediumGrass,
ShortGrass,
Apple,
Mushroom,
Liana,
}
impl BlockKind {
@ -31,6 +37,10 @@ impl BlockKind {
BlockKind::Air => true,
BlockKind::LargeCactus => false,
BlockKind::BarrelCactus => true,
BlockKind::RoundCactus => true,
BlockKind::ShortCactus => true,
BlockKind::MedFlatCactus => true,
BlockKind::ShortFlatCactus => true,
BlockKind::BlueFlower => true,
BlockKind::PinkFlower => true,
BlockKind::PurpleFlower => true,
@ -42,6 +52,8 @@ impl BlockKind {
BlockKind::MediumGrass => true,
BlockKind::ShortGrass => true,
BlockKind::Apple => true,
BlockKind::Mushroom => true,
BlockKind::Liana => true,
_ => false,
}
}
@ -59,6 +71,10 @@ impl BlockKind {
BlockKind::Water => false,
BlockKind::LargeCactus => false,
BlockKind::BarrelCactus => false,
BlockKind::RoundCactus => false,
BlockKind::ShortCactus => false,
BlockKind::MedFlatCactus => false,
BlockKind::ShortFlatCactus => false,
BlockKind::BlueFlower => false,
BlockKind::PinkFlower => false,
BlockKind::PurpleFlower => false,
@ -70,6 +86,8 @@ impl BlockKind {
BlockKind::MediumGrass => false,
BlockKind::ShortGrass => false,
BlockKind::Apple => false,
BlockKind::Mushroom => false,
BlockKind::Liana => false,
_ => true,
}
}
@ -80,6 +98,10 @@ impl BlockKind {
BlockKind::Water => false,
BlockKind::LargeCactus => true,
BlockKind::BarrelCactus => true,
BlockKind::RoundCactus => true,
BlockKind::ShortCactus => true,
BlockKind::MedFlatCactus => true,
BlockKind::ShortFlatCactus => true,
BlockKind::BlueFlower => false,
BlockKind::PinkFlower => false,
BlockKind::PurpleFlower => false,
@ -91,6 +113,8 @@ impl BlockKind {
BlockKind::MediumGrass => false,
BlockKind::ShortGrass => false,
BlockKind::Apple => true,
BlockKind::Mushroom => false,
BlockKind::Liana => false,
_ => true,
}
}

View File

@ -15,11 +15,13 @@ pub enum StructureBlock {
TemperateLeaves,
PineLeaves,
Acacia,
Mangrove,
PalmLeaves,
Water,
GreenSludge,
Fruit,
Hollow,
Liana,
Normal(Rgb<u8>),
}
@ -110,8 +112,10 @@ impl Asset for Structure {
2 => StructureBlock::PalmLeaves,
3 => StructureBlock::Water,
4 => StructureBlock::Acacia,
5 => StructureBlock::Mangrove,
6 => StructureBlock::GreenSludge,
7 => StructureBlock::Fruit,
9 => StructureBlock::Liana,
15 => StructureBlock::Hollow,
index => {
let color = palette

View File

@ -262,9 +262,12 @@ fn handle_kill(server: &mut Server, entity: EcsEntity, _args: String, _action: &
fn handle_time(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
let time = scan_fmt_some!(&args, action.arg_fmt, String);
let new_time = match time.as_ref().map(|s| s.as_str()) {
Some("night") => NaiveTime::from_hms(0, 0, 0),
Some("midnight") => NaiveTime::from_hms(0, 0, 0),
Some("night") => NaiveTime::from_hms(20, 0, 0),
Some("dawn") => NaiveTime::from_hms(5, 0, 0),
Some("day") => NaiveTime::from_hms(12, 0, 0),
Some("morning") => NaiveTime::from_hms(8, 0, 0),
Some("day") => NaiveTime::from_hms(10, 0, 0),
Some("noon") => NaiveTime::from_hms(12, 0, 0),
Some("dusk") => NaiveTime::from_hms(17, 0, 0),
Some(n) => match n.parse() {
Ok(n) => n,
@ -797,14 +800,12 @@ fn handle_tell(server: &mut Server, entity: EcsEntity, args: String, action: &Ch
.get(entity)
.map(|s| s.alias.clone())
{
server.clients.notify(
player,
ServerMsg::tell(format!("[{}] tells you:{}", name, msg)),
);
server.clients.notify(
entity,
ServerMsg::tell(format!("You tell [{}]:{}", alias, msg)),
);
server
.clients
.notify(player, ServerMsg::tell(format!("[{}] tells:{}", name, msg)));
server
.clients
.notify(entity, ServerMsg::tell(format!("To [{}]:{}", alias, msg)));
} else {
server.clients.notify(
entity,

View File

@ -59,3 +59,4 @@ crossbeam = "0.7.2"
heaptrack = "0.3.0"
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
parking_lot = "0.9.0"
chrono = "0.4.7"

View File

@ -18,6 +18,7 @@ use bag::Bag;
use buttons::Buttons;
use character_window::CharacterWindow;
use chat::Chat;
use chrono::NaiveTime;
use esc_menu::EscMenu;
use img_ids::Imgs;
use map::Map;
@ -94,6 +95,7 @@ widget_ids! {
coordinates,
velocity,
loaded_distance,
time,
// Game Version
version,
@ -157,7 +159,6 @@ pub enum Event {
CrosshairTransp(f32),
CrosshairType(CrosshairType),
ToggleXpBar(XpBar),
ToggleEnBars(EnBars),
ToggleBarNumbers(BarNumbers),
ToggleShortcutNumbers(ShortcutNumbers),
UiScale(ScaleChange),
@ -189,11 +190,6 @@ pub enum XpBar {
Always,
OnGain,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum EnBars {
Always,
OnLoss,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum BarNumbers {
@ -629,6 +625,22 @@ impl Hud {
.font_id(self.fonts.opensans)
.font_size(14)
.set(self.ids.loaded_distance, ui_widgets);
// Time
let time_in_seconds = client.state().get_time_of_day();
let current_time = NaiveTime::from_num_seconds_from_midnight(
// Wraps around back to 0s if it exceeds 24 hours (24 hours = 86400s)
(time_in_seconds as u64 % 86400) as u32,
0,
);
Text::new(&format!(
"Time: {}",
current_time.format("%H:%M").to_string()
))
.color(TEXT_COLOR)
.down_from(self.ids.loaded_distance, 5.0)
.font_id(self.fonts.opensans)
.font_size(14)
.set(self.ids.time, ui_widgets);
}
// Add Bag-Space Button.
@ -792,9 +804,6 @@ impl Hud {
settings_window::Event::ToggleXpBar(xp_bar) => {
events.push(Event::ToggleXpBar(xp_bar));
}
settings_window::Event::ToggleEnBars(en_bars) => {
events.push(Event::ToggleEnBars(en_bars));
}
settings_window::Event::ToggleBarNumbers(bar_numbers) => {
events.push(Event::ToggleBarNumbers(bar_numbers));
}

View File

@ -1,6 +1,5 @@
use super::{
img_ids::Imgs, BarNumbers, CrosshairType, EnBars, Fonts, ShortcutNumbers, Show, XpBar,
TEXT_COLOR,
img_ids::Imgs, BarNumbers, CrosshairType, Fonts, ShortcutNumbers, Show, XpBar, TEXT_COLOR,
};
use crate::{
audio::base::Genre,
@ -145,7 +144,6 @@ pub enum Event {
ToggleHelp,
ToggleDebug,
ToggleXpBar(XpBar),
ToggleEnBars(EnBars),
ToggleBarNumbers(BarNumbers),
ToggleShortcutNumbers(ShortcutNumbers),
ChangeTab(SettingsTab),
@ -644,36 +642,6 @@ impl<'a> Widget for SettingsWindow<'a> {
.graphics_for(state.ids.show_xpbar_button)
.color(TEXT_COLOR)
.set(state.ids.show_xpbar_text, ui);
// Show Health & Energy Bars
if Button::image(match self.global_state.settings.gameplay.en_bars {
EnBars::Always => self.imgs.checkbox_checked,
EnBars::OnLoss => self.imgs.checkbox,
})
.w_h(18.0, 18.0)
.hover_image(match self.global_state.settings.gameplay.en_bars {
EnBars::Always => self.imgs.checkbox_checked_mo,
EnBars::OnLoss => self.imgs.checkbox_mo,
})
.press_image(match self.global_state.settings.gameplay.en_bars {
EnBars::Always => self.imgs.checkbox_checked,
EnBars::OnLoss => self.imgs.checkbox_press,
})
.down_from(state.ids.show_xpbar_button, 8.0)
.set(state.ids.show_bars_button, ui)
.was_clicked()
{
match self.global_state.settings.gameplay.en_bars {
EnBars::Always => events.push(Event::ToggleEnBars(EnBars::OnLoss)),
EnBars::OnLoss => events.push(Event::ToggleEnBars(EnBars::Always)),
}
}
Text::new("Always show Health and Energy Bars")
.right_from(state.ids.show_bars_button, 10.0)
.font_size(14)
.font_id(self.fonts.opensans)
.graphics_for(state.ids.show_bars_button)
.color(TEXT_COLOR)
.set(state.ids.show_bars_text, ui);
// Show Shortcut Numbers
if Button::image(match self.global_state.settings.gameplay.shortcut_numbers {
ShortcutNumbers::On => self.imgs.checkbox_checked,
@ -688,7 +656,7 @@ impl<'a> Widget for SettingsWindow<'a> {
ShortcutNumbers::On => self.imgs.checkbox_checked,
ShortcutNumbers::Off => self.imgs.checkbox_press,
})
.down_from(state.ids.show_bars_button, 8.0)
.down_from(state.ids.show_xpbar_button, 8.0)
.set(state.ids.show_shortcuts_button, ui)
.was_clicked()
{

View File

@ -1,5 +1,5 @@
use super::{
img_ids::Imgs, BarNumbers, EnBars, Fonts, ShortcutNumbers, XpBar, CRITICAL_HP_COLOR,
img_ids::Imgs, BarNumbers, Fonts, ShortcutNumbers, XpBar, CRITICAL_HP_COLOR,
/*FOCUS_COLOR, RAGE_COLOR,*/ HP_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR,
};
use crate::GlobalState;
@ -546,173 +546,80 @@ impl<'a> Widget for Skillbar<'a> {
.set(state.ids.slotq_text, ui);
};
// Option to show Energy Bars only on loss or Always
match self.global_state.settings.gameplay.en_bars {
EnBars::OnLoss => {
if { self.stats.health.current() < self.stats.health.maximum() } || {
self.stats.energy.current() < self.stats.energy.maximum()
} {
// Lifebar
Image::new(self.imgs.healthbar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_left_with_margins_on(state.ids.m1_slot, 0.0, -100.0 * scale)
.set(state.ids.healthbar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * hp_percentage / 100.0, 16.0 * scale)
.color(Some(if hp_percentage <= 20.0 {
CRITICAL_HP_COLOR
} else if hp_percentage <= 40.0 {
LOW_HP_COLOR
} else {
HP_COLOR
}))
.top_right_with_margins_on(state.ids.healthbar_bg, 2.0 * scale, 1.0 * scale)
.set(state.ids.healthbar_filling, ui);
// Energybar
Image::new(self.imgs.energybar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_right_with_margins_on(state.ids.m2_slot, 0.0, -100.0 * scale)
.set(state.ids.energybar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * energy_percentage / 100.0, 16.0 * scale)
.top_left_with_margins_on(state.ids.energybar_bg, 2.0 * scale, 1.0 * scale)
.color(Some(match self.current_resource {
ResourceType::Mana => MANA_COLOR,
//ResourceType::Focus => FOCUS_COLOR,
//ResourceType::Rage => RAGE_COLOR,
}))
.set(state.ids.energybar_filling, ui);
// Bar Text
// Values
if let BarNumbers::Values = bar_values {
let hp_text = format!(
"{}/{}",
self.stats.health.current() as u32,
self.stats.health.maximum() as u32
);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!(
"{}/{}",
self.stats.energy.current() as u32,
self.stats.energy.maximum() as u32
);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
//Percentages
if let BarNumbers::Percent = bar_values {
let hp_text = format!("{}%", hp_percentage as u32);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!("{}%", energy_percentage as u32);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
} else {
// Lifebar
Image::new(self.imgs.healthbar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.8)))
.top_left_with_margins_on(state.ids.m1_slot, 0.0, -100.0 * scale)
.set(state.ids.healthbar_bg, ui);
// Energybar
Image::new(self.imgs.energybar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.8)))
.top_right_with_margins_on(state.ids.m2_slot, 0.0, -100.0 * scale)
.set(state.ids.energybar_bg, ui);
}
}
EnBars::Always => {
// Lifebar
Image::new(self.imgs.healthbar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_left_with_margins_on(state.ids.m1_slot, 0.0, -100.0 * scale)
.set(state.ids.healthbar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * hp_percentage / 100.0, 16.0 * scale)
.color(Some(if hp_percentage <= 20.0 {
CRITICAL_HP_COLOR
} else if hp_percentage <= 40.0 {
LOW_HP_COLOR
} else {
HP_COLOR
}))
.top_right_with_margins_on(state.ids.healthbar_bg, 2.0 * scale, 1.0 * scale)
.set(state.ids.healthbar_filling, ui);
// Energybar
Image::new(self.imgs.energybar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_right_with_margins_on(state.ids.m2_slot, 0.0, -100.0 * scale)
.set(state.ids.energybar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * energy_percentage / 100.0, 16.0 * scale)
.top_left_with_margins_on(state.ids.energybar_bg, 2.0 * scale, 1.0 * scale)
.color(Some(match self.current_resource {
ResourceType::Mana => MANA_COLOR,
//ResourceType::Focus => FOCUS_COLOR,
//ResourceType::Rage => RAGE_COLOR,
}))
.set(state.ids.energybar_filling, ui);
// Bar Text
// Values
if let BarNumbers::Values = bar_values {
let hp_text = format!(
"{}/{}",
self.stats.health.current() as u32,
self.stats.health.maximum() as u32
);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!(
"{}/{}",
self.stats.energy.current() as u32,
self.stats.energy.maximum() as u32
);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
//Percentages
if let BarNumbers::Percent = bar_values {
let hp_text = format!("{}%", hp_percentage as u32);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!("{}%", energy_percentage as u32);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
}
// Lifebar
Image::new(self.imgs.healthbar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_left_with_margins_on(state.ids.m1_slot, 0.0, -100.0 * scale)
.set(state.ids.healthbar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * hp_percentage / 100.0, 16.0 * scale)
.color(Some(if hp_percentage <= 20.0 {
CRITICAL_HP_COLOR
} else if hp_percentage <= 40.0 {
LOW_HP_COLOR
} else {
HP_COLOR
}))
.top_right_with_margins_on(state.ids.healthbar_bg, 2.0 * scale, 1.0 * scale)
.set(state.ids.healthbar_filling, ui);
// Energybar
Image::new(self.imgs.energybar_bg)
.w_h(100.0 * scale, 20.0 * scale)
.top_right_with_margins_on(state.ids.m2_slot, 0.0, -100.0 * scale)
.set(state.ids.energybar_bg, ui);
Image::new(self.imgs.bar_content)
.w_h(97.0 * scale * energy_percentage / 100.0, 16.0 * scale)
.top_left_with_margins_on(state.ids.energybar_bg, 2.0 * scale, 1.0 * scale)
.color(Some(match self.current_resource {
ResourceType::Mana => MANA_COLOR,
//ResourceType::Focus => FOCUS_COLOR,
//ResourceType::Rage => RAGE_COLOR,
}))
.set(state.ids.energybar_filling, ui);
// Bar Text
// Values
if let BarNumbers::Values = bar_values {
let hp_text = format!(
"{}/{}",
self.stats.health.current() as u32,
self.stats.health.maximum() as u32
);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!(
"{}/{}",
self.stats.energy.current() as u32,
self.stats.energy.maximum() as u32
);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
//Percentages
if let BarNumbers::Percent = bar_values {
let hp_text = format!("{}%", hp_percentage as u32);
Text::new(&hp_text)
.mid_top_with_margin_on(state.ids.healthbar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.health_text, ui);
let energy_text = format!("{}%", energy_percentage as u32);
Text::new(&energy_text)
.mid_top_with_margin_on(state.ids.energybar_bg, 5.0 * scale)
.font_size(14)
.color(TEXT_COLOR)
.set(state.ids.energy_text, ui);
}
// Buffs
// Add debuff slots above the health bar
// Add buff slots above the mana bar
// Debuffs
}
// Buffs
// Add debuff slots above the health bar
// Add buff slots above the mana bar
// Debuffs
}

View File

@ -5,6 +5,7 @@ use crate::{
SpritePipeline, TerrainLocals, TerrainPipeline,
},
};
use client::Client;
use common::{
assets,
@ -62,49 +63,73 @@ fn sprite_config_for(kind: BlockKind) -> Option<SpriteConfig> {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::RoundCactus => Some(SpriteConfig {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::ShortCactus => Some(SpriteConfig {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::MedFlatCactus => Some(SpriteConfig {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::ShortFlatCactus => Some(SpriteConfig {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::BlueFlower => Some(SpriteConfig {
variations: 2,
wind_sway: 0.3,
variations: 5,
wind_sway: 0.1,
}),
BlockKind::PinkFlower => Some(SpriteConfig {
variations: 3,
wind_sway: 0.3,
variations: 4,
wind_sway: 0.1,
}),
BlockKind::RedFlower => Some(SpriteConfig {
variations: 1,
wind_sway: 0.3,
variations: 2,
wind_sway: 0.1,
}),
BlockKind::WhiteFlower => Some(SpriteConfig {
variations: 1,
wind_sway: 0.3,
wind_sway: 0.1,
}),
BlockKind::YellowFlower => Some(SpriteConfig {
variations: 1,
wind_sway: 0.3,
wind_sway: 0.1,
}),
BlockKind::Sunflower => Some(SpriteConfig {
variations: 2,
wind_sway: 0.3,
wind_sway: 0.1,
}),
BlockKind::LongGrass => Some(SpriteConfig {
variations: 5,
wind_sway: 1.0,
variations: 7,
wind_sway: 0.8,
}),
BlockKind::MediumGrass => Some(SpriteConfig {
variations: 5,
wind_sway: 1.0,
wind_sway: 0.5,
}),
BlockKind::ShortGrass => Some(SpriteConfig {
variations: 5,
wind_sway: 1.0,
wind_sway: 0.1,
}),
BlockKind::Apple => Some(SpriteConfig {
variations: 1,
wind_sway: 0.0,
}),
BlockKind::Mushroom => Some(SpriteConfig {
variations: 10,
wind_sway: 0.0,
}),
BlockKind::Liana => Some(SpriteConfig {
variations: 2,
wind_sway: 0.05,
}),
_ => None,
}
}
@ -137,7 +162,7 @@ fn mesh_worker(
let kind = volume.get(wpos).unwrap_or(&Block::empty()).kind();
if let Some(cfg) = sprite_config_for(kind) {
let seed = wpos.x * 3 + wpos.y * 7 + wpos.z * 13 + wpos.x * wpos.y;
let seed = wpos.x * 3 + wpos.y * 7 + wpos.x * wpos.y; // Awful PRNG
let instance = SpriteInstance::new(
Mat4::identity()
@ -183,12 +208,12 @@ impl Terrain {
// worker threads that are meshing chunks.
let (send, recv) = channel::unbounded();
let mut make_model = |s| {
let mut make_model = |s, offset| {
renderer
.create_model(
&Meshable::<SpritePipeline, SpritePipeline>::generate_mesh(
&Segment::from(assets::load_expect::<DotVoxData>(s).as_ref()),
Vec3::new(-6.0, -6.0, 0.0),
offset,
)
.0,
)
@ -204,122 +229,370 @@ impl Terrain {
// Cacti
(
(BlockKind::LargeCactus, 0),
make_model("voxygen.voxel.sprite.cacti.large_cactus"),
make_model(
"voxygen.voxel.sprite.cacti.large_cactus",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::BarrelCactus, 0),
make_model("voxygen.voxel.sprite.cacti.barrel_cactus"),
make_model(
"voxygen.voxel.sprite.cacti.barrel_cactus",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::RoundCactus, 0),
make_model(
"voxygen.voxel.sprite.cacti.cactus_round",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortCactus, 0),
make_model(
"voxygen.voxel.sprite.cacti.cactus_short",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MedFlatCactus, 0),
make_model(
"voxygen.voxel.sprite.cacti.flat_cactus_med",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortFlatCactus, 0),
make_model(
"voxygen.voxel.sprite.cacti.flat_cactus_short",
Vec3::new(-6.0, -6.0, 0.0),
),
),
// Fruit
(
(BlockKind::Apple, 0),
make_model("voxygen.voxel.sprite.fruit.apple"),
make_model(
"voxygen.voxel.sprite.fruit.apple",
Vec3::new(-6.0, -6.0, 0.0),
),
),
// Flowers
(
(BlockKind::BlueFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_blue_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_blue_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::BlueFlower, 1),
make_model("voxygen.voxel.sprite.flowers.flower_blue_2"),
make_model(
"voxygen.voxel.sprite.flowers.flower_blue_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::BlueFlower, 2),
make_model(
"voxygen.voxel.sprite.flowers.flower_blue_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::BlueFlower, 3),
make_model(
"voxygen.voxel.sprite.flowers.flower_blue_4",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::BlueFlower, 4),
make_model(
"voxygen.voxel.sprite.flowers.flower_blue_5",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::PinkFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_pink_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_pink_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::PinkFlower, 1),
make_model("voxygen.voxel.sprite.flowers.flower_pink_2"),
make_model(
"voxygen.voxel.sprite.flowers.flower_pink_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::PinkFlower, 2),
make_model("voxygen.voxel.sprite.flowers.flower_pink_3"),
make_model(
"voxygen.voxel.sprite.flowers.flower_pink_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::PinkFlower, 3),
make_model(
"voxygen.voxel.sprite.flowers.flower_pink_4",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::PurpleFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_purple_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_purple_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::RedFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_red_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_red_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::RedFlower, 1),
make_model(
"voxygen.voxel.sprite.flowers.flower_red_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::WhiteFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_white_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_white_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::YellowFlower, 0),
make_model("voxygen.voxel.sprite.flowers.flower_purple_1"),
make_model(
"voxygen.voxel.sprite.flowers.flower_purple_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Sunflower, 0),
make_model("voxygen.voxel.sprite.flowers.sunflower_1"),
make_model(
"voxygen.voxel.sprite.flowers.sunflower_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Sunflower, 1),
make_model("voxygen.voxel.sprite.flowers.sunflower_2"),
make_model(
"voxygen.voxel.sprite.flowers.sunflower_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
// Grass
(
(BlockKind::LongGrass, 0),
make_model("voxygen.voxel.sprite.grass.grass_long_1"),
make_model(
"voxygen.voxel.sprite.grass.grass_long_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 1),
make_model("voxygen.voxel.sprite.grass.grass_long_2"),
make_model(
"voxygen.voxel.sprite.grass.grass_long_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 2),
make_model("voxygen.voxel.sprite.grass.grass_long_3"),
make_model(
"voxygen.voxel.sprite.grass.grass_long_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 3),
make_model("voxygen.voxel.sprite.grass.grass_long_4"),
make_model(
"voxygen.voxel.sprite.grass.grass_long_4",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 4),
make_model("voxygen.voxel.sprite.grass.grass_long_5"),
make_model(
"voxygen.voxel.sprite.grass.grass_long_5",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 5),
make_model(
"voxygen.voxel.sprite.grass.grass_long_6",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::LongGrass, 6),
make_model(
"voxygen.voxel.sprite.grass.grass_long_7",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MediumGrass, 0),
make_model("voxygen.voxel.sprite.grass.grass_med_1"),
make_model(
"voxygen.voxel.sprite.grass.grass_med_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MediumGrass, 1),
make_model("voxygen.voxel.sprite.grass.grass_med_2"),
make_model(
"voxygen.voxel.sprite.grass.grass_med_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MediumGrass, 2),
make_model("voxygen.voxel.sprite.grass.grass_med_3"),
make_model(
"voxygen.voxel.sprite.grass.grass_med_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MediumGrass, 3),
make_model("voxygen.voxel.sprite.grass.grass_med_4"),
make_model(
"voxygen.voxel.sprite.grass.grass_med_4",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::MediumGrass, 4),
make_model("voxygen.voxel.sprite.grass.grass_med_5"),
make_model(
"voxygen.voxel.sprite.grass.grass_med_5",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortGrass, 0),
make_model("voxygen.voxel.sprite.grass.grass_short_1"),
make_model(
"voxygen.voxel.sprite.grass.grass_short_1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortGrass, 1),
make_model("voxygen.voxel.sprite.grass.grass_short_2"),
make_model(
"voxygen.voxel.sprite.grass.grass_short_2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortGrass, 2),
make_model("voxygen.voxel.sprite.grass.grass_short_3"),
make_model(
"voxygen.voxel.sprite.grass.grass_short_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortGrass, 3),
make_model("voxygen.voxel.sprite.grass.grass_short_3"),
make_model(
"voxygen.voxel.sprite.grass.grass_short_3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::ShortGrass, 4),
make_model("voxygen.voxel.sprite.grass.grass_short_5"),
make_model(
"voxygen.voxel.sprite.grass.grass_short_5",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 0),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-0",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 1),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-1",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 2),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-2",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 3),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-3",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 4),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-4",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 5),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-5",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 6),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-6",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 7),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-7",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 8),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-8",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Mushroom, 9),
make_model(
"voxygen.voxel.sprite.mushrooms.mushroom-9",
Vec3::new(-6.0, -6.0, 0.0),
),
),
(
(BlockKind::Liana, 0),
make_model(
"voxygen.voxel.sprite.lianas.liana-0",
Vec3::new(-1.5, -0.5, -88.0),
),
),
(
(BlockKind::Liana, 1),
make_model(
"voxygen.voxel.sprite.lianas.liana-1",
Vec3::new(-1.0, -0.5, -55.0),
),
),
]
.into_iter()

View File

@ -342,10 +342,6 @@ impl PlayState for SessionState {
global_state.settings.gameplay.xp_bar = xp_bar;
global_state.settings.save_to_file_warn();
}
HudEvent::ToggleEnBars(en_bars) => {
global_state.settings.gameplay.en_bars = en_bars;
global_state.settings.save_to_file_warn();
}
HudEvent::ToggleBarNumbers(bar_numbers) => {
global_state.settings.gameplay.bar_numbers = bar_numbers;
global_state.settings.save_to_file_warn();

View File

@ -1,5 +1,5 @@
use crate::{
hud::{BarNumbers, CrosshairType, EnBars, ShortcutNumbers, XpBar},
hud::{BarNumbers, CrosshairType, ShortcutNumbers, XpBar},
ui::ScaleMode,
window::KeyMouse,
};
@ -87,7 +87,6 @@ pub struct GameplaySettings {
pub crosshair_transp: f32,
pub crosshair_type: CrosshairType,
pub xp_bar: XpBar,
pub en_bars: EnBars,
pub shortcut_numbers: ShortcutNumbers,
pub bar_numbers: BarNumbers,
pub ui_scale: ScaleMode,
@ -101,7 +100,6 @@ impl Default for GameplaySettings {
crosshair_transp: 0.6,
crosshair_type: CrosshairType::Round,
xp_bar: XpBar::OnGain,
en_bars: EnBars::OnLoss,
shortcut_numbers: ShortcutNumbers::On,
bar_numbers: BarNumbers::Off,
ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()),
@ -182,10 +180,10 @@ impl Default for AudioSettings {
fn default() -> Self {
Self {
master_volume: 1.0,
music_volume: 0.5,
sfx_volume: 0.5,
music_volume: 0.4,
sfx_volume: 0.6,
audio_device: None,
audio_on: true,
audio_on: false,
}
}
}

View File

@ -265,6 +265,7 @@ impl<'a> BlockGen<'a> {
BlockKind::WhiteFlower,
BlockKind::YellowFlower,
BlockKind::Sunflower,
BlockKind::Mushroom,
];
let grasses = [
@ -285,11 +286,20 @@ impl<'a> BlockGen<'a> {
&& temp > CONFIG.desert_temp
&& (marble * 4423.5).fract() < 0.0005
{
let large_cacti = [BlockKind::LargeCactus, BlockKind::MedFlatCactus];
let small_cacti = [
BlockKind::BarrelCactus,
BlockKind::RoundCactus,
BlockKind::ShortCactus,
BlockKind::ShortFlatCactus,
];
Some(Block::new(
if (height * 1271.0).fract() < 0.5 {
BlockKind::LargeCactus
large_cacti[(height * 0.2) as usize % large_cacti.len()]
} else {
BlockKind::BarrelCactus
small_cacti[(height * 0.3) as usize % small_cacti.len()]
},
Rgb::broadcast(0),
))
@ -565,6 +575,20 @@ pub fn block_from_structure(
.map(|e| e as u8),
)),
StructureBlock::Fruit => Some(Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))),
StructureBlock::Liana => Some(Block::new(
BlockKind::Liana,
Lerp::lerp(
Rgb::new(0.0, 125.0, 107.0),
Rgb::new(0.0, 155.0, 129.0),
lerp,
)
.map(|e| e as u8),
)),
StructureBlock::Mangrove => Some(Block::new(
BlockKind::Normal,
Lerp::lerp(Rgb::new(32.0, 56.0, 22.0), Rgb::new(57.0, 69.0, 27.0), lerp)
.map(|e| e as u8),
)),
StructureBlock::Hollow => Some(Block::empty()),
StructureBlock::Normal(color) => {
Some(Block::new(default_kind, color)).filter(|block| !block.is_empty())

View File

@ -440,16 +440,16 @@ lazy_static! {
.with_center(Vec3::new(18, 16, 8)))
.unwrap(),
assets::load_map("world.tree.mangroves.5", |s: Structure| s
.with_center(Vec3::new(16, 17, 8)))
.with_center(Vec3::new(19, 20, 9)))
.unwrap(),
assets::load_map("world.tree.mangroves.6", |s: Structure| s
.with_center(Vec3::new(18, 18, 8)))
.with_center(Vec3::new(18, 18, 9)))
.unwrap(),
assets::load_map("world.tree.mangroves.7", |s: Structure| s
.with_center(Vec3::new(18, 17, 8)))
.with_center(Vec3::new(18, 17, 9)))
.unwrap(),
assets::load_map("world.tree.mangroves.8", |s: Structure| s
.with_center(Vec3::new(18, 18, 8)))
.with_center(Vec3::new(18, 18, 9)))
.unwrap(),
];