protected override void MoveThingTo([NotNull] Thing thing, IntVec3 beltDest) { OnBeginMove(thing, beltDest); // Lifts only output to surface var belt = beltDest.GetBeltComponent(); // Check if there is a belt, if it is empty, and also check if it is active ! if (belt == null || !belt.ItemContainer.Empty || belt.BeltPhase != Phase.Active) { return; } ItemContainer.TransferItem(thing, belt.ItemContainer); // Need to check if it is a receiver or not ... belt.ThingOrigin = parent.Position; }
protected virtual void MoveThingTo([NotNull] Thing thing, IntVec3 beltDest) { if (CanOutputToNonBelt() && Find.TerrainGrid.TerrainAt(beltDest).changeable) { ItemContainer.DropItem(thing, beltDest); } else { var beltComponent = beltDest.GetBeltComponent(); // Check if there is a belt, if it is empty, and also check if it is active ! if (beltComponent == null || !beltComponent.ItemContainer.Empty || beltComponent.BeltPhase != Phase.Active) { return; } ItemContainer.TransferItem(thing, beltComponent.ItemContainer); // Need to check if it is a receiver or not ... beltComponent.ThingOrigin = parent.Position; } }
private bool IsFreeBelt(IntVec3 position) { BeltComponent destBelt = position.GetBeltComponent(); return(destBelt != null && destBelt.CanAcceptFrom(this)); }
// This is a fast function for surface belts, underground belts must extend and override protected virtual void MoveThingTo([NotNull] Thing thing, IntVec3 beltDest) { OnBeginMove(thing, beltDest); if (CanOutputToNonBelt() && Find.TerrainGrid.TerrainAt(beltDest).changeable) { ItemContainer.DropItem(thing, beltDest); } else if ( OutputLevel == Level.Surface ) { // Find a belt component at our output level var belt = beltDest.GetBeltComponent(); // Check if there is a belt, if it is empty, and also check if it is active ! if (belt == null || !belt.ItemContainer.Empty || belt.BeltPhase != Phase.Active) { return; } ItemContainer.TransferItem(thing, belt.ItemContainer); // Need to check if it is a receiver or not ... belt.ThingOrigin = parent.Position; } }
public static Sender GetSenderAtPos(IntVec3 pos) { return pos.GetBeltComponent() as Sender; }
public static Receiver GetReceiverAtPos(IntVec3 pos) { return pos.GetBeltComponent() as Receiver; }
protected bool IsFreeBelt(IntVec3 position) { BeltComponent destBelt = position.GetBeltComponent(); return (destBelt != null && destBelt.CanAcceptFrom(this)); }
private bool IsFreeBelt(IntVec3 position, bool onlyCheckConnection = false) { BeltComponent destBelt = position.GetBeltComponent(); return (destBelt != null && destBelt.CanAcceptFrom(this, onlyCheckConnection)); }