KeChancellor Posted August 29, 2024 Share Posted August 29, 2024 Hi " deconstructible " work. " constructible " doesn't work. Why? I would like to initialize "constructible" correctly bye Lele [07:34:36.111] [1] [INFO] deconstructable OK > PneumaticTrapDoorComplete (Deconstructable) [07:34:36.112] [1] [ERROR] constructable ERROR > [07:34:36.121] [1] [INFO] Lele-DoorOverhaul's assembly declared the method Door_Overhaul.MoveButton:DeconstructableX01 in the stack trace, adding to referenced mods list constructable Error > constructable Error > at UnityEngine.Debug.LogError (System.Object message) [0x00000] in <a83e096d0ba5413da59ce235b648c30c>:0 at Debug.LogError (System.Object obj) [0x00000] in <2598952161914e378052168cea6e0ba6>:0 at Door_Overhaul.MoveButton.DeconstructableX01 () [0x00000] in <e955c1902f054cb1821f6ba53f07c721>:0 at Door_Overhaul.MoveButton.<OnRefreshUserMenu>b__9_0 () [0x00000] in <e955c1902f054cb1821f6ba53f07c721>:0 at UserMenu+<>c__DisplayClass15_0.<AddButton>b__0 () [0x00000] in <c18663f9691a40bc9c2656a637489d6d>:0 at KButton.SignalClick (KKeyCode btn) [0x00000] in <2598952161914e378052168cea6e0ba6>:0 at KButton.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <2598952161914e378052168cea6e0ba6>:0 at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.StandaloneInputModule.ReleaseMouse (UnityEngine.EventSystems.PointerEventData pointerEvent, UnityEngine.GameObject currentOverGo) [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMousePress (UnityEngine.EventSystems.PointerInputModule+MouseButtonEventData data) [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent (System.Int32 id) [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent () [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 at UnityEngine.EventSystems.EventSystem.Update () [0x00000] in <e9635660f69b4d9d84c085aeda3be353>:0 Build: U52-626616-SD #pragma warning disable CS0649 [MyCmpGet] private Deconstructable deconstructable; [MyCmpGet] private Constructable constructable; #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(() => DeconstructableX01()), shortcutKey: Action.BuildingUtility1, tooltipText: STRINGS.BUILDINGS.PREFABS.MOVEDOOR.TOOLTIP ) ); } private void DeconstructableX01() { if (deconstructable == null) { Debug.LogError("deconstructable ERROR > " + deconstructable); } else { deconstructable.SetWorkTime(15f); Debug.Log("deconstructable OK > " + deconstructable); } if (constructable == null) { Debug.LogError("constructable ERROR > " + constructable); } else { constructable.SetWorkTime(15f); Debug.Log("constructable OK > " + constructable); } } ... Link to comment https://forums.kleientertainment.com/forums/topic/159408-init-constructable-constructable/ Share on other sites More sharing options...
outseeker Posted November 10, 2024 Share Posted November 10, 2024 I think deconstructable is a property assigned to a finished and existing item in the game world, allowing or restricting the user from using the deconstruct button on it; what is "constructable" supposed to actually be? If you want to check if the item can be constructed based on research, or if it's even a buildable item at all, there is probably a value for that but idk what that is off hand. I would guess IsBuildable or CanBuild or something just randomly- gotta go searchin in the code tho. I never fully made a mod for ONI myself, but I also wonder if #pragma warning disable CS0649 and restore cs0649 are necessary and correct? Is that to bypass the error while declaring the privates because there is no "constructable"? Also MyCmpGet after each line seems odd, is that right? What's it doing there? Semi-recently they added Move to as a function, so you might be able to look at your mod from a different angle, and just reuse/modify their Move To function. Also there is a new functionality in one of the tabs of built items in game, where you can click to easily rebuild it in a different material- I think reading that code would help a lot, as between those 2 functions you probably have check if buildable, queue deconstruct, queue reconstruct, etc. everything you'd need really to move a door. Link to comment https://forums.kleientertainment.com/forums/topic/159408-init-constructable-constructable/#findComment-1756544 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.