Пример #1
0
 private static void SetupPlacementGhost(On.Player.orig_SetupPlacementGhost orig, Player self)
 {
     PlanPiece.m_forceDisableInit = true;
     orig(self);
     if (self.m_placementGhost)
     {
         if (PlanBuildPlugin.showRealTextures)
         {
             UpdateTextures(self.m_placementGhost, ShaderState.Skuld);
         }
         else if (PlanBuildPlugin.configTransparentGhostPlacement.Value &&
                  (self.m_placementGhost.name.StartsWith(Blueprint.BlueprintPrefabName) ||
                   self.m_placementGhost.name.Split('(')[0].EndsWith(PlanPiecePrefab.PlannedSuffix))
                  )
         {
             UpdateTextures(self.m_placementGhost, ShaderState.Supported);
         }
     }
     PlanPiece.m_forceDisableInit = false;
 }
Пример #2
0
        // Detours Player.SetupPlacementGhost
        // Refs:
        //  - Player.m_buildPieces
        //  - PieceTable.GetSelectedPrefab
        private void PlayerSetupPlacementGhost(On.Player.orig_SetupPlacementGhost orig, Player self)
        {
            if (self.m_buildPieces?.GetSelectedPrefab() == null)
            {
                orig(self);
                return;
            }

            GameObject ghost = PrefabManager.Instance.GetPrefab(self.m_buildPieces.GetSelectedPrefab().name + "_ghostfab");

            if (ghost == null)
            {
                orig(self);
                return;
            }

            ghostOverridePiece = ghost;
            orig(self);
            ghostOverridePiece = null;
        }