public static Thing GetAttachment(this Thing t, ThingDef def) { CompAttachBase compAttachBase = t.TryGetComp <CompAttachBase>(); if (compAttachBase == null) { return(null); } return(compAttachBase.GetAttachment(def)); }
public virtual void AttachTo(Thing parent) { this.parent = parent; CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>(); if (compAttachBase == null) { Log.Error("Cannot attach " + this + " to " + parent + ": parent has no CompAttachBase."); } else { compAttachBase.AddAttachment(this); } }
public virtual void AttachTo(Thing parent) { this.parent = parent; CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>(); if (compAttachBase == null) { Log.Error(string.Concat("Cannot attach ", this, " to ", parent, ": parent has no CompAttachBase.")); } else { compAttachBase.AddAttachment(this); } }
public static Thing GetAttachment(this Thing t, ThingDef def) { CompAttachBase compAttachBase = t.TryGetComp <CompAttachBase>(); Thing result; if (compAttachBase == null) { result = null; } else { result = compAttachBase.GetAttachment(def); } return(result); }
public virtual void AttachTo(Thing parent) { this.parent = parent; CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>(); if (compAttachBase == null) { Log.Error(string.Concat(new object[] { "Cannot attach ", this, " to ", parent, ": parent has no CompAttachBase." }), false); return; } compAttachBase.AddAttachment(this); }