mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Show caves in map
This commit is contained in:
parent
d52b595240
commit
a3db20c9d6
assets/voxygen
common/src/msg
voxygen/src
world/src
BIN
assets/voxygen/element/map/cave.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/map/cave_bg.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave_bg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/map/cave_hover.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave_hover.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -418,6 +418,8 @@ magically infused items?"#,
|
|||||||
"hud.map.towns": "Towns",
|
"hud.map.towns": "Towns",
|
||||||
"hud.map.castles": "Castles",
|
"hud.map.castles": "Castles",
|
||||||
"hud.map.dungeons": "Dungeons",
|
"hud.map.dungeons": "Dungeons",
|
||||||
|
"hud.map.caves": "Caves",
|
||||||
|
"hud.map.cave": "Cave",
|
||||||
"hud.map.town": "Town",
|
"hud.map.town": "Town",
|
||||||
"hud.map.castle": "Castle",
|
"hud.map.castle": "Castle",
|
||||||
"hud.map.dungeon": "Dungeon",
|
"hud.map.dungeon": "Dungeon",
|
||||||
|
@ -136,4 +136,5 @@ pub enum SiteKind {
|
|||||||
Town,
|
Town,
|
||||||
Dungeon { difficulty: u32 },
|
Dungeon { difficulty: u32 },
|
||||||
Castle,
|
Castle,
|
||||||
|
Cave,
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,9 @@ image_ids! {
|
|||||||
mmap_site_castle: "voxygen.element.map.castle",
|
mmap_site_castle: "voxygen.element.map.castle",
|
||||||
mmap_site_castle_hover: "voxygen.element.map.castle_hover",
|
mmap_site_castle_hover: "voxygen.element.map.castle_hover",
|
||||||
mmap_site_castle_bg: "voxygen.element.map.castle_bg",
|
mmap_site_castle_bg: "voxygen.element.map.castle_bg",
|
||||||
|
mmap_site_cave_bg: "voxygen.element.map.cave_bg",
|
||||||
|
mmap_site_cave_hover: "voxygen.element.map.cave_hover",
|
||||||
|
mmap_site_cave: "voxygen.element.map.cave",
|
||||||
|
|
||||||
// Window Parts
|
// Window Parts
|
||||||
window_3: "voxygen.element.frames.window_3",
|
window_3: "voxygen.element.frames.window_3",
|
||||||
|
@ -55,7 +55,9 @@ widget_ids! {
|
|||||||
drag_ico,
|
drag_ico,
|
||||||
zoom_txt,
|
zoom_txt,
|
||||||
zoom_ico,
|
zoom_ico,
|
||||||
|
show_caves_img,
|
||||||
|
show_caves_box,
|
||||||
|
show_caves_text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ pub enum Event {
|
|||||||
ShowTowns(bool),
|
ShowTowns(bool),
|
||||||
ShowCastles(bool),
|
ShowCastles(bool),
|
||||||
ShowDungeons(bool),
|
ShowDungeons(bool),
|
||||||
|
ShowCaves(bool),
|
||||||
Close,
|
Close,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +145,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
let show_towns = self.global_state.settings.gameplay.map_show_towns;
|
let show_towns = self.global_state.settings.gameplay.map_show_towns;
|
||||||
let show_dungeons = self.global_state.settings.gameplay.map_show_dungeons;
|
let show_dungeons = self.global_state.settings.gameplay.map_show_dungeons;
|
||||||
let show_castles = self.global_state.settings.gameplay.map_show_castles;
|
let show_castles = self.global_state.settings.gameplay.map_show_castles;
|
||||||
|
let show_caves = self.global_state.settings.gameplay.map_show_caves;
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
let i18n = &self.localized_strings;
|
let i18n = &self.localized_strings;
|
||||||
// Tooltips
|
// Tooltips
|
||||||
@ -453,6 +457,40 @@ impl<'a> Widget for Map<'a> {
|
|||||||
.graphics_for(state.ids.show_dungeons_box)
|
.graphics_for(state.ids.show_dungeons_box)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.show_dungeons_text, ui);
|
.set(state.ids.show_dungeons_text, ui);
|
||||||
|
// Caves
|
||||||
|
Image::new(self.imgs.mmap_site_cave)
|
||||||
|
.down_from(state.ids.show_dungeons_img, 10.0)
|
||||||
|
.w_h(20.0, 20.0)
|
||||||
|
.set(state.ids.show_caves_img, ui);
|
||||||
|
if Button::image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox
|
||||||
|
})
|
||||||
|
.w_h(18.0, 18.0)
|
||||||
|
.hover_image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked_mo
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox_mo
|
||||||
|
})
|
||||||
|
.press_image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox_press
|
||||||
|
})
|
||||||
|
.right_from(state.ids.show_caves_img, 10.0)
|
||||||
|
.set(state.ids.show_caves_box, ui)
|
||||||
|
.was_clicked()
|
||||||
|
{
|
||||||
|
events.push(Event::ShowCaves(!show_caves));
|
||||||
|
}
|
||||||
|
Text::new(i18n.get("hud.map.caves"))
|
||||||
|
.right_from(state.ids.show_caves_box, 10.0)
|
||||||
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
|
.graphics_for(state.ids.show_caves_box)
|
||||||
|
.color(TEXT_COLOR)
|
||||||
|
.set(state.ids.show_caves_text, ui);
|
||||||
// Map icons
|
// Map icons
|
||||||
if state.ids.mmap_site_icons.len() < self.client.sites().len() {
|
if state.ids.mmap_site_icons.len() < self.client.sites().len() {
|
||||||
state.update(|state| {
|
state.update(|state| {
|
||||||
@ -493,6 +531,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
SiteKind::Town => i18n.get("hud.map.town"),
|
SiteKind::Town => i18n.get("hud.map.town"),
|
||||||
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
|
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
|
||||||
SiteKind::Castle => i18n.get("hud.map.castle"),
|
SiteKind::Castle => i18n.get("hud.map.castle"),
|
||||||
|
SiteKind::Cave => i18n.get("hud.map.cave"),
|
||||||
});
|
});
|
||||||
let (difficulty, desc) = match &site.kind {
|
let (difficulty, desc) = match &site.kind {
|
||||||
SiteKind::Town => (0, i18n.get("hud.map.town").to_string()),
|
SiteKind::Town => (0, i18n.get("hud.map.town").to_string()),
|
||||||
@ -502,6 +541,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
.replace("{difficulty}", difficulty.to_string().as_str()),
|
.replace("{difficulty}", difficulty.to_string().as_str()),
|
||||||
),
|
),
|
||||||
SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()),
|
SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()),
|
||||||
|
SiteKind::Cave => (0, i18n.get("hud.map.cave").to_string()),
|
||||||
};
|
};
|
||||||
let site_btn = Button::image(match &site.kind {
|
let site_btn = Button::image(match &site.kind {
|
||||||
SiteKind::Town => {
|
SiteKind::Town => {
|
||||||
@ -525,6 +565,13 @@ impl<'a> Widget for Map<'a> {
|
|||||||
self.imgs.nothing
|
self.imgs.nothing
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
self.imgs.mmap_site_cave
|
||||||
|
} else {
|
||||||
|
self.imgs.nothing
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.x_y_position_relative_to(
|
.x_y_position_relative_to(
|
||||||
state.ids.grid,
|
state.ids.grid,
|
||||||
@ -536,6 +583,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town_hover,
|
SiteKind::Town => self.imgs.mmap_site_town_hover,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_hover,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_hover,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle_hover,
|
SiteKind::Castle => self.imgs.mmap_site_castle_hover,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave_hover,
|
||||||
})
|
})
|
||||||
.image_color(UI_HIGHLIGHT_0)
|
.image_color(UI_HIGHLIGHT_0)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
@ -555,6 +603,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
5 => QUALITY_DEBUG,
|
5 => QUALITY_DEBUG,
|
||||||
_ => TEXT_COLOR,
|
_ => TEXT_COLOR,
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => TEXT_COLOR,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// Only display sites that are toggled on
|
// Only display sites that are toggled on
|
||||||
@ -574,6 +623,11 @@ impl<'a> Widget for Map<'a> {
|
|||||||
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Difficulty from 0-6
|
// Difficulty from 0-6
|
||||||
@ -626,6 +680,11 @@ impl<'a> Widget for Map<'a> {
|
|||||||
dif_img.set(state.ids.site_difs[i], ui)
|
dif_img.set(state.ids.site_difs[i], ui)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
dif_img.set(state.ids.site_difs[i], ui)
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town_bg,
|
SiteKind::Town => self.imgs.mmap_site_town_bg,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_bg,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_bg,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle_bg,
|
SiteKind::Castle => self.imgs.mmap_site_castle_bg,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave_bg,
|
||||||
})
|
})
|
||||||
.x_y_position_relative_to(
|
.x_y_position_relative_to(
|
||||||
state.ids.grid,
|
state.ids.grid,
|
||||||
@ -277,6 +278,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
5 => QUALITY_DEBUG,
|
5 => QUALITY_DEBUG,
|
||||||
_ => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
_ => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
||||||
}))
|
}))
|
||||||
.parent(state.ids.grid)
|
.parent(state.ids.grid)
|
||||||
.set(state.ids.mmap_site_icons_bgs[i], ui);
|
.set(state.ids.mmap_site_icons_bgs[i], ui);
|
||||||
@ -284,6 +286,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town,
|
SiteKind::Town => self.imgs.mmap_site_town,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle,
|
SiteKind::Castle => self.imgs.mmap_site_castle,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave,
|
||||||
})
|
})
|
||||||
.middle_of(state.ids.mmap_site_icons_bgs[i])
|
.middle_of(state.ids.mmap_site_icons_bgs[i])
|
||||||
.w_h(20.0, 20.0)
|
.w_h(20.0, 20.0)
|
||||||
|
@ -330,6 +330,7 @@ pub enum Event {
|
|||||||
MapShowTowns(bool),
|
MapShowTowns(bool),
|
||||||
MapShowDungeons(bool),
|
MapShowDungeons(bool),
|
||||||
MapShowCastles(bool),
|
MapShowCastles(bool),
|
||||||
|
MapShowCaves(bool),
|
||||||
AdjustWindowSize([u16; 2]),
|
AdjustWindowSize([u16; 2]),
|
||||||
ChangeFullscreenMode(FullScreenSettings),
|
ChangeFullscreenMode(FullScreenSettings),
|
||||||
ToggleParticlesEnabled(bool),
|
ToggleParticlesEnabled(bool),
|
||||||
@ -2285,6 +2286,9 @@ impl Hud {
|
|||||||
map::Event::MapDrag(map_drag) => {
|
map::Event::MapDrag(map_drag) => {
|
||||||
events.push(Event::MapDrag(map_drag));
|
events.push(Event::MapDrag(map_drag));
|
||||||
},
|
},
|
||||||
|
map::Event::ShowCaves(map_show_caves) => {
|
||||||
|
events.push(Event::MapShowCaves(map_show_caves));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -984,6 +984,10 @@ impl PlayState for SessionState {
|
|||||||
global_state.settings.gameplay.map_show_castles = map_show_castles;
|
global_state.settings.gameplay.map_show_castles = map_show_castles;
|
||||||
global_state.settings.save_to_file_warn();
|
global_state.settings.save_to_file_warn();
|
||||||
},
|
},
|
||||||
|
HudEvent::MapShowCaves(map_show_caves) => {
|
||||||
|
global_state.settings.gameplay.map_show_caves = map_show_caves;
|
||||||
|
global_state.settings.save_to_file_warn();
|
||||||
|
},
|
||||||
HudEvent::ChangeGamma(new_gamma) => {
|
HudEvent::ChangeGamma(new_gamma) => {
|
||||||
global_state.settings.graphics.gamma = new_gamma;
|
global_state.settings.graphics.gamma = new_gamma;
|
||||||
global_state.settings.save_to_file_warn();
|
global_state.settings.save_to_file_warn();
|
||||||
|
@ -522,6 +522,7 @@ pub struct GameplaySettings {
|
|||||||
pub map_show_dungeons: bool,
|
pub map_show_dungeons: bool,
|
||||||
pub map_show_castles: bool,
|
pub map_show_castles: bool,
|
||||||
pub loading_tips: bool,
|
pub loading_tips: bool,
|
||||||
|
pub map_show_caves: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for GameplaySettings {
|
impl Default for GameplaySettings {
|
||||||
@ -558,6 +559,7 @@ impl Default for GameplaySettings {
|
|||||||
map_show_dungeons: true,
|
map_show_dungeons: true,
|
||||||
map_show_castles: true,
|
map_show_castles: true,
|
||||||
loading_tips: true,
|
loading_tips: true,
|
||||||
|
map_show_caves: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ pub struct Civs {
|
|||||||
>,
|
>,
|
||||||
|
|
||||||
pub sites: Store<Site>,
|
pub sites: Store<Site>,
|
||||||
|
pub caves: Store<Vec2<i32>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change this to get rid of particularly horrid seeds
|
// Change this to get rid of particularly horrid seeds
|
||||||
@ -231,7 +232,7 @@ impl Civs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move this
|
// TODO: Move this
|
||||||
fn generate_cave(&self, ctx: &mut GenCtx<impl Rng>) {
|
fn generate_cave(&mut self, ctx: &mut GenCtx<impl Rng>) {
|
||||||
let mut pos = ctx
|
let mut pos = ctx
|
||||||
.sim
|
.sim
|
||||||
.get_size()
|
.get_size()
|
||||||
@ -292,6 +293,10 @@ impl Civs {
|
|||||||
chunk.spawn_rate = 0.0;
|
chunk.spawn_rate = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.caves
|
||||||
|
.insert(path.first().unwrap().0 * TerrainChunkSize::RECT_SIZE.map(|e: u32| e as i32));
|
||||||
|
self.caves
|
||||||
|
.insert(path.last().unwrap().0 * TerrainChunkSize::RECT_SIZE.map(|e: u32| e as i32));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn place(&self, id: Id<Place>) -> &Place { self.places.get(id) }
|
pub fn place(&self, id: Id<Place>) -> &Place { self.places.get(id) }
|
||||||
|
@ -114,6 +114,16 @@ impl World {
|
|||||||
wpos: site.center * TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
wpos: site.center * TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.chain(
|
||||||
|
self.civs()
|
||||||
|
.caves
|
||||||
|
.iter()
|
||||||
|
.map(|(_, pos)| world_msg::SiteInfo {
|
||||||
|
name: None,
|
||||||
|
kind: world_msg::SiteKind::Cave,
|
||||||
|
wpos: *pos,
|
||||||
|
}),
|
||||||
|
)
|
||||||
.collect(),
|
.collect(),
|
||||||
..self.sim.get_map(index)
|
..self.sim.get_map(index)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user