]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/button.qc
Fix damage text printing console errors in case of environmental damage without a...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / button.qc
index 8299a6859f539c097404e15184437e0903b44c4f..e9f418ad9c24f79063b80dd848bc9f7f056cbe46 100644 (file)
                if (pos.y >= 1) me.pressed = 0;
                return 1;
        }
-       float Button_mousePress(entity me, vector pos)
+       METHOD(Button, mousePress, bool(Button this, vector pos))
        {
-               me.mouseDrag(me, pos);  // verify coordinates
-               return 1;
+               this.mouseDrag(this, pos);  // verify coordinates
+               return true;
        }
        float Button_mouseRelease(entity me, vector pos)
        {
                if (me.clickTime > 0 && me.clickTime <= frametime)
                {
                        // keyboard click timer expired? Fire the event then.
-                       if (!me.disabled)
-                               if (me.onClick) me.onClick(me, me.onClickEntity);
+                       if (!me.disabled && me.onClick)
+                       {
+                               if(me.applyButton)
+                                       me.applyButton.disabled = false;
+                               me.onClick(me, me.onClickEntity);
+                               if(me.disableOnClick)
+                                       me.disabled = true;
+                       }
                }
                me.clickTime -= frametime;