elBukkit/MagicPlugin

Attributes don't/can't inherit?

NightScythe1 opened this issue · 4 comments

I'm trying to make a few attributes, each of which should inherit their min/max values from a master attribute (for ease of editing, so I can change the main one's min/max instead of all individual sub-attributes) however, attributes don't seem to be able to inherit from another attribute. The format used was the following:

destruction:
  default: 0
  min: 0
  max: 100
shock_resist:
  inherit: destruction

both attributes are created in magic successfully, and can be checked/altered with the /mage attribute command, but the values assigned in 'destruction' only take effect for destruction, and not for the attribute that inherits it, 'shock_resist'

I think in general "inherit" is only meaningful when loading configs- it's basically just copying the "destruction" config and then putting "shock_resist" on top.

After that, there is no linkage between the two.

There are some exceptions to this rule, like classes I think- but I'm pretty sure attributes don't really have any lineage like that.

I can leave this open to see how difficult that would be to add, but I think if I did change that it may be the kind of thing that messes with other people's setups if they are using attribute inheritance but not expecting it to work that way.

Ah sorry I may have worded that incorrectly, when I say i'm trying to get 'shock_resist' to inherit from 'destruction', I only mean the copying initial configuration, AKA I'm trying to have shock_resist have the same default, min, and max values, as defined in destruction, but keeping their actual assigned values independent of each other. The issue I was encountering is that the configuration for shock_resist doesn't reflect the configuration of destruction despite inheriting from it, unless attributes can't inherit configurations like wands/spells can?

Oh, I see- yeah I got confused when you said that changes from /mage attribute only affects one but not the other.

So yes I think the config inheritance should work for attributes- it's built into config loading at a pretty low-level, just like the math expressions it should work anywhere.

I will take a look when I can, I could be wrong- but I think it should work.

In this case you're seeing that shock_resist doesn't have the right min/max/default values, correct?

Yep that's correct, and sorry for the confusing wording! 😅 What I meant about changes with /mage attribute is that shock_resist can go above or below the min/max defined in the config destruction, and it doesn't reflect the default value defined in destruction either.