Address comments, clippy and minor adjustments

first bunch of comments addressed

change order or scatter, paths and caves being applied in worldgen to avoid floating scatter objects

campfire adjustments, reduced grass density due to FPS issues

readded item descriptions to the crafting window, item desc for craftable armour

address comments
happy clippy, happy life
clippy

clippy

more clippy
fmt

revert cargo.toml formatting
remove "allow unreachable pattern"
fmt
This commit is contained in:
Monty Marz 2020-08-21 22:37:08 +02:00
parent e3eb34085f
commit ce929d2924
23 changed files with 186 additions and 256 deletions

10
Cargo.lock generated
View File

@ -1309,15 +1309,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "format_num"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14ac05eb8d2eb4ed1eeff847911deae077b0b53332465de9d6a26b0ea9961bc8"
dependencies = [
"regex",
]
[[package]]
name = "fsevent"
version = "2.0.2"
@ -4775,7 +4766,6 @@ dependencies = [
"dot_vox",
"euc",
"failure",
"format_num",
"gfx",
"gfx_device_gl",
"gfx_gl",

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Cape",
description: "Keeps your shoulders warm.",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Back("Short2"),

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Belt",
description: "",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Belt("Leather2"),

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Chest",
description: " ",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Chest("Leather2"),

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Kickers",
description: "",
description: "'Tightly packed pieces of leather to endure all weather.",
kind: Armor(
(
kind: Foot("Leather2"),

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Gauntlets",
description: "",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Hand("Leather2"),

View File

@ -1,6 +1,6 @@
Item(
name: "Agile Pantalons",
description: "",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Pants("Leather2"),

View File

@ -1,9 +1,9 @@
Item(
name: "Agile Guards",
description: "",
description: "'Tightly packed pieces of leather to endure all weather.'",
kind: Armor(
(
kind: Shoulder("Leather1"),
kind: Shoulder("Leather2"),
stats: (
protection: Normal(6.0),
),

View File

@ -65,11 +65,14 @@ VoxygenLocalization(
"common.create": "Oluştur",
"common.okay": "Tamam",
"common.accept": "Kabul Et",
"common.decline": "Reddet",
"common.disclaimer": "Uyarı",
"common.cancel": "İptal Et",
"common.none": "Yok",
"common.error": "Hata",
"common.fatal_error": "Ölümcül hata",
"common.you": "Sen",
"common.automatic": "Otomatik",
// Message when connection to the server is lost
"common.connection_lost": r#"Bağlantı koptu!
@ -302,23 +305,30 @@ edince kapat"#,
"hud.settings.fluid_rendering_mode.cheap": "Basit",
"hud.settings.fluid_rendering_mode.shiny": "Güzel",
"hud.settings.cloud_rendering_mode.regular": "Normal",
"hud.settings.particles": "Partiküller",
"hud.settings.resolution": "Çözünürlük",
"hud.settings.bit_depth": "Bit Derinliği",
"hud.settings.refresh_rate": "Yenileme Hızı",
"hud.settings.fullscreen": "Tam ekran",
"hud.settings.save_window_size": "Pencere boyutunu kaydet",
"hud.settings.awaitingkey": "Bir tuşa bas...",
"hud.settings.unbound": "Atanmamış",
"hud.settings.reset_keybinds": "Varsayılana döndür",
"hud.settings.music_volume": "Müzik Sesi",
"hud.settings.sound_effect_volume": "Efekt Sesi",
"hud.settings.audio_device": "Ses Aygıtı",
"hud.social": "Sosyal",
"hud.social.online": "Çevrimiçi",
"hud.settings.awaitingkey": "Bir tuşa bas...",
"hud.settings.unbound": "Atanmamış",
"hud.settings.reset_keybinds": "Varsayılana döndür",
"hud.social": "Diğer Oyuncular",
"hud.social.online": "Çevrimiçi:",
"hud.social.friends": "Arkadaşlar",
"hud.social.not_yet_available": "Şu anda kullanılabilir değil",
"hud.social.faction": "Klan",
"hud.social.play_online_fmt": "{nb_player} oyuncu çevrimiçi",
"hud.social.name": "İsim",
"hud.social.level": "Seviye",
"hud.social.zone": "Bölge",
"hud.crafting": "Üretim",
"hud.crafting.recipes": "Tarifler",
@ -326,6 +336,19 @@ edince kapat"#,
"hud.crafting.craft": "Üret",
"hud.crafting.tool_cata": "Gerektiriyor:",
"hud.group": "Grup",
"hud.group.invite_to_join": "{name} seni grubuna davet etti!",
"hud.group.invite": "Davet Et",
"hud.group.kick": "Gruptan At",
"hud.group.assign_leader": "Lider Seç",
"hud.group.leave": "Gruptan Ayrıl",
"hud.group.dead" : "Ölü",
"hud.group.out_of_range": "Erişim dışı",
"hud.group.add_friend": "Arkadaşlara Ekle",
"hud.group.link_group": "Grupları Bağla",
"hud.group.in_menu": "Menüde",
"hud.group.members": "Grup Üyeleri",
"hud.spell": "Büyü",
"hud.free_look_indicator": "Serbest bakış açık",
@ -368,7 +391,7 @@ edince kapat"#,
"gameinput.wallleap": "Duvar Sıçrayışı",
"gameinput.togglelantern": "Feneri yak/söndür",
"gameinput.mount": "Bin",
"gameinput.enter": "Sohbet",
"gameinput.chat": "Sohbet",
"gameinput.command": "Komut",
"gameinput.escape": "Oyunu Duraklat",
"gameinput.map": "Harita",
@ -384,6 +407,13 @@ edince kapat"#,
"gameinput.freelook": "Serbest Bakış",
"gameinput.autowalk": "Otomatik Yürüyüş",
"gameinput.dance": "Dans et",
"gameinput.select": "Varlık Seç",
"gameinput.acceptgroupinvite": "Grup Davetini Kabul Et",
"gameinput.declinegroupinvite": "Grup Davetini Reddet",
"gameinput.crafting": "Üretim",
"gameinput.sneak": "Eğil",
"gameinput.swimdown": "Aşağı Dal",
"gameinput.swimup": "Yüzeye çık",
/// End GameInput section
@ -456,6 +486,8 @@ Koruma
"'L-Shift'e basarak Planörünü aç ve gökyüzünü fethet.",
"Veloren hala Pre-Alpha'da. Onu geliştirmek için her gün elimizden geleni yapıyoruz!",
"Geliştirme Takımına katılmak istiyorsan veya sadece sohbet etmek istiyorsan Discord sunucumuza katıl.",
"Can barında canı sayı olarak görmek istiyorsan, bunu ayarlardan aktifleştirebilirsin.",
"Niteliklerini görmek için envanterindeki 'Nitelikler' düğmesine tıklayabilirsin.",
],
"npc.speech.villager_under_attack": [
"Saldırı altındayım, yardım edin!",

View File

@ -109,10 +109,10 @@ void main() {
attr = Attr(
linear_motion(
vec3(0.0, 0.0, 0.0),
vec3(rand2 * 0.02, rand3 * 0.02, 1.0 + rand4 * 0.1)
vec3(rand2 * 0.1, rand3 * 0.1, 1.0 + rand4 * 0.1)
),
linear_scale(0.5),
vec4(1, 1, 1, start_end(1.0, 0.0)),
linear_scale(0.2),
vec4(1, 1, 1, start_end(0.1, 0.0)),
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 0.5)
);
} else if (inst_mode == FIRE) {
@ -121,7 +121,7 @@ void main() {
vec3(rand0 * 0.3, rand1 * 0.3, 0.2),
vec3(rand1 * 0.1, rand3 * 0.1, 3.0 + rand4 * 1.2)
),
1.0,
1.3,
vec4(2, 0.8 + rand5 * 0.3, 0, 1),
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
);

View File

@ -28,7 +28,6 @@ impl Alignment {
match (self, other) {
(Alignment::Enemy, Alignment::Enemy) => false,
(Alignment::Enemy, Alignment::Wild) => false,
(Alignment::Enemy, Alignment::Tame) => true,
(Alignment::Wild, Alignment::Enemy) => false,
(Alignment::Wild, Alignment::Wild) => false,
(Alignment::Npc, Alignment::Wild) => false,
@ -69,7 +68,6 @@ impl Component for Alignment {
pub struct Psyche {
pub aggro: f32, // 0.0 = always flees, 1.0 = always attacks, 0.5 = flee at 50% health
}
#[allow(unreachable_patterns)]
impl<'a> From<&'a Body> for Psyche {
fn from(body: &'a Body) -> Self {
Self {
@ -81,7 +79,6 @@ impl<'a> From<&'a Body> for Psyche {
humanoid::Species::Human => 0.95,
humanoid::Species::Orc => 1.0,
humanoid::Species::Undead => 1.0,
_ => 1.0,
},
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
quadruped_small::Species::Pig => 0.5,
@ -100,7 +97,6 @@ impl<'a> From<&'a Body> for Psyche {
quadruped_small::Species::Rabbit => 0.1,
quadruped_small::Species::Truffler => 0.8,
quadruped_small::Species::Frog => 0.6,
_ => 1.0,
},
Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species {
quadruped_medium::Species::Tuskram => 0.8,
@ -119,7 +115,6 @@ impl<'a> From<&'a Body> for Psyche {
quadruped_low::Species::Rocksnapper => 1.0,
quadruped_low::Species::Pangolin => 0.6,
quadruped_low::Species::Maneater => 1.0,
_ => 1.0,
},
Body::BirdMedium(_) => 1.0,
Body::BirdSmall(_) => 0.4,

View File

@ -217,9 +217,7 @@ impl Body {
_ => 100,
},
Body::FishMedium(_) => 50,
Body::Dragon(dragon) => match dragon.species {
_ => 5000,
},
Body::Dragon(_) => 5000,
Body::BirdSmall(_) => 50,
Body::FishSmall(_) => 20,
Body::BipedLarge(biped_large) => match biped_large.species {
@ -231,12 +229,8 @@ impl Body {
_ => 1000,
},
Body::Object(_) => 10000,
Body::Golem(golem) => match golem.species {
_ => 1500,
},
Body::Critter(critter) => match critter.species {
_ => 50,
},
Body::Golem(_) => 1500,
Body::Critter(_) => 50,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 600,
quadruped_low::Species::Alligator => 600,
@ -290,9 +284,7 @@ impl Body {
_ => 20,
},
Body::FishMedium(_) => 10,
Body::Dragon(dragon) => match dragon.species {
_ => 500,
},
Body::Dragon(_) => 500,
Body::BirdSmall(_) => 10,
Body::FishSmall(_) => 10,
Body::BipedLarge(biped_large) => match biped_large.species {
@ -304,12 +296,8 @@ impl Body {
_ => 100,
},
Body::Object(_) => 10,
Body::Golem(golem) => match golem.species {
_ => 150,
},
Body::Critter(critter) => match critter.species {
_ => 20,
},
Body::Golem(_) => 150,
Body::Critter(_) => 20,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 20,
quadruped_low::Species::Alligator => 20,
@ -361,9 +349,7 @@ impl Body {
_ => 8,
},
Body::FishMedium(_) => 2,
Body::Dragon(dragon) => match dragon.species {
_ => 1000,
},
Body::Dragon(_) => 1000,
Body::BirdSmall(_) => 2,
Body::FishSmall(_) => 2,
Body::BipedLarge(biped_large) => match biped_large.species {
@ -375,12 +361,8 @@ impl Body {
_ => 100,
},
Body::Object(_) => 1,
Body::Golem(golem) => match golem.species {
_ => 75,
},
Body::Critter(critter) => match critter.species {
_ => 2,
},
Body::Golem(_) => 75,
Body::Critter(_) => 2,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 10,
quadruped_low::Species::Alligator => 10,
@ -400,34 +382,18 @@ impl Body {
pub fn base_exp_increase(&self) -> u32 {
match self {
Body::Humanoid(_) => 2,
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
_ => 1,
},
Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species {
_ => 1,
},
Body::BirdMedium(bird_medium) => match bird_medium.species {
_ => 1,
},
Body::QuadrupedSmall(_) => 1,
Body::QuadrupedMedium(_) => 1,
Body::BirdMedium(_) => 1,
Body::FishMedium(_) => 1,
Body::Dragon(dragon) => match dragon.species {
_ => 32,
},
Body::Dragon(_) => 32,
Body::BirdSmall(_) => 1,
Body::FishSmall(_) => 1,
Body::BipedLarge(biped_large) => match biped_large.species {
_ => 2,
},
Body::BipedLarge(_) => 2,
Body::Object(_) => 0,
Body::Golem(golem) => match golem.species {
_ => 5,
},
Body::Critter(critter) => match critter.species {
_ => 1,
},
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
_ => 1,
},
Body::Golem(_) => 5,
Body::Critter(_) => 1,
Body::QuadrupedLow(_) => 1,
}
}
@ -460,9 +426,7 @@ impl Body {
_ => 30,
},
Body::FishMedium(_) => 10,
Body::Dragon(dragon) => match dragon.species {
_ => 5000,
},
Body::Dragon(_) => 5000,
Body::BirdSmall(_) => 10,
Body::FishSmall(_) => 10,
Body::BipedLarge(biped_large) => match biped_large.species {
@ -474,12 +438,8 @@ impl Body {
_ => 60,
},
Body::Object(_) => 0,
Body::Golem(golem) => match golem.species {
_ => 250,
},
Body::Critter(critter) => match critter.species {
_ => 10,
},
Body::Golem(_) => 250,
Body::Critter(_) => 10,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 50,
quadruped_low::Species::Alligator => 50,
@ -495,38 +455,21 @@ impl Body {
}
}
#[allow(unreachable_patterns)]
pub fn base_range(&self) -> f32 {
match self {
Body::Humanoid(_) => 5.0,
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
_ => 4.5,
},
Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species {
_ => 5.5,
},
Body::BirdMedium(bird_medium) => match bird_medium.species {
_ => 3.5,
},
Body::QuadrupedSmall(_) => 4.5,
Body::QuadrupedMedium(_) => 5.5,
Body::BirdMedium(_) => 3.5,
Body::FishMedium(_) => 3.5,
Body::Dragon(dragon) => match dragon.species {
_ => 12.5,
},
Body::Dragon(_) => 12.5,
Body::BirdSmall(_) => 3.0,
Body::FishSmall(_) => 3.0,
Body::BipedLarge(biped_large) => match biped_large.species {
_ => 10.0,
},
Body::BipedLarge(_) => 10.0,
Body::Object(_) => 3.0,
Body::Golem(golem) => match golem.species {
_ => 7.5,
},
Body::Critter(critter) => match critter.species {
_ => 3.0,
},
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
_ => 4.5,
},
Body::Golem(_) => 7.5,
Body::Critter(_) => 3.0,
Body::QuadrupedLow(_) => 4.5,
}
}
}

View File

@ -619,12 +619,12 @@ fn handle_spawn(
);
} else if let Some(group) = match alignment {
comp::Alignment::Wild => None,
comp::Alignment::Passive => None,
comp::Alignment::Enemy => Some(comp::group::ENEMY),
comp::Alignment::Npc | comp::Alignment::Tame => {
Some(comp::group::NPC)
},
comp::Alignment::Owned(_) => unreachable!(),
_ => None,
} {
let _ =
server.state.ecs().write_storage().insert(new_entity, group);

View File

@ -1,8 +1,8 @@
use crate::{sys, Server, StateExt};
use common::{
comp::{
self, Agent, Alignment, Body, Gravity, Item, ItemDrop, LightEmitter, Loadout, Pos,
Projectile, Scale, Stats, Vel, WaypointArea,
self, Agent, Alignment, Body, Gravity, Item, ItemDrop, LightAnimation, LightEmitter,
Loadout, Pos, Projectile, Scale, Stats, Vel, WaypointArea,
},
outcome::Outcome,
util::Dir,
@ -40,11 +40,11 @@ pub fn handle_create_npc(
) {
let group = match alignment {
Alignment::Wild => None,
Alignment::Passive => None,
Alignment::Enemy => Some(group::ENEMY),
Alignment::Npc | Alignment::Tame => Some(group::NPC),
// TODO: handle
Alignment::Owned(_) => None,
_ => None,
};
let entity = server
@ -124,6 +124,11 @@ pub fn handle_create_waypoint(server: &mut Server, pos: Vec3<f32>) {
flicker: 1.0,
animated: true,
})
.with(LightAnimation {
offset: Vec3::new(0.0, 0.0, 2.0),
col: Rgb::new(1.0, 0.8, 0.0),
strength: 8.0,
})
.with(WaypointArea::default())
.build();
}

View File

@ -233,106 +233,80 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
},
}
},
Some(common::comp::Body::QuadrupedMedium(quadruped_medium)) => {
match quadruped_medium.species {
_ => match rng.gen_range(0, 4) {
0 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_food",
),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
2 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
_ => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
},
}
Some(common::comp::Body::QuadrupedMedium(_)) => match rng.gen_range(0, 4) {
0 => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food"),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
2 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
_ => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
},
Some(common::comp::Body::BirdMedium(bird_medium)) => match bird_medium.species {
_ => match rng.gen_range(0, 3) {
0 => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food")
},
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
Some(common::comp::Body::BirdMedium(_)) => match rng.gen_range(0, 3) {
0 => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food"),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
Some(common::comp::Body::BipedLarge(biped_large)) => match biped_large.species {
_ => match rng.gen_range(0, 8) {
0 => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food")
},
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_nature",
),
3 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_heavy",
),
5 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_uncommon",
),
6 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_rare",
),
_ => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_cave_large",
),
},
Some(common::comp::Body::BipedLarge(_)) => match rng.gen_range(0, 8) {
0 => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food"),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_nature",
),
3 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_heavy",
),
5 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_uncommon",
),
6 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_rare",
),
_ => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_cave_large",
),
},
Some(common::comp::Body::Golem(golem)) => match golem.species {
_ => match rng.gen_range(0, 9) {
0 => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food")
},
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
2 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_light",
),
3 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_heavy",
),
4 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
5 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_common",
),
6 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_uncommon",
),
7 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_rare",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
Some(common::comp::Body::Golem(_)) => match rng.gen_range(0, 9) {
0 => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food"),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
2 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_light",
),
3 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_heavy",
),
4 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_armor_misc",
),
5 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_common",
),
6 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_uncommon",
),
7 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_weapon_rare",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
Some(common::comp::Body::Critter(critter)) => match critter.species {
_ => match rng.gen_range(0, 3) {
_ => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
},
Some(common::comp::Body::Critter(_)) => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_animal_parts")
},
Some(common::comp::Body::Dragon(_)) => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_weapon_rare")
},
Some(common::comp::Body::QuadrupedLow(quadruped_low)) => match quadruped_low.species {
_ => match rng.gen_range(0, 3) {
0 => {
assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food")
},
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
Some(common::comp::Body::QuadrupedLow(_)) => match rng.gen_range(0, 3) {
0 => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table_food"),
1 => assets::load_expect::<Lottery<String>>(
"common.loot_tables.loot_table_animal_parts",
),
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
},
_ => assets::load_expect::<Lottery<String>>("common.loot_tables.loot_table"),
};

View File

@ -47,7 +47,6 @@ gilrs = { version = "0.7", features = ["serde"] }
server = { package = "veloren-server", path = "../server", optional = true }
# Utility
format_num = "0.1.0"
glsl-include = "0.3.1"
failure = "0.1.6"
dot_vox = "4.0"

View File

@ -246,24 +246,20 @@ impl<'a> Widget for Crafting<'a> {
{
let output_text = format!("x{}", &recipe.output.1.to_string());
// Output Image
let (title, desc) = super::util::item_text(&recipe.output.0);
Button::image(
self.item_imgs
.img_id_or_not_found_img((&recipe.output.0).into()),
)
.w_h(55.0, 55.0)
.middle_of(state.ids.output_img_frame)
.label(if recipe.output.1 > 1 {&output_text} else {""}) // Only show output amount for amounts > 1
.label(&output_text)
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(14))
.label_font_id(self.fonts.cyri.conrod_id)
.label_y(conrod_core::position::Relative::Scalar(-24.0))
.label_x(conrod_core::position::Relative::Scalar(24.0))
.with_tooltip(
self.tooltip_manager,
recipe.output.0.name(),
recipe.output.0.description(),
&item_tooltip,
)
.with_tooltip(self.tooltip_manager, title, &*desc, &item_tooltip)
.set(state.ids.output_img, ui);
}
},
@ -395,13 +391,12 @@ impl<'a> Widget for Crafting<'a> {
};
frame.set(state.ids.ingredient_frame[i], ui);
//Item Image
let title = item.name();
let desc = item.description();
let (title, desc) = super::util::item_text(&item);
Button::image(self.item_imgs.img_id_or_not_found_img(item.into()))
.w_h(22.0, 22.0)
.middle_of(state.ids.ingredient_frame[i])
//.image_color(col)
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.with_tooltip(self.tooltip_manager, title, &*desc, &item_tooltip)
.set(state.ids.ingredient_img[i], ui);
// Ingredients text and amount
// Don't show inventory amounts above 999 to avoid the widget clipping

View File

@ -1723,7 +1723,7 @@ impl Hud {
self.show.stats = false;
self.show.bag(false);
self.show.crafting(false);
if self.show.social == false {
if !self.show.social {
self.show.want_grab = true;
self.force_ungrab = false;
} else {
@ -1805,7 +1805,7 @@ impl Hud {
self.show.stats = false;
self.show.crafting(false);
self.show.bag(false);
if self.show.social == false {
if !self.show.social {
self.show.want_grab = true;
self.force_ungrab = false;
} else {
@ -2032,7 +2032,7 @@ impl Hud {
match event {
social::Event::Close => {
self.show.social(false);
if self.show.bag == false {
if !self.show.bag {
self.show.want_grab = true;
self.force_ungrab = false;
} else {

View File

@ -155,7 +155,9 @@ impl<'a> Widget for Overhead<'a> {
let hp_percentage =
self.stats.health.current() as f64 / self.stats.health.maximum() as f64 * 100.0;
let level_comp = self.stats.level.level() as i64 - self.own_level as i64;
let name_y = if hp_percentage == 100.0 {
let health_current = (self.stats.health.current() / 10) as f64;
let health_max = (self.stats.health.maximum() / 10) as f64;
let name_y = if (health_current - health_max).abs() < 1e-6 {
MANA_BAR_Y + 20.0
} else if level_comp > 9 {
MANA_BAR_Y + 38.0
@ -163,22 +165,17 @@ impl<'a> Widget for Overhead<'a> {
MANA_BAR_Y + 32.0
};
let font_size = if hp_percentage.abs() > 99.9 { 24 } else { 20 };
let health_current = (self.stats.health.current() / 10) as f64;
let health_max = (self.stats.health.maximum() / 10) as f64;
// Show K for numbers above 10^3 and truncate them
// Show M for numbers above 10^6 and truncate them
let health_cur_txt = match health_current as u32 {
0..=999 => format!("{}", (health_current).trunc().max(1.0) as u32),
1000..=999999 => format!("{}K", (health_current / 1000.0).trunc() as u32),
_ => format!(
"{}M",
(health_current as f64 / 10f64.powf(6.0)).trunc() as u32
),
0..=999 => format!("{:.0}", health_current.max(1.0)),
1000..=999999 => format!("{:.0}K", (health_current / 1000.0).max(1.0)),
_ => format!("{:.0}M", (health_current as f64 / 1.0e6).max(1.0)),
};
let health_max_txt = match health_max as u32 {
0..=999 => format!("{}", (health_max).trunc() as u32),
1000..=999999 => format!("{}K", (health_max / 1000.0).trunc() as u32),
_ => format!("{}M", (health_max / 10f64.powf(6.0)).trunc() as u32),
0..=999 => format!("{:.0}", health_max.max(1.0)),
1000..=999999 => format!("{:.0}K", (health_max / 1000.0).max(1.0)),
_ => format!("{:.0}M", (health_max as f64 / 1.0e6).max(1.0)),
};
// Name
Text::new(&self.name)
@ -194,8 +191,10 @@ impl<'a> Widget for Overhead<'a> {
.color(if self.in_group {
GROUP_MEMBER
/*} else if targets player { //TODO: Add a way to see if the entity is trying to attack the player, their pet(s) or a member of their group and recolour their nametag accordingly
DEFAULT_NPC*/
} else {DEFAULT_NPC})
DEFAULT_NPC*/
} else {
DEFAULT_NPC
})
.x_y(0.0, name_y + 1.0)
.parent(id)
.set(state.ids.name, ui);

View File

@ -344,7 +344,7 @@ impl<'a> Widget for Social<'a> {
.font_size(self.fonts.cyri.scale(14))
.color(TEXT_COLOR)
.set(state.ids.online_txt, ui);
Text::new(&(count - 1).to_string())
Text::new(&count.to_string())
.right_from(state.ids.online_txt, 5.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))

View File

@ -145,19 +145,19 @@ pub fn apply_scatter_to<'a>(
// Grass
(ShortGrass, false, |c| {
(
close(c.temp, 0.3, 0.4).min(close(c.humidity, 0.6, 0.35)) * 0.5,
close(c.temp, 0.3, 0.4).min(close(c.humidity, 0.6, 0.35)) * 0.05,
Some((48.0, 0.4)),
)
}),
(MediumGrass, false, |c| {
(
close(c.temp, 0.0, 0.6).min(close(c.humidity, 0.6, 0.35)) * 0.5,
close(c.temp, 0.0, 0.6).min(close(c.humidity, 0.6, 0.35)) * 0.05,
Some((48.0, 0.2)),
)
}),
(LongGrass, false, |c| {
(
close(c.temp, 0.4, 0.4).min(close(c.humidity, 0.8, 0.2)) * 0.5,
close(c.temp, 0.4, 0.4).min(close(c.humidity, 0.8, 0.2)) * 0.08,
Some((48.0, 0.1)),
)
}),
@ -168,7 +168,7 @@ pub fn apply_scatter_to<'a>(
c.humidity,
CONFIG.jungle_hum,
0.6,
)) * 0.5,
)) * 0.08,
Some((60.0, 5.0)),
)
}),
@ -508,7 +508,7 @@ pub fn apply_caves_to<'a>(
}
}
}
#[allow(clippy::eval_order_dependence)]
pub fn apply_caves_supplement<'a>(
rng: &mut impl Rng,
wpos2d: Vec2<i32>,

View File

@ -105,6 +105,7 @@ impl World {
pub fn sample_blocks(&self) -> BlockGen { BlockGen::new(ColumnGen::new(&self.sim)) }
#[allow(clippy::or_fun_call)] // TODO: Pending review in #587
#[allow(clippy::eval_order_dependence)]
pub fn generate_chunk(
&self,
index: IndexRef,
@ -205,9 +206,9 @@ impl World {
let mut rng = rand::thread_rng();
// Apply layers (paths, caves, etc.)
layer::apply_caves_to(chunk_wpos2d, sample_get, &mut chunk, index);
layer::apply_scatter_to(chunk_wpos2d, sample_get, &mut chunk, index, sim_chunk);
layer::apply_paths_to(chunk_wpos2d, sample_get, &mut chunk, index);
layer::apply_caves_to(chunk_wpos2d, sample_get, &mut chunk, index);
// Apply site generation
sim_chunk.sites.iter().for_each(|site| {
@ -236,12 +237,9 @@ impl World {
&& sim_chunk.chaos < 0.5
&& !sim_chunk.is_underwater()
{
// TODO: REFACTOR: Define specific alignments in a config file instead of here
let is_hostile: bool;
let is_giant = if rng.gen_range(0, 8) == 0 {
true
} else {
false
};
let is_giant = rng.gen_range(0, 8) == 0;
let quadmed = comp::Body::QuadrupedMedium(quadruped_medium::Body::random()); // Not all of them are hostile so we have to do the rng here
let quadlow = comp::Body::QuadrupedLow(quadruped_low::Body::random()); // Not all of them are hostile so we have to do the rng here
let entity = EntityInfo::at(gen_entity_pos())