fix chem recipes generator
This commit is contained in:
@@ -45,7 +45,8 @@ public sealed class ChemistryJsonGenerator
|
|||||||
new UniversalJsonConverter<ReagentEffectsEntry>(),
|
new UniversalJsonConverter<ReagentEffectsEntry>(),
|
||||||
new UniversalJsonConverter<DamageSpecifier>(),
|
new UniversalJsonConverter<DamageSpecifier>(),
|
||||||
new FixedPointJsonConverter()
|
new FixedPointJsonConverter()
|
||||||
}
|
},
|
||||||
|
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals
|
||||||
};
|
};
|
||||||
|
|
||||||
file.Write(JsonSerializer.Serialize(prototypes, serializeOptions));
|
file.Write(JsonSerializer.Serialize(prototypes, serializeOptions));
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ namespace Content.Server.GuideGenerator
|
|||||||
// If the field has a [JsonIgnore] attribute, skip it
|
// If the field has a [JsonIgnore] attribute, skip it
|
||||||
if (Attribute.GetCustomAttribute(prop, typeof(JsonIgnoreAttribute), true) != null) continue;
|
if (Attribute.GetCustomAttribute(prop, typeof(JsonIgnoreAttribute), true) != null) continue;
|
||||||
|
|
||||||
|
// If GetIndexParameters().Length is not 0 then it means that property is indexed
|
||||||
|
// And since we cannot get its values without passing index (which type can LITERALLY BE ANYTHING) then let's just skip it
|
||||||
|
// Yeah, i know that this will lead to a potential data loss, but what i can do about it?
|
||||||
|
if (prop.GetIndexParameters().Length != 0) continue;
|
||||||
|
|
||||||
// If the property has a [JsonPropertyName] attribute, get the property name. Otherwise, use the property name.
|
// If the property has a [JsonPropertyName] attribute, get the property name. Otherwise, use the property name.
|
||||||
JsonPropertyNameAttribute? attr = (JsonPropertyNameAttribute?) Attribute.GetCustomAttribute(prop, typeof(JsonPropertyNameAttribute), true);
|
JsonPropertyNameAttribute? attr = (JsonPropertyNameAttribute?) Attribute.GetCustomAttribute(prop, typeof(JsonPropertyNameAttribute), true);
|
||||||
string name = attr == null ? prop.Name : attr.Name;
|
string name = attr == null ? prop.Name : attr.Name;
|
||||||
|
|||||||
Reference in New Issue
Block a user