fix bug, where condition buttons are enabled in readonly mode

This commit is contained in:
OMGeeky
2025-06-24 18:45:15 +02:00
parent cd36813050
commit c0e24b4cf5
2 changed files with 14 additions and 8 deletions

View File

@@ -4,7 +4,5 @@
There are probably a lot of things that could be optimized, which will not be on this list There are probably a lot of things that could be optimized, which will not be on this list
(which will probably also be done, they are just not important enough to track them) (which will probably also be done, they are just not important enough to track them)
-
- check, why for example the "Forever" button is active for not altered entities (ex.: NPC->hitEffect) if they have a condition already there
- apparently that's always been like that... (or at least on the most recent main branch)

View File

@@ -322,19 +322,27 @@ public class CommonEditor {
} }
public void updateEffectTimedConditionWidgets(ELEMENT condition) { public void updateEffectTimedConditionWidgets(ELEMENT condition) {
boolean writable = editor.target.writable;
boolean immunity = condition.isImmunity(); boolean immunity = condition.isImmunity();
boolean clear = condition.isClear(); boolean clear = condition.isClear();
boolean forever = condition.isInfinite(); boolean forever = condition.isInfinite();
conditionClear.setSelected(clear); conditionClear.setSelected(clear);
conditionApply.setSelected(!clear && !immunity); conditionApply.setSelected(!clear && !immunity);
conditionMagnitude.setEnabled(!clear && !immunity);
conditionImmunity.setSelected(immunity); conditionImmunity.setSelected(immunity);
conditionTimed.setSelected(!forever); conditionTimed.setSelected(!forever);
conditionTimed.setEnabled(!clear);
conditionDuration.setEnabled(!clear && !forever);
conditionForever.setSelected(forever); conditionForever.setSelected(forever);
conditionForever.setEnabled(!clear);
conditionDuration.setEnabled(!clear && !forever && writable);
conditionClear.setEnabled(writable);
conditionApply.setEnabled(writable);
conditionMagnitude.setEnabled(!clear && !immunity && writable);
conditionImmunity.setEnabled(writable);
conditionTimed.setEnabled(!clear && writable);
conditionForever.setEnabled(!clear && writable);
} }
public void updateEffectTimedConditionEditorPane(JPanel pane, ELEMENT condition, final FieldUpdateListener listener) { public void updateEffectTimedConditionEditorPane(JPanel pane, ELEMENT condition, final FieldUpdateListener listener) {