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); }
void Awake() { builderTool = gameObject.GetComponent <BuilderTool>(); animator = builderTool.animator; init(); }
static void Prefix(BuilderTool __instance) { if (__instance.isDrawn && !Builder.isPlacing && AvatarInputHandler.main.IsEnabled() && GameUtils.getTarget(10f) is GameObject go) { DebrisPatcher.processObject(go); } }
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); }
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); } } }
static bool BuilderTool_LateUpdate_Prefix(BuilderTool __instance) { TrfBuilderControl tbc = __instance.gameObject.GetComponent <TrfBuilderControl>(); if (tbc == null) { return(true); } tbc.updateBeams(); return(false); }
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); }
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}"); //} } }
// 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); }
/// <summary> /// Returns the <see cref="BuilderTool.barMaterial"/>. /// </summary> /// <param name="builderTool"></param> /// <returns></returns> public static Material GetBarMaterial(this BuilderTool builderTool) => builderTool.barMaterial;
/// <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;
/// <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;
/// <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;
/// <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;
/// <summary> /// Gets the Constructable currently being built. /// </summary> /// <param name="builderTool"></param> /// <returns></returns> public static Constructable GetConstructable(this BuilderTool builderTool) => builderTool.constructable;
static bool BuilderTool_Prefix(BuilderTool __instance) => !__instance.gameObject.GetComponent <TrfBuilderControl>();
/// <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;
/// <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;
/// <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;
/// <summary> /// Returns the maximum build distance. /// </summary> /// <param name="builderTool"></param> /// <returns></returns> public static float GetRange(this BuilderTool builderTool) => HitRange;
internal static void Postfix(BuilderTool __instance, ref Constructable c) { onContructing?.Invoke(__instance, c); }
/// <summary> /// Returns the maximum deconstruction distance. /// </summary> /// <param name="builderTool"></param> /// <returns></returns> public static float GetDeconstructionRange(this BuilderTool builderTool) => DeconstructionRange;
/// <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;