KeChancellor Posted June 17, 2024 Share Posted June 17, 2024 Hello everybody, I would like to change the deconstruct time of an item in the game. Is there an example I can study? Thank you Lele Link to comment https://forums.kleientertainment.com/forums/topic/157227-change-the-deconstruct-time/ Share on other sites More sharing options...
KeChancellor Posted June 22, 2024 Author Share Posted June 22, 2024 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static Door_Overhaul.STRINGS.BUILDINGS.PREFABS; using static STRINGS.UI.ELEMENTAL; using static Door_Overhaul.PneumaticTrapDoorManager; namespace Door_Overhaul { internal class MoveButton : KMonoBehaviour { #pragma warning disable CS0649 [MyCmpGet] private Deconstructable deconstructable; #pragma warning restore CS0649 protected override void OnPrefabInit() { base.OnPrefabInit(); this.Subscribe((int)GameHashes.RefreshUserMenu, new System.Action<object>(OnRefreshUserMenu)); } private void OnRefreshUserMenu(object data) { Game.Instance.userMenu.AddButton( go: this.gameObject, button: new KIconButtonMenu.ButtonInfo( iconName: "action_mirror", text: STRINGS.BUILDINGS.PREFABS.MOVEDOOR.NAME, on_click: new System.Action(Destroy), shortcutKey: Action.BuildingUtility1, tooltipText: STRINGS.BUILDINGS.PREFABS.MOVEDOOR.TOOLTIP ) ); } private void Destroy() { deconstructable.SetWorkTime(5f); deconstructable.Trigger((int)GameHashes.MarkForDeconstruct, null); deconstructable.Trigger((int)GameHashes.RefreshUserMenu, null); } } } Work for me Link to comment https://forums.kleientertainment.com/forums/topic/157227-change-the-deconstruct-time/#findComment-1728263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.