2020-05-31 17:07:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
|
|
|
|
namespace SanAndreasUnity.Importing.Items.Definitions
|
|
|
|
|
{
|
|
|
|
|
[Flags]
|
|
|
|
|
public enum PedestrianType
|
|
|
|
|
{
|
|
|
|
|
Player1 = 0,
|
|
|
|
|
|
|
|
|
|
Civilian = 8,
|
|
|
|
|
CivMale = Civilian | 0,
|
|
|
|
|
CivFemale = Civilian | 1,
|
|
|
|
|
|
|
|
|
|
Criminal = 16,
|
|
|
|
|
Prostitute = Criminal | 1,
|
|
|
|
|
|
|
|
|
|
EmergencyServices = 32,
|
|
|
|
|
Cop = EmergencyServices | 0,
|
|
|
|
|
Medic = EmergencyServices | 1,
|
|
|
|
|
FireMan = EmergencyServices | 2,
|
|
|
|
|
|
|
|
|
|
GangMember = 64,
|
|
|
|
|
Gang1 = GangMember | 0,
|
|
|
|
|
Gang2 = GangMember | 1,
|
|
|
|
|
Gang3 = GangMember | 2,
|
|
|
|
|
Gang4 = GangMember | 3,
|
|
|
|
|
Gang5 = GangMember | 4,
|
|
|
|
|
Gang6 = GangMember | 5,
|
|
|
|
|
Gang7 = GangMember | 6,
|
|
|
|
|
Gang8 = GangMember | 7
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 23:33:19 +00:00
|
|
|
|
public static class PedestrianTypeExtensions
|
|
|
|
|
{
|
|
|
|
|
public static bool IsGangMember(this PedestrianType pedestrianType)
|
|
|
|
|
{
|
|
|
|
|
return (pedestrianType & PedestrianType.GangMember) != 0;
|
|
|
|
|
}
|
2021-09-12 22:54:56 +00:00
|
|
|
|
|
|
|
|
|
public static bool IsCriminal(this PedestrianType pedestrianType)
|
|
|
|
|
{
|
|
|
|
|
return pedestrianType == PedestrianType.Criminal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsCop(this PedestrianType pedestrianType)
|
|
|
|
|
{
|
|
|
|
|
return pedestrianType == PedestrianType.Cop;
|
|
|
|
|
}
|
2022-01-04 17:52:27 +00:00
|
|
|
|
|
|
|
|
|
public static bool IsFemale(this PedestrianType pedestrianType)
|
|
|
|
|
{
|
|
|
|
|
return pedestrianType == PedestrianType.CivFemale || pedestrianType == PedestrianType.Prostitute;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsMale(this PedestrianType pedestrianType)
|
|
|
|
|
{
|
|
|
|
|
return !pedestrianType.IsFemale();
|
|
|
|
|
}
|
2021-09-06 23:33:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-31 17:07:22 +00:00
|
|
|
|
[Section("peds")]
|
|
|
|
|
public class PedestrianDef : Definition, IObjectDefinition
|
|
|
|
|
{
|
|
|
|
|
public readonly int Id;
|
|
|
|
|
|
|
|
|
|
int IObjectDefinition.Id
|
|
|
|
|
{
|
|
|
|
|
get { return Id; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public readonly string ModelName;
|
|
|
|
|
public readonly string TextureDictionaryName;
|
|
|
|
|
public readonly PedestrianType DefaultType;
|
|
|
|
|
public readonly string BehaviourName;
|
|
|
|
|
public readonly string AnimGroupName;
|
|
|
|
|
public readonly uint CanDriveMask;
|
|
|
|
|
public readonly uint Flags;
|
|
|
|
|
public readonly string AnimFileName;
|
|
|
|
|
public readonly int Radio1;
|
|
|
|
|
public readonly int Radio2;
|
|
|
|
|
|
|
|
|
|
public PedestrianDef(string line)
|
|
|
|
|
: base(line)
|
|
|
|
|
{
|
|
|
|
|
Id = GetInt(0);
|
|
|
|
|
ModelName = GetString(1);
|
|
|
|
|
TextureDictionaryName = GetString(2);
|
2021-01-31 00:37:23 +00:00
|
|
|
|
Enum.TryParse<PedestrianType>(GetString(3), true, out DefaultType);
|
2020-05-31 17:07:22 +00:00
|
|
|
|
BehaviourName = GetString(4);
|
|
|
|
|
AnimGroupName = GetString(5);
|
|
|
|
|
CanDriveMask = (uint)GetInt(6, NumberStyles.HexNumber);
|
|
|
|
|
Flags = (uint)GetInt(7);
|
|
|
|
|
AnimFileName = GetString(8);
|
|
|
|
|
Radio1 = GetInt(9);
|
|
|
|
|
Radio2 = GetInt(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|