Reworked weapon documentation generation
Switched the Utility's ExtractWeaponDocsCommand output to JSON. Added a Python script to generate documentation Markdown from JSON.
This commit is contained in:
committed by
Matthias Mailänder
parent
c21bf31ebc
commit
a522457bb6
@@ -13,6 +13,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
@@ -298,6 +299,23 @@ namespace OpenRA.Mods.Common
|
||||
return t.Name;
|
||||
}
|
||||
|
||||
public static string GetAttributeParameterValue(CustomAttributeTypedArgument value)
|
||||
{
|
||||
if (value.ArgumentType.IsEnum)
|
||||
return Enum.Parse(value.ArgumentType, value.Value.ToString()).ToString();
|
||||
|
||||
if (value.ArgumentType == typeof(Type) && value.Value != null)
|
||||
return (value.Value as Type).Name;
|
||||
|
||||
if (value.ArgumentType.IsArray)
|
||||
{
|
||||
var names = (value.Value as IReadOnlyCollection<CustomAttributeTypedArgument>).Select(x => (x.Value as Type).Name);
|
||||
return string.Join(", ", names);
|
||||
}
|
||||
|
||||
return value.Value?.ToString();
|
||||
}
|
||||
|
||||
public static int GetProjectileInaccuracy(int baseInaccuracy, InaccuracyType inaccuracyType, ProjectileArgs args)
|
||||
{
|
||||
var inaccuracy = ApplyPercentageModifiers(baseInaccuracy, args.InaccuracyModifiers);
|
||||
|
||||
Reference in New Issue
Block a user