SuperNeon4ik / NoxesiumUtils

Communicate with The Noxesium Mod with ease.
https://modrinth.com/plugin/noxesiumutils
GNU General Public License v3.0
13 stars 3 forks source link

Persistent entity rules #24

Open SuperNeon4ik opened 1 week ago

SuperNeon4ik commented 1 week ago

I would guess most qibs and entity rules are set up once and never changed, so a way to make them persist between reloads and restarts would be a very useful feature.

My ideas are:

This is currently just a mishmash of ideas and I have no clear logic yet. Any suggestions are appreciated!

BlockybombDEV commented 1 week ago

Don't think there is a reason for a non persistent tag since the rules get forgotten anyways. Especially if there is an option to just ignore all of them

Might be bad for servers using a large amount of entities with rules, but you could have a file with an entity's uuid/world+id storing their entity rules. Example:

{"persistentEntities":{
    "UUID": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
    "World": "world",
    "Rules": {
        "QIB_BEHAVIOUR": "Boost",
        "QIB_WIDTH_Z": 2
    }
}}
SuperNeon4ik commented 1 week ago

Don't think there is a reason for a non persistent tag since the rules get forgotten anyways. Especially if there is an option to just ignore all of them

The non persistent tag is only going to be used when persistentEntityRules is true in the config. At least that was the idea in this case. Also what do you mean by "an option to ignore all of them"?

Might be bad for servers using a large amount of entities with rules, but you could have a file with an entity's uuid/world+id storing their entity rules.

This should theoretically be fine i think. I do agree that it should be saved in a readable file, that would make debugging easier, though I would want some other interface made with commands or tags for example, so it's not necessary to open the save-file each time you want to edit the rules.

Do you by any chance have an idea of how you see the persistence done?

BlockybombDEV commented 1 week ago

The non persistent tag is only going to be used when persistentEntityRules is true in the config. At least that was the idea in this case. Also what do you mean by "an option to ignore all of them"?

I've probably interpreted it wrong when you said "ignoring the no persist entities ofc", you probably mean not giving their rules back if they have the tag.

This should theoretically be fine i think. I do agree that it should be saved in a readable file, that would make debugging easier, though I would want some other interface made with commands or tags for example, so it's not necessary to open the save-file each time you want to edit the rules.

You could have a command to set and check the saved rules for an entity. The way I currently do it, I just add a tag to the entity with the rule they're supposed to have like jumpPad which comes with a downside of going through all interaction entities. Don't think it's much of a downside if this happens on server start though unless it can't get to entities that haven't been loaded (has not been a problem for me yet)

I'm not an expert btw just thinking about things that could happen or cause issues