rename IWorldObject.ReturnObject to AttachedObject

This commit is contained in:
JohnCorby 2022-01-26 00:55:47 -08:00
parent 8fbc946252
commit 503c0b85cc
5 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ namespace QSB.ItemSync.WorldObjects.Sockets
=> AttachedObject.IsSocketOccupied();
public virtual bool PlaceIntoSocket(IQSBOWItem item)
=> AttachedObject.PlaceIntoSocket((OWItem)item.ReturnObject());
=> AttachedObject.PlaceIntoSocket((OWItem)item.AttachedObject);
public virtual IQSBOWItem RemoveFromSocket()
=> AttachedObject.RemoveFromSocket().GetWorldObject<IQSBOWItem>();

View File

@ -17,7 +17,7 @@ namespace QSB.ItemSync.WorldObjects.Sockets
=> AttachedObject.IsSocketOccupied();
public virtual bool PlaceIntoSocket(IQSBOWItem item)
=> AttachedObject.PlaceIntoSocket((OWItem)item.ReturnObject());
=> AttachedObject.PlaceIntoSocket((OWItem)item.AttachedObject);
public virtual IQSBOWItem RemoveFromSocket()
=> AttachedObject.RemoveFromSocket().GetWorldObject<IQSBOWItem>();

View File

@ -258,14 +258,14 @@ namespace QSB.Utility
foreach (var obj in QSBWorldSync.GetWorldObjects())
{
if (obj.ReturnObject() == null)
if (obj.AttachedObject == null)
{
return;
}
if (obj.ShouldDisplayDebug())
{
DrawLabel(obj.ReturnObject().transform, obj.ReturnLabel());
DrawLabel(obj.AttachedObject.transform, obj.ReturnLabel());
}
}
}
@ -279,7 +279,7 @@ namespace QSB.Utility
foreach (var obj in QSBWorldSync.GetWorldObjects())
{
if (obj.ReturnObject() == null)
if (obj.AttachedObject == null)
{
return;
}

View File

@ -6,9 +6,9 @@ namespace QSB.WorldSync
{
int ObjectId { get; }
string Name { get; }
MonoBehaviour AttachedObject { get; }
void OnRemoval();
MonoBehaviour ReturnObject();
bool ShouldDisplayDebug();
string ReturnLabel();
void DisplayLines();

View File

@ -6,13 +6,13 @@ namespace QSB.WorldSync
where T : MonoBehaviour
{
public int ObjectId { get; init; }
MonoBehaviour IWorldObject.AttachedObject => AttachedObject;
public T AttachedObject { get; init; }
public string Name => AttachedObject ? AttachedObject.name : "<NullObject!>";
public override string ToString() => $"{ObjectId}:{GetType().Name} ({Name})";
public virtual void Init() { }
public virtual void OnRemoval() { }
public MonoBehaviour ReturnObject() => AttachedObject;
public virtual bool ShouldDisplayDebug() => QSBWorldSync.AllObjectsReady && AttachedObject && AttachedObject.gameObject.activeInHierarchy;
public virtual string ReturnLabel() => ToString();
public virtual void DisplayLines() { }