Veilheim/Blueprints/BlueprintManager.cs
/// <summary>
///     Show and change blueprint selection radius
/// </summary>
Show and change blueprint selection radius
Show and change blueprint selection radius
private void ShowBlueprintRadius(On.Player.orig_UpdatePlacement orig, Player self, bool takeInput, float dt)
        {
            orig(self, takeInput, dt);
            if (self.m_placementGhost)
            {
                var piece = self.m_placementGhost.GetComponent<Piece>();
                if (piece != null)
                {
                    if (piece.name == "make_blueprint" && !piece.IsCreator())
                    {
                        if (!self.m_placementMarkerInstance)
                        {
                            return;
                        }
                        self.m_maxPlaceDistance = 50f;
                        if (!Input.GetKey(KeyCode.LeftShift))
                        {
                            if (Input.GetAxis("Mouse ScrollWheel") < 0f)
                            {
                                Instance.selectionRadius -= 2f;
                                if (Instance.selectionRadius < 2f)
                                {
                                    Instance.selectionRadius = 2f;
                                }
                            }
                            if (Input.GetAxis("Mouse ScrollWheel") > 0f)
                            {
                                Instance.selectionRadius += 2f;
                            }
                        }
                        var circleProjector = self.m_placementMarkerInstance.GetComponent<CircleProjector>();
                        if (circleProjector == null)
                        {
                            circleProjector = self.m_placementMarkerInstance.AddComponent<CircleProjector>();
                            circleProjector.m_prefab = PrefabManager.Instance.GetPrefab("piece_workbench").GetComponentInChildren<CircleProjector>().m_prefab;
                            circleProjector.m_radius = -1;
                            circleProjector.Start();
                        }
                        if (circleProjector.m_radius != Instance.selectionRadius)
                        {
                            circleProjector.m_radius = Instance.selectionRadius;
                            circleProjector.m_nrOfSegments = (int)circleProjector.m_radius * 4;
                            circleProjector.Update();
                            Jotunn.Logger.LogDebug($"Setting radius to {Instance.selectionRadius}");
                        }
                    }
                    else if (piece.name.StartsWith("piece_blueprint"))
                    {
                        if (self.m_placementMarkerInstance)
                        {
                            DestroyImmediate(self.m_placementMarkerInstance);
                        }
                        if (Input.GetAxis("Mouse ScrollWheel") != 0f && Input.GetKey(KeyCode.LeftShift))
                        {
                            if (Input.GetAxis("Mouse ScrollWheel") < 0f)
                            {
                                self.m_placeRotation++;
                            }
                            if (Input.GetAxis("Mouse ScrollWheel") > 0f)
                            {
                                self.m_placeRotation--;
                            }
                        }
                    }
                    else
                    {
                        if (self.m_placementMarkerInstance)
                        {
                            DestroyImmediate(self.m_placementMarkerInstance);
                        }
                        self.m_maxPlaceDistance = 8;
                    }
                }
            }
        }
private void ShowBlueprintRadius ( On . Player . orig_UpdatePlacement orig , Player self , bool takeInput , float dt ) { orig ( self , takeInput , dt ) ; if ( self . m_placementGhost ) { var piece = self . m_placementGhost . GetComponent < Piece > ( ) ; if ( piece != null ) { if ( piece . name == " " && ! piece . IsCreator ( ) ) { if ( ! self . m_placementMarkerInstance ) { return ; } self . m_maxPlaceDistance = 50f ; if ( ! Input . GetKey ( KeyCode . LeftShift ) ) { if ( Input . GetAxis ( " " ) < 0f ) { Instance . selectionRadius -= 2f ; if ( Instance . selectionRadius < 2f ) { Instance . selectionRadius = 2f ; } } if ( Input . GetAxis ( " " ) > 0f ) { Instance . selectionRadius += 2f ; } } var circleProjector = self . m_placementMarkerInstance . GetComponent < CircleProjector > ( ) ; if ( circleProjector == null ) { circleProjector = self . m_placementMarkerInstance . AddComponent < CircleProjector > ( ) ; circleProjector . m_prefab = PrefabManager . Instance . GetPrefab ( " " ) . GetComponentInChildren < CircleProjector > ( ) . m_prefab ; circleProjector . m_radius = - 1 ; circleProjector . Start ( ) ; } if ( circleProjector . m_radius != Instance . selectionRadius ) { circleProjector . m_radius = Instance . selectionRadius ; circleProjector . m_nrOfSegments = ( int ) circleProjector . m_radius * 4 ; circleProjector . Update ( ) ; Jotunn . Logger . LogDebug ( $" Setting radius to  { Instance . selectionRadius } " ) ; } } else if ( piece . name . StartsWith ( " " ) ) { if ( self . m_placementMarkerInstance ) { DestroyImmediate ( self . m_placementMarkerInstance ) ; } if ( Input . GetAxis ( " " ) != 0f && Input . GetKey ( KeyCode . LeftShift ) ) { if ( Input . GetAxis ( " " ) < 0f ) { self . m_placeRotation ++ ; } if ( Input . GetAxis ( " " ) > 0f ) { self . m_placeRotation -- ; } } } else { if ( self . m_placementMarkerInstance ) { DestroyImmediate ( self . m_placementMarkerInstance ) ; } self . m_maxPlaceDistance = 8 ; } } } }
Show and change blueprint selection radius
Show and change blueprint selection radius
// Force calculation of segment count // Destroy placement marker instance to get rid of the circleprojector // Reset rotation when changing camera // Destroy placement marker instance to get rid of the circleprojector // Restore placementDistance // default value, if we introduce config stuff for this, then change it here!
orig
On.Player.orig_UpdatePlacement
self
Player
takeInput
bool
dt
float