65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
using rjw;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Verse;
|
|
|
|
namespace rjwquirks.Data
|
|
{
|
|
public class RaceTags
|
|
{
|
|
private readonly static Dictionary<string, RaceTags> tagDatabase = new Dictionary<string, RaceTags>();
|
|
|
|
// I only created tags for RaceGroupDef properties that seemed like keywords (like slime) rather than behavior (like oviPregnancy).
|
|
public readonly static RaceTags Chitin = new RaceTags("Chitin");
|
|
public readonly static RaceTags Demon = new RaceTags("Demon");
|
|
public readonly static RaceTags Feathers = new RaceTags("Feathers");
|
|
public readonly static RaceTags Fur = new RaceTags("Fur");
|
|
public readonly static RaceTags Plant = new RaceTags("Plant");
|
|
public readonly static RaceTags Robot = new RaceTags("Robot");
|
|
public readonly static RaceTags Scales = new RaceTags("Scales");
|
|
public readonly static RaceTags Skin = new RaceTags("Skin");
|
|
public readonly static RaceTags Slime = new RaceTags("Slime");
|
|
|
|
|
|
public string Key { get; }
|
|
|
|
private RaceTags(string key)
|
|
{
|
|
Key = key;
|
|
tagDatabase.Add(key, this);
|
|
}
|
|
|
|
public static bool TryParse(string key, out RaceTags raceTag)
|
|
{
|
|
return tagDatabase.TryGetValue(key, out raceTag);
|
|
}
|
|
|
|
/// <summary>
|
|
/// For backwards compatability only. Shouldn't add more special cases here.
|
|
/// </summary>
|
|
public bool DefaultWhenNoRaceGroupDef(Pawn pawn)
|
|
{
|
|
if (this == Demon)
|
|
{
|
|
return xxx.is_demon(pawn);
|
|
}
|
|
else if (this == Slime)
|
|
{
|
|
return xxx.is_slime(pawn);
|
|
}
|
|
else if (this == Skin)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|