public static void PasteFreight(FreightCartStation destination)
 {
     FreightCartManager.instance.PasteFreightEntries(destination, destination.NetworkID, destination.massStorageCrate);
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfacePasteFreight, null, null, destination, 0f);
     }
     FreightCartWindow.networkredraw = true;
     destination.MarkDirtyDelayed();
     destination.RequestImmediateNetworkUpdate();
 }
 public static void SetStationName(FreightCartStation station, string stationname)
 {
     station.StationName = stationname;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceSetName, stationname, null, station, 0f);
     }
     FreightCartWindow.networkredraw = true;
     station.MarkDirtyDelayed();
     station.RequestImmediateNetworkUpdate();
 }
 public static void NameInventory(FreightCartStation station, string inventoryname)
 {
     if (station.ConnectedInventory != null)
     {
         station.ConnectedInventory.Name = inventoryname;
         if (!WorldScript.mbIsServer)
         {
             NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceSetInventoryName, inventoryname, null, station, 0f);
         }
         FreightCartWindow.networkredraw = true;
         station.MarkDirtyDelayed();
         station.RequestImmediateNetworkUpdate();
     }
 }
 public static void SetHopperOfferItem(FreightCartStation station, ItemBase item)
 {
     if (station.HopperInterface == null)
     {
         return;
     }
     station.HopperInterface.OfferItem = item;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceHopperOffer, null, item, station, 0f);
     }
     FreightCartWindow.networkredraw = true;
     station.MarkDirtyDelayed();
     station.RequestImmediateNetworkUpdate();
 }
 public static void AddRegistry(FreightCartStation station, ItemBase item)
 {
     if (item == null)
     {
         Debug.LogWarning("Freight cart window trying to add registry for null item!");
     }
     FreightCartManager.instance.AddRegistry(station.NetworkID, station.massStorageCrate, item, 0, 0);
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceAddReg, null, item, station, 0f);
     }
     FreightCartWindow.networkredraw = true;
     station.MarkDirtyDelayed();
     station.RequestImmediateNetworkUpdate();
 }
 public static void SetCartAssignment(FreightCartStation station, int assignedcarts)
 {
     if (assignedcarts < 0)
     {
         return;
     }
     station.AssignedCarts = assignedcarts;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceAssignedCarts, assignedcarts.ToString(), null, station, 0f);
     }
     FreightCartWindow.dirty = true;
     station.MarkDirtyDelayed();
     station.RequestImmediateNetworkUpdate();
 }
 public static void SetHopperRequest(FreightCartStation station, int request)
 {
     if (station.HopperInterface == null || request < 0)
     {
         return;
     }
     station.HopperInterface.RequestLimit = request;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceHopperLow, request.ToString(), null, station, 0f);
     }
     FreightCartWindow.dirty = true;
     station.MarkDirtyDelayed();
     station.RequestImmediateNetworkUpdate();
 }
    public static void SetLowStock(FreightCartStation station, ItemBase item, int stock)
    {
        if (item == null)
        {
            Debug.LogWarning("Freight cart window trying to set low stock for null item!");
        }
        int highstock = FreightCartManager.instance.GetHighStock(station.NetworkID, station.massStorageCrate, item);

        FreightCartManager.instance.UpdateRegistry(station.NetworkID, station.massStorageCrate, item, stock, stock > highstock ? stock : -1);
        if (!WorldScript.mbIsServer)
        {
            NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceSetLowStock, stock.ToString(), item, station, 0f);
        }
        FreightCartWindow.dirty = true;
        station.MarkDirtyDelayed();
        station.RequestImmediateNetworkUpdate();
    }
    public static void SetNetwork(FreightCartStation station, string networkid)
    {
        string oldid = station.NetworkID;

        if (!string.IsNullOrEmpty(networkid))
        {
            if (!string.IsNullOrEmpty(oldid))
            {
                FreightCartManager.instance.RemoveStationReg(station);
            }
            station.NetworkID = networkid;
            FreightCartManager.instance.TryRegisterStation(station);
        }
        FreightCartManager.instance.AddNetwork(station.NetworkID);
        if (!WorldScript.mbIsServer)
        {
            NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceSetNetwork, networkid, null, station, 0f);
        }
        FreightCartWindow.networkredraw = true;
        station.MarkDirtyDelayed();
        station.RequestImmediateNetworkUpdate();
    }