private static bool PlacingGhostWasHiddenBeforeConnecting = ComponentPlacer.ShowPlacingGhost; // necessary to avoid BUGS! private static void ConnectionInitial() { RaycastHit hit; if (!Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance, Wire.IgnoreWiresLayermask)) { return; } if (hit.collider.tag == "Input" || hit.collider.tag == "Output") // if it's an input or output... { SelectedPeg = hit.collider.gameObject; // ..make it the selected peg StuffPlacer.OutlineObject(SelectedPeg); PegBeingLookedAt = null; // fixes SetPegBeingLookedAt removing the outline if (AutoHidePlacingGhostWhileConnecting) { StuffPlacer.DeleteThingBeingPlaced(); PlacingGhostWasHiddenBeforeConnecting = ComponentPlacer.ShowPlacingGhost; ComponentPlacer.ShowPlacingGhost = false; } StuffRotater.AllowedToDoRotation = false; // so you can rotate wires while placing them StuffDeleter.AllowedToDoDeleting = false; // prevents a bug with how null is not the same as destroyed SoundPlayer.PlaySoundAt(Sounds.ConnectionInitial, SelectedPeg); } else { SoundPlayer.PlaySoundGlobal(Sounds.FailDoSomething); DoneConnecting(); } }
public void Done() { Canvas.enabled = false; GameplayUIManager.UIState = UIState.None; StuffPlacer.DeleteThingBeingPlaced(); // quick shitty fix for FrequencyForNewNoisemakers not working properly FrequencyForNewNoisemakers = NoisemakerBeingEdited.ToneFrequency; // only update this variable during this method, so players can check notes without screwing it up }
public void DoneMenu() { MenuCanvas.enabled = false; GameplayUIManager.UIState = UIState.None; // this is so that if you change the display color and you're in the middle of placing a display, it gets set to the new color if (StuffPlacer.GetThingBeingPlaced == null) { return; } if (StuffPlacer.GetThingBeingPlaced.GetComponentInChildren<Display>()) { StuffPlacer.DeleteThingBeingPlaced(); } }
private static void PlaceAndMoveAllInOneGo() { MakeSureThingBeingPlacedIsCorrect(); if (StuffPlacer.GetThingBeingPlaced != null) { StuffPlacer.GetThingBeingPlaced.AddComponent <ObjectInfo>().ComponentType = SelectionMenu.SelectedComponentType; } StuffPlacer.RunStuffPlacing(); //StuffPlacer.PlaceThingBeingPlaced(); // already called by RunStuffPlacing StuffPlacer.DeleteThingBeingPlaced(); }
public static bool ShowPlacingGhost = true; // = Settings.Get("ShowPlacingGhost", true); public static void RunComponentPlacing() { if (Input.GetButtonDown("TogglePlacingGhost") && !Input.GetButton("Mod")) // holding mod is for toggling initial placing outline { ShowPlacingGhost = !ShowPlacingGhost; // Settings.Save("ShowPlacingGhost", ShowPlacingGhost); if (!ShowPlacingGhost) { StuffPlacer.DeleteThingBeingPlaced(); StuffPlacer.RotationAboutUpVector = 0; } } if (Input.GetButtonDown("Place") && StuffPlacer.OkayToPlace) // run BEFORE RunStuffPlacing so we can actually get ThingBeingPlaced { StuffPlacer.GetThingBeingPlaced.AddComponent <ObjectInfo>().ComponentType = SelectionMenu.SelectedComponentType; } if (ShowPlacingGhost) { MakeSureThingBeingPlacedIsCorrect(); StuffPlacer.RunStuffPlacing(true, true); // the booleans are AllowFineRotation and HideWhenInvalidPlacement } else { if (Input.GetButtonDown("Place")) { PlaceAndMoveAllInOneGo(); } } // I have absolutely no idea why this is necessary. Sometimes when you rotate a mount it f***s up component placing by enabling the colliders. This fixes that. if (StuffPlacer.MostRecentNonNullHit.collider == null) { return; } if (FullComponent(StuffPlacer.MostRecentNonNullHit.collider) == StuffPlacer.GetThingBeingPlaced) { Debug.Log("did a terrible shitty hack"); StuffPlacer.DeleteThingBeingPlaced(); } }
public void Done() { Canvas.enabled = false; TextInput.DeactivateInputField(); UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null); TextBeingEdited = null; GameplayUIManager.UIState = UIState.None; // this is so that if you change the size of the label text and you're in the middle of placing a label, it gets set to the new size if (StuffPlacer.GetThingBeingPlaced == null) { return; } if (StuffPlacer.GetThingBeingPlaced.GetComponent <Label>()) { StuffPlacer.DeleteThingBeingPlaced(); } }
private static void MakeSureThingBeingPlacedIsCorrect() { if (SelectionMenu.Instance.CustomComponentSelected) { DoFancyModdedComponentThings(); return; } // replace ThingBeingPlaced when it should be replaced - when you switch selected things or when something was just placed if (SelectionMenu.Instance.SelectedThing != 0 && (SelectionMenu.Instance.SelectedThingJustChanged || StuffPlacer.GetThingBeingPlaced == null)) { StuffPlacer.NewThingBeingPlaced(Object.Instantiate(SelectionMenu.SelectedComponent)); DoThingsForNewComponents(StuffPlacer.GetThingBeingPlaced); } else if (SelectionMenu.Instance.SelectedThing == 0) { StuffPlacer.DeleteThingBeingPlaced(); } // switching to nothing selected deletes the thing being placed }
public static void Done() { StuffPlacer.DeleteThingBeingPlaced(); WirePlacer.DoneConnecting(); SelectionMenu.Instance.FuckOff(); }