Code refactor

This commit is contained in:
AbstractConcept 2022-10-28 00:28:51 -05:00
parent 757badf4f6
commit a55ba7b95b
232 changed files with 1282 additions and 936 deletions

View file

@ -36,60 +36,60 @@ namespace RimWorldAnimationStudio
[XmlIgnore] public List<string> DefNames
{
get { return defNames.NullOrEmpty() ? defNames = new List<string>() : defNames; }
set { defNames = value.NotNullOrEmpty() ? value : null; EventsManager.OnActorChanged(this); }
set { defNames = value.NotNullOrEmpty() ? value : null; }
}
[XmlIgnore] public List<string> BodyDefTypes
{
get { return bodyDefTypes.NullOrEmpty() ? bodyDefTypes = new List<string>() : bodyDefTypes; }
set { bodyDefTypes = value.NotNullOrEmpty() ? value : null; EventsManager.OnActorChanged(this); }
set { bodyDefTypes = value.NotNullOrEmpty() ? value : null; }
}
[XmlIgnore] public List<string> RequiredGenitals
{
get { return requiredGenitals.NullOrEmpty() ? requiredGenitals = new List<string>() : requiredGenitals; }
set { requiredGenitals = value.NotNullOrEmpty() ? value : null; EventsManager.OnActorChanged(this); }
set { requiredGenitals = value.NotNullOrEmpty() ? value : null; }
}
[XmlIgnore] public List<PawnRaceOffset> RaceOffsets {
get { return raceOffsets.NullOrEmpty() ? raceOffsets = new List<PawnRaceOffset>() : raceOffsets; }
set { raceOffsets = value.NotNullOrEmpty() ? value : null; EventsManager.OnActorChanged(this); }
set { raceOffsets = value.NotNullOrEmpty() ? value : null; }
}
[XmlIgnore] public List<string> Tags
{
get { return tags.NullOrEmpty() ? tags = new List<string>() : tags; }
set { tags = value.NotNullOrEmpty() ? value : null; EventsManager.OnActorChanged(this); }
set { tags = value.NotNullOrEmpty() ? value : null; }
}
[XmlIgnore] public BodyTypeOffset BodyTypeOffset
{
get { return bodyTypeOffset == null ? bodyTypeOffset = new BodyTypeOffset() : bodyTypeOffset; }
set { bodyTypeOffset = value; EventsManager.OnActorChanged(this); }
set { bodyTypeOffset = value; }
}
[XmlIgnore] public bool Initiator
{
get { return initiator == true; }
set { if (value) { initiator = true; } else initiator = null; EventsManager.OnActorChanged(this); }
set { if (value) { initiator = true; } else initiator = null; }
}
[XmlIgnore] public bool ControlGenitalAngle
{
get { return controlGenitalAngle == true; }
set { if (value) { controlGenitalAngle = true; } else controlGenitalAngle = null; EventsManager.OnActorChanged(this); }
set { if (value) { controlGenitalAngle = true; } else controlGenitalAngle = null; }
}
[XmlIgnore] public bool IsFucking
{
get { return isFucking == true; }
set { if (value) { isFucking = true; } else isFucking = null; EventsManager.OnActorChanged(this); }
set { if (value) { isFucking = true; } else isFucking = null; }
}
[XmlIgnore] public bool IsFucked
{
get { return isFucked == true; }
set { if (value) { isFucked = true; } else isFucked = null; EventsManager.OnActorChanged(this); }
set { if (value) { isFucked = true; } else isFucked = null; }
}
// Local data
@ -163,6 +163,16 @@ namespace RimWorldAnimationStudio
return Workspace.animationDef.Actors.IndexOf(this);
}
public ActorPosition GetCurrentPosition()
{
return GetPositionAtTick(Workspace.StageTick);
}
public ActorPosition GetPositionAtTick(int atTick)
{
return new ActorPosition(GetActorID(), atTick);
}
// Pre-save / post-load
public void OnPreSave()
{