private void recycle() { if (info != null) { ui.reportPane.Clear(); info.Recycle(discardExcess.isOn, on_recycled); } }
/// <summary> /// Calls the Recycle() method on an objects if it implements /// the IRecyclable interface /// </summary> /// <param name="item"> /// Object whose Recycle() method will be called if supported by the object /// </param> private static void callRecycleIfSupported(ItemType item) { IRecyclable recycleable = item as IRecyclable; if (recycleable != null) { recycleable.Recycle(); } }
public void Execute(IRecyclable target, bool didRecycle = false) { // don't scrap stuff that's already been scrapped due to it being in cargo of something else being scrapped! if (!target.IsDisposed) { var val = target.ScrapValue; if (target.Owner != null) // if not, it's already scrapped? { target.Owner.StoredResources += val; target.Owner.Log.Add(target.CreateLogMessage("We have scrapped " + target + " and reclaimed " + val + ".")); } target.Dispose(); if (!didRecycle) { target.Recycle(this, true); } } }