public override GameObject getGameObject()
        {
            GameObject prefab = CraftHelper.Utils.prefabCopy(TechType.Terraformer);

            Terraformer trfCmp = prefab.GetComponent <Terraformer>();
            BuilderTool bldCmp = prefab.AddComponent <BuilderTool>();

            bldCmp.copyFieldsFrom(trfCmp, "rightHandIKTarget", "leftHandIKTarget", "ikAimRightArm", "ikAimLeftArm", "mainCollider", "pickupable", "useLeftAimTargetOnPlayer", "drawSound");
            bldCmp.buildSound    = trfCmp.placeLoopSound;
            bldCmp.completeSound = CraftData.GetPrefabForTechType(TechType.Builder).GetComponent <BuilderTool>().completeSound;

            Object.DestroyImmediate(trfCmp);

            bldCmp.animator = prefab.getChild("terraformer_anim").GetComponent <Animator>();
            bldCmp.powerConsumptionConstruct = bldCmp.powerConsumptionDeconstruct = Main.config.powerConsumption;

            prefab.AddComponent <TrfBuilderControl>();

            CraftHelper.Utils.initVFXFab(prefab,
                                         eulerOffset: new Vector3(-10f, 90f, 0f),
                                         posOffset: new Vector3(-0.4f, 0.11f, 0f),
                                         localMaxY: 0.24f);

            return(prefab);
        }
Ejemplo n.º 2
0
        void Awake()
        {
            builderTool = gameObject.GetComponent <BuilderTool>();
            animator    = builderTool.animator;

            init();
        }
Ejemplo n.º 3
0
 static void Prefix(BuilderTool __instance)
 {
     if (__instance.isDrawn && !Builder.isPlacing && AvatarInputHandler.main.IsEnabled() && GameUtils.getTarget(10f) is GameObject go)
     {
         DebrisPatcher.processObject(go);
     }
 }
Ejemplo n.º 4
0
        private ITool GetTool(Building building)
        {
            // Get the appropriate build tool for the selected building
            var buildingType = building.GetType();

            if (buildingType == typeof(RailStation))
            {
                _logger.Log("Returning Station");
                return(new RailStationBuilderTool((RailStation)building));
            }
            if (buildingType == typeof(Road))
            {
                _logger.Log("Returning RoadBuilderTool");
                return(new RoadBuilderTool((Road)building));
            }

            if (buildingType == typeof(Rail))
            {
                _logger.Log("Returning RailBuilderTool");
                return(new RailBuilderTool((Rail)building));
            }

            // Fetch the building recipe by its asset_id
            BuildingRecipe buildingRecipe = BuildingRecipeManager.Current.Get(building.AssetId);
            BuilderTool    builderTool    = BuilderToolManager.Current.GetTool(buildingRecipe);

            return(builderTool);
        }
        public void Awake()
        {
            this.Instance    = this;
            this.ThisVehicle = this.Instance.GetComponent <Vehicle>();
            this.EnergyMixin = this.ThisVehicle.GetComponent <EnergyMixin>();
            this.PlayerMain  = Player.main;
            BuilderTool builderPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Builder").GetComponent <BuilderTool>();

            completeSound = Instantiate(builderPrefab.completeSound, this.gameObject.transform);
        }
Ejemplo n.º 6
0
        static void Prefix(BuilderTool __instance)
        {
            if (__instance.isDrawn && !Builder.isPlacing && AvatarInputHandler.main.IsEnabled())
            {
                Targeting.GetTarget(Player.main.gameObject, 10f, out GameObject go, out float num, null);

                if (go)
                {
                    DebrisPatcher.processObject(go);
                }
            }
        }
Ejemplo n.º 7
0
        static bool BuilderTool_LateUpdate_Prefix(BuilderTool __instance)
        {
            TrfBuilderControl tbc = __instance.gameObject.GetComponent <TrfBuilderControl>();

            if (tbc == null)
            {
                return(true);
            }

            tbc.updateBeams();
            return(false);
        }
Ejemplo n.º 8
0
        static bool Prefix(BuilderTool __instance, Constructable constructable)
        {
            if (!constructable.gameObject.GetComponent <DebrisDeconstructable>())
            {
                return(true);
            }

            HandReticle hand = HandReticle.main;

            hand.SetInteractText(L10n.str("ids_salvageableDebris"), __instance.deconstructText, false, false, HandReticle.Hand.None);

            if (!constructable.constructed)
            {
                hand.SetProgress(constructable.amount);
                hand.SetIcon(HandReticle.IconType.Progress, 1.5f);
            }

            return(false);
        }
Ejemplo n.º 9
0
        private static void AlertedNewBuilderBuild(BuilderTool arg1, Constructable arg2)
        {
            if (arg2 != null)
            {
                Log.Info($"Name: {arg2.gameObject.name}");

                var powerFX = arg2.GetComponent(typeof(PowerFX));

                if (powerFX != null)
                {
                    var fx = powerFX as PowerFX;
                    Log.Info($"PowerFX: {fx.vfxPrefab.name}");
                }

                //var list = arg2.GetComponentsInChildren(typeof(Component));
                //for (int i = 0; i < list.Length; i++)
                //{
                //    Log.Info($"Component Name: {list[i].name}");
                //}
            }
        }
Ejemplo n.º 10
0
 // Token: 0x06000008 RID: 8 RVA: 0x000021A4 File Offset: 0x000003A4
 public static bool Prefix(BuilderTool __instance)
 {
     SkinnedMeshRenderer[] allComponentsInChildren  = __instance.GetAllComponentsInChildren <SkinnedMeshRenderer>();
     MeshRenderer[]        allComponentsInChildren2 = __instance.GetAllComponentsInChildren <MeshRenderer>();
     foreach (SkinnedMeshRenderer skinnedMeshRenderer in allComponentsInChildren)
     {
         bool flag = skinnedMeshRenderer.name.Contains("builder_geo");
         if (flag)
         {
             skinnedMeshRenderer.material.color = new Color32(Convert.ToByte(MainPatch.config.buildervalue), Convert.ToByte(MainPatch.config.buildergvalue), Convert.ToByte(MainPatch.config.builderbvalue), 1);
         }
     }
     foreach (MeshRenderer meshRenderer in allComponentsInChildren2)
     {
         bool flag2 = meshRenderer.name.Contains("builder");
         if (flag2)
         {
             meshRenderer.material.color = new Color32(Convert.ToByte(MainPatch.config.buildervalue), Convert.ToByte(MainPatch.config.buildergvalue), Convert.ToByte(MainPatch.config.builderbvalue), 1);
         }
     }
     return(true);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Returns the <see cref="BuilderTool.barMaterial"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static Material GetBarMaterial(this BuilderTool builderTool) => builderTool.barMaterial;
Ejemplo n.º 12
0
 /// <summary>
 /// Sets the value of <see cref="BuilderTool.noPowerText"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="text">Value to set <see cref="BuilderTool.noPowerText"/></param>
 public static void SetNoPowerText(this BuilderTool builderTool, string text) => builderTool.noPowerText = text;
Ejemplo n.º 13
0
 /// <summary>
 /// Get the value of <see cref="BuilderTool.noPowerText"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static string GetNoPowerText(this BuilderTool builderTool) => builderTool.noPowerText;
Ejemplo n.º 14
0
 /// <summary>
 /// Sets the value of <see cref="BuilderTool.constructText"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="text">Value to set <see cref="BuilderTool.constructText"/> to.</param>
 public static void SetConstructionText(this BuilderTool builderTool, string text) => builderTool.constructText = text;
Ejemplo n.º 15
0
 /// <summary>
 /// Returns the value of <see cref="BuilderTool.constructText"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static string GetConstructionText(this BuilderTool builderTool) => builderTool.constructText;
Ejemplo n.º 16
0
 /// <summary>
 /// Gets the Constructable currently being built.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static Constructable GetConstructable(this BuilderTool builderTool) => builderTool.constructable;
Ejemplo n.º 17
0
 static bool BuilderTool_Prefix(BuilderTool __instance) => !__instance.gameObject.GetComponent <TrfBuilderControl>();
Ejemplo n.º 18
0
 /// <summary>
 /// Reduces the maximum deconstruction distance.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="amount">Amount to reduce max deconstruction distance by.</param>
 public static void ReduceDeconstructionRange(this BuilderTool builderTool, float amount) => DeconstructionRange -= amount;
Ejemplo n.º 19
0
 /// <summary>
 /// Reduces the maximum build distance.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="amount">Amount to reduce max build distance by.</param>
 public static void ReduceRange(this BuilderTool builderTool, float amount) => HitRange -= amount;
Ejemplo n.º 20
0
 /// <summary>
 /// Raises the maximum build distance.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="amount">Amount to raise max build distance by.</param>
 public static void RaiseRange(this BuilderTool builderTool, float amount) => HitRange += amount;
Ejemplo n.º 21
0
 /// <summary>
 /// Returns the maximum build distance.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static float GetRange(this BuilderTool builderTool) => HitRange;
Ejemplo n.º 22
0
 internal static void Postfix(BuilderTool __instance, ref Constructable c)
 {
     onContructing?.Invoke(__instance, c);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Returns the maximum deconstruction distance.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <returns></returns>
 public static float GetDeconstructionRange(this BuilderTool builderTool) => DeconstructionRange;
Ejemplo n.º 24
0
 /// <summary>
 /// Set the <see cref="BuilderTool.barMaterial"/>.
 /// </summary>
 /// <param name="builderTool"></param>
 /// <param name="material">Material to set it to.</param>
 public static void SetBarMaterial(this BuilderTool builderTool, Material material) => builderTool.barMaterial = material;