#[FIXED] FuelUI.cs Flaw (right-click fuel UI)

1 messages · Page 1 of 1 (latest)

thorn cipher
#

There are actually two related overlapping bugs causing this to fail.

FuelUI.Start(), the game loops through an array called fuelSlotUIs to hook up the left-click and right-click interactions.

protected override void Start()
{
    base.Start();
    if (!GMJAEJHOBIP)
    {
        GMJAEJHOBIP = true;
        FuelElementUI[] array = fuelSlotUIs;
        
        // This loop attaches the click logic to the slots
        foreach (FuelElementUI obj in array)
        {
            obj.OnSlotLeftClick = (Action<int, Slot>)Delegate.Combine(obj.OnSlotLeftClick, new Action<int, Slot>(MOOHJGJMPBI));
            obj.OnSlotRightClick = (Action<int, Slot>)Delegate.Combine(obj.OnSlotRightClick, new Action<int, Slot>(FCJHOLIOBHP));
        }
    }
}

Because firewoodSlot is kept completely separate and isn't inside the fuelSlotUIs array, the foreach mapping loop completely skips it. As a result, the Firewood slot never explicitly gets its OnSlotRightClick delegate assigned. (Left-click probably still works because it gets assigned a few lines further down, or is linked in the Unity Inspector)

However, for the fuel slots (where the foreach loop does assign the right-click properly), the right click still fails because the FuelElementUIs have nonInteractable flagged natively. But over in SlotUI.cs, the OnPointerDown function has a gate that looks like this:

public void OnPointerDown(PointerEventData eventData) 
{
    if (!nonInteractable)
    {
        if (eventData.button == PointerEventData.InputButton.Right)
        { ... OnSlotRightClick(PNJLLJGPOMO, BOACFHEAODD); ... }
    }
}

Because nonInteractable explicitly wraps the entire block—including Right-Clicks—the game intentionally swallows all Right-Click events on the FuelUI layer before they can ever trigger the systems below them.

#

General patch needed (depending on other logic of why you guys have the non-interactable systems)

 protected override void Start()
 {
     base.Start();
     if (!GMJAEJHOBIP)
     {
         GMJAEJHOBIP = true;
         FuelElementUI[] array = fuelSlotUIs;
         foreach (FuelElementUI obj in array)
         {
             obj.OnSlotLeftClick = (Action<int, Slot>)Delegate.Combine(obj.OnSlotLeftClick, new Action<int, Slot>(MOOHJGJMPBI));
             obj.OnSlotRightClick = (Action<int, Slot>)Delegate.Combine(obj.OnSlotRightClick, new Action<int, Slot>(FCJHOLIOBHP));
         }
         
+        // Hook up the separate firewood slot so right-click works
+        if (firewoodSlot != null)
+        {
+            firewoodSlot.OnSlotLeftClick = (Action<int, Slot>)Delegate.Combine(firewoodSlot.OnSlotLeftClick, new Action<int, Slot>(MOOHJGJMPBI));
+            firewoodSlot.OnSlotRightClick = (Action<int, Slot>)Delegate.Combine(firewoodSlot.OnSlotRightClick, new Action<int, Slot>(FCJHOLIOBHP));
+        }
     }
 }

Then

public void OnPointerDown(PointerEventData eventData) 
{
-   if (!nonInteractable)
+   if (!nonInteractable || eventData.button == PointerEventData.InputButton.Right)
    {
        // ... (existing right click interactions)
thorn cipher
#

tried creating a patch for this, might also include an issue from Unity itself (Updated the report with other logic flaws)

broken pewter
#

that is ONE glorious bug report, hats off

thorn cipher
peak storm
#

If this gets implemented you deserve a reward

thorn cipher
worn dew
#

Thanks! I'll take a look

worn dew
#

Will be fixed in next patch 👍

peak storm
#

@thorn cipher the absolute 🐐

broken pewter
#

@thorn cipher hotdiggity, fix my life next pls