mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fixes
This commit is contained in:
parent
17cd291613
commit
a1af50dcdf
@ -14,13 +14,13 @@ lazy_static! {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref ITEM_CONFIGS: Vec<String> = {
|
static ref ENTITY_CONFIGS: Vec<String> = {
|
||||||
let mut item_configs = common::cmd::ITEM_CONFIGS
|
let mut entity_configs = common::cmd::ENTITY_CONFIGS
|
||||||
.iter()
|
.iter()
|
||||||
.map(|entity_desc| entity_desc.replace("common.entity.", ""))
|
.map(|entity_desc| entity_desc.replace("common.entity.", ""))
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
entity_configs.sort();
|
entity_configs.sort();
|
||||||
entity_confifs
|
entity_configs
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,3 +107,42 @@ fn draw_give_items(ui: &mut Ui, state: &mut AdminCommandState, egui_actions: &mu
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
fn draw_spawn_entities(ui: &mut Ui, state: &mut AdminCommandState, egui_actions: &mut EguiActions) {
|
||||||
|
ui.spacing_mut().window_padding = Vec2::new(10.0, 10.0);
|
||||||
|
Resize::default()
|
||||||
|
.default_size([400.0, 200.0])
|
||||||
|
.show(ui, |ui| {
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.add(
|
||||||
|
Slider::new(&mut state.spawn_entity_qty, 1..=49)
|
||||||
|
.logarithmic(true)
|
||||||
|
.clamp_to_range(true)
|
||||||
|
.text("Qty"),
|
||||||
|
);
|
||||||
|
if ui.button("Spawn Entities").clicked() {
|
||||||
|
egui_actions.actions.push(EguiAction::ChatCommand {
|
||||||
|
cmd: ServerChatCommand::MakeNpc,
|
||||||
|
args: vec![
|
||||||
|
format!(
|
||||||
|
"common.entity.{}",
|
||||||
|
ENTITY_CONFIGS[state.spawn_entity_selected_idx].clone()
|
||||||
|
),
|
||||||
|
format!("{}", state.spawn_entity_qty),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.label("Filter:");
|
||||||
|
|
||||||
|
ui.text_edit_singleline(&mut state.spawn_entity_search_text);
|
||||||
|
});
|
||||||
|
|
||||||
|
crate::widgets::filterable_list(
|
||||||
|
ui,
|
||||||
|
&ENTITY_CONFIGS,
|
||||||
|
&state.spawn_entity_search_text,
|
||||||
|
&mut state.spawn_entity_selected_idx,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
@ -65,6 +65,9 @@ pub struct AdminCommandState {
|
|||||||
give_item_selected_idx: usize,
|
give_item_selected_idx: usize,
|
||||||
give_item_search_text: String,
|
give_item_search_text: String,
|
||||||
kits_selected_idx: usize,
|
kits_selected_idx: usize,
|
||||||
|
spawn_entity_qty: u32,
|
||||||
|
spawn_entity_selected_idx: usize,
|
||||||
|
spawn_entity_search_text: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AdminCommandState {
|
impl AdminCommandState {
|
||||||
@ -74,6 +77,9 @@ impl AdminCommandState {
|
|||||||
give_item_selected_idx: 0,
|
give_item_selected_idx: 0,
|
||||||
give_item_search_text: String::new(),
|
give_item_search_text: String::new(),
|
||||||
kits_selected_idx: 0,
|
kits_selected_idx: 0,
|
||||||
|
spawn_entity_qty: 1,
|
||||||
|
spawn_entity_selected_idx: 0,
|
||||||
|
spawn_entity_search_text: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user