mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressed review comments
This commit is contained in:
parent
fc28449703
commit
f47cbeb022
@ -72,7 +72,9 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
||||
let stealth = armor.stealth().unwrap_or(0.0).to_string();
|
||||
|
||||
wtr.write_record(&[
|
||||
item.item_definition_id().raw().expect("All items from asset glob should be simple items"),
|
||||
item.item_definition_id()
|
||||
.raw()
|
||||
.expect("All items from asset glob should be simple items"),
|
||||
&kind,
|
||||
&item.name(),
|
||||
&format!("{:?}", item.quality()),
|
||||
@ -131,7 +133,9 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
let hands = get_tool_hands(tool);
|
||||
|
||||
wtr.write_record(&[
|
||||
item.item_definition_id().raw().expect("All items from asset glob should be simple items"),
|
||||
item.item_definition_id()
|
||||
.raw()
|
||||
.expect("All items from asset glob should be simple items"),
|
||||
&kind,
|
||||
&item.name(),
|
||||
&hands,
|
||||
@ -227,7 +231,13 @@ fn all_items() -> Result<(), Box<dyn Error>> {
|
||||
_ => "".to_owned(),
|
||||
};
|
||||
|
||||
wtr.write_record(&[item.item_definition_id().raw().expect("All items in asset glob should be simple items"), &item.name(), &kind])?;
|
||||
wtr.write_record(&[
|
||||
item.item_definition_id()
|
||||
.raw()
|
||||
.expect("All items in asset glob should be simple items"),
|
||||
&item.name(),
|
||||
&kind,
|
||||
])?;
|
||||
}
|
||||
|
||||
wtr.flush()?;
|
||||
|
@ -14,7 +14,7 @@ use veloren_common::{
|
||||
item::{
|
||||
armor::{ArmorKind, Protection},
|
||||
tool::{AbilitySpec, Hands, Stats, ToolKind},
|
||||
ItemKind, ItemTag, Material, Quality, ItemDefinitionId,
|
||||
ItemDefinitionId, ItemKind, ItemTag, Material, Quality,
|
||||
},
|
||||
},
|
||||
lottery::LootSpec,
|
||||
@ -79,7 +79,9 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
if let Ok(ref record) = record {
|
||||
if item.item_definition_id()
|
||||
== ItemDefinitionId::Simple(record.get(headers["Path"]).expect("No file path in csv?"))
|
||||
== ItemDefinitionId::Simple(
|
||||
record.get(headers["Path"]).expect("No file path in csv?"),
|
||||
)
|
||||
{
|
||||
let protection =
|
||||
if let Some(protection_raw) = record.get(headers["Protection"]) {
|
||||
@ -232,7 +234,12 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
||||
.enumerate_arrays(true);
|
||||
|
||||
let mut path = ASSETS_PATH.clone();
|
||||
for part in item.item_definition_id().raw().expect("Csv import only works on simple items, not modular items").split('.') {
|
||||
for part in item
|
||||
.item_definition_id()
|
||||
.raw()
|
||||
.expect("Csv import only works on simple items, not modular items")
|
||||
.split('.')
|
||||
{
|
||||
path.push(part);
|
||||
}
|
||||
path.set_extension("ron");
|
||||
@ -276,7 +283,9 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
if let comp::item::ItemKind::Tool(tool) = &*item.kind() {
|
||||
if let Ok(ref record) = record {
|
||||
if item.item_definition_id()
|
||||
== ItemDefinitionId::Simple(record.get(headers["Path"]).expect("No file path in csv?"))
|
||||
== ItemDefinitionId::Simple(
|
||||
record.get(headers["Path"]).expect("No file path in csv?"),
|
||||
)
|
||||
{
|
||||
let kind = tool.kind;
|
||||
let equip_time_secs: f32 = record
|
||||
@ -424,7 +433,12 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
||||
.enumerate_arrays(true);
|
||||
|
||||
let mut path = ASSETS_PATH.clone();
|
||||
for part in item.item_definition_id().raw().expect("Csv import only works on simple items, not modular items").split('.') {
|
||||
for part in item
|
||||
.item_definition_id()
|
||||
.raw()
|
||||
.expect("Csv import only works on simple items, not modular items")
|
||||
.split('.')
|
||||
{
|
||||
path.push(part);
|
||||
}
|
||||
path.set_extension("ron");
|
||||
|
@ -20,7 +20,14 @@ fn main() {
|
||||
.or_insert_with(|| graph.add_node(node.to_owned()))
|
||||
};
|
||||
for (_, recipe) in recipes.iter() {
|
||||
let output = String::from(recipe.output.0.item_definition_id().raw().expect("Recipe book can only create simple items (probably)"));
|
||||
let output = String::from(
|
||||
recipe
|
||||
.output
|
||||
.0
|
||||
.item_definition_id()
|
||||
.raw()
|
||||
.expect("Recipe book can only create simple items (probably)"),
|
||||
);
|
||||
let inputs = recipe
|
||||
.inputs
|
||||
.iter()
|
||||
|
@ -496,10 +496,6 @@ impl<'a> ItemDefinitionId<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ItemDefinitionIdOwned {
|
||||
fn default() -> Self { Self::Simple(String::new()) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ItemDef {
|
||||
#[serde(default)]
|
||||
|
@ -732,6 +732,8 @@ struct RawComponentRecipe {
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
enum ComponentOutput {
|
||||
// TODO: Don't store list of components here in case we ever want components in future to have
|
||||
// state to them (e.g. a component having sub-components)
|
||||
ItemComponents {
|
||||
item: Arc<ItemDef>,
|
||||
components: Vec<Arc<ItemDef>>,
|
||||
@ -751,7 +753,7 @@ impl assets::Compound for ComponentRecipeBook {
|
||||
specifier: &str,
|
||||
) -> Result<Self, assets::BoxedError> {
|
||||
#[inline]
|
||||
fn load_recipe_key(raw_recipe: &RawComponentRecipe) -> ComponentKey {
|
||||
fn create_recipe_key(raw_recipe: &RawComponentRecipe) -> ComponentKey {
|
||||
match &raw_recipe.output {
|
||||
RawComponentOutput::ToolPrimaryComponent { toolkind, item: _ } => {
|
||||
let material = String::from(&raw_recipe.material.0);
|
||||
@ -807,7 +809,7 @@ impl assets::Compound for ComponentRecipeBook {
|
||||
.0
|
||||
.iter()
|
||||
.map(|raw_recipe| {
|
||||
load_recipe(raw_recipe).map(|recipe| (load_recipe_key(raw_recipe), recipe))
|
||||
load_recipe(raw_recipe).map(|recipe| (create_recipe_key(raw_recipe), recipe))
|
||||
})
|
||||
.collect::<Result<_, assets::Error>>()?;
|
||||
|
||||
|
@ -414,7 +414,7 @@ impl SitePrices {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReducedInventoryItem {
|
||||
pub name: ItemDefinitionIdOwned,
|
||||
pub amount: u32,
|
||||
|
Loading…
Reference in New Issue
Block a user