public bool shouldCartInteract(EntityMinecart cart) { return (this.minecart == null && // There is no Minecart already here cart.position == this.pos && !cart.inventory.isFull()); }
public override void placeIntoWorld(World world, BuildAreaHighlighter highlight, Position pos, Rotation rotation) { EntityMinecart minecart = (EntityMinecart)world.entities.spawn(pos, 2); // Minecart id. Rotation trackRot = world.getCellState(pos).rotation; minecart.rotation = rotation.axis == EnumAxis.Y ? trackRot : trackRot.opposite(); // Incrase stat. world.statManager.minecartsPlaced.increase(1); }
public override bool deposit(Item item) { bool addedItem = this.minecart.inventory.addItem(item); if (this.minecart.inventory.isFull()) { this.minecart.release(); this.minecart = null; } return(addedItem); }
//private float tripTimer; public override void onUpdate() { base.onUpdate(); //this.tripTimer -= Time.deltaTime; //if(this.tripTimer <= 0) { // this.dirty(); // this.isTripped = false; //} if (this.tripper != null && this.tripper.position != this.pos) { this.tripper = null; } }
public void setTripped(EntityMinecart cart) { if (this.tripper == null || (this.tripper != cart)) { this.tripper = cart; this.isTripped = !this.isTripped; this.dirty(); CellBehaviorLever.alertNeighborsOfFlip(this); } /* * this.tripTimer = 0.1f; * if(!this.isTripped) { * this.isTripped = true; * this.dirty(); * } */ }