Example #1
0
 public override void OnFinishedLoad()
 {
     if (GameManager.IsServer)
     {
         CurrentFabricator = XmlSaveLoad.GetReferenceable(_savedId) as SimpleFabricatorBase;
     }
 }
Example #2
0
 public override void Process()
 {
     if (!GameManager.IsServer)
     {
         patch_LogicHashGen   logicReader = ProcessedMessage.Find <patch_LogicHashGen>(LogicReaderId);
         SimpleFabricatorBase fabricator  = ProcessedMessage.Find <SimpleFabricatorBase>(FabricatorId);
         if (logicReader == null || fabricator == null)
         {
             List <NetworkInstanceId> list = new List <NetworkInstanceId> {
                 LogicReaderId, FabricatorId
             };
             Singleton <GameManager> .Instance.NetworkManager.StartCoroutine(base.WaitUntilFound(Process, Process, list, 10f, "LogicHashGen"));
         }
         else
         {
             logicReader.CurrentFabricator = fabricator;
         }
     }
 }
Example #3
0
        public override DelayedActionInstance InteractWith(Interactable interactable, Interaction interaction, bool doAction = true)
        {
            DelayedActionInstance delayedActionInstance = new DelayedActionInstance {
                Duration      = 0f,
                ActionMessage = interactable.ContextualName
            };
            InteractableType action = interactable.Action;

            if (interaction.SourceSlot.Occupant is Screwdriver)
            {
                if (action == InteractableType.Button1)
                {
                    SimpleFabricatorBase nextReadable = GetNextReadable(CurrentFabricator, base.InputNetwork1DevicesSorted, interaction.AltKey);
                    if (!nextReadable)
                    {
                        return(delayedActionInstance.Fail(InterfaceStrings.LogicNoReadableDevices));
                    }
                    delayedActionInstance.StateMessage = string.Format(InterfaceStrings.ChangeSettingTo, nextReadable.ToTooltip());
                    if (!KeyManager.GetButton(KeyMap.QuantityModifier))
                    {
                        delayedActionInstance.ExtendedMessage = InterfaceStrings.HoldForPreviousObject;
                    }
                    if (!doAction)
                    {
                        return(delayedActionInstance.Succeed());
                    }
                    if (GameManager.IsServer)
                    {
                        NetworkServer.SendByChannelToAll(1077, new SetHashGenMessage {
                            FabricatorId  = nextReadable.netId,
                            LogicReaderId = base.netId
                        }, 0);
                        CurrentFabricator = nextReadable;
                        Setting           = 0.0;
                    }
                    return(delayedActionInstance.Succeed());
                }
            }
            else
            {
                if (action == InteractableType.Button1)
                {
                    if (!doAction)
                    {
                        return(delayedActionInstance.Succeed());
                    }
                    foreach (int key in InputPrefabs.PrefabReferences.Keys)
                    {
                        InputPrefabs.PrefabReferences[key].SetVisible(false);
                    }
                    if (InventoryManager.ParentHuman.IsLocalPlayer)
                    {
                        if (CurrentFabricator != null && CurrentFabricator)
                        {
                            if (InputPrefabs.ShowInputPanel("Recipe Hash Selector", null, CurrentFabricator.DynamicThings, CurrentFabricator.CurrentBuildState.ManufactureDat.MachinesTier))
                            {
                                InputPrefabs.OnSubmit += InputFinished;
                                StartCoroutine(WaitForDropdown());
                            }
                        }
                        else
                        {
                            if (InputPrefabs.ShowInputPanel("Recipe Hash Selector", null, GetDynamicThings(), MachineTier.Max))
                            {
                                InputPrefabs.OnSubmit += InputFinished;
                                StartCoroutine(WaitForDropdown());
                            }
                        }
                    }
                    return(delayedActionInstance.Succeed());
                }
            }
            return(base.InteractWith(interactable, interaction, doAction));
        }