Exemplo n.º 1
0
 public static void ToggleCartTier(FreightCartStation station, int carttier)
 {
     station.CartTier = carttier + 1 <= 5 ? carttier + 1 : 0;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceCartTier, carttier.ToString(), null, station, 0f);
     }
     FreightCartWindow.dirty = true;
     station.MarkDirtyDelayed();
 }
Exemplo n.º 2
0
 public static void ToggleOfferAll(FreightCartStation station, string offerall)
 {
     station.OfferAll = offerall == "All" ? true : false;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceToggleOffer, offerall, null, station, 0f);
     }
     FreightCartWindow.dirty = true;
     station.MarkDirtyDelayed();
 }
Exemplo n.º 3
0
 public static void ToggleLoadStatus(FreightCartStation station, string loadwhenfull)
 {
     station.mbWaitForFullLoad = loadwhenfull == "Full" ? true : false;
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand(InterfaceName, InterfaceToggleLoad, loadwhenfull, null, station, 0f);
     }
     FreightCartWindow.dirty = true;
     station.MarkDirtyDelayed();
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 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();
 }
Exemplo n.º 6
0
 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();
     }
 }
Exemplo n.º 7
0
 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();
 }
Exemplo n.º 8
0
 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();
 }
Exemplo n.º 9
0
 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();
 }
Exemplo n.º 10
0
 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();
 }
Exemplo n.º 11
0
    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();
    }
Exemplo n.º 12
0
    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();
    }