Revolutionary-Games / Thrive

The main repository for the development of the evolution game Thrive.
https://revolutionarygamesstudio.com/
Other
2.81k stars 501 forks source link

When no organelle upgrades are done there should be no change action created #4091

Open hhyyrylainen opened 1 year ago

hhyyrylainen commented 1 year ago

to avoid creating pointless actions in the action history

needs some interface or something for the custom data to also allow comparing itself

Oliveriver commented 1 year ago

I'm still getting actions created with blank modifications unfortunately. If I place an organelle, modify it, make no changes and click ok, then I need to press undo twice to delete the organelle.

The exceptions are the pilus and cilia, which have actual upgrades as opposed to modifications. They do appear to be working correctly. But unless I'm missing something I think the other organelles are still bugged.

athariqk commented 1 year ago

Can confirm with Lysosome and Chemoreceptor.

hhyyrylainen commented 1 year ago

Regarding the blank modifications, it was discussed how to compare null to the default options: https://github.com/Revolutionary-Games/Thrive/pull/4463#discussion_r1321060419 and well the code was written so that the equals method doesn't compare null equally to the default value. This results in "blank" actions being created (they actually modify the data from null to a default valued instance). It might be very difficult to improve the GUI side (where I think this will need to go) to skip creating actions when nothing has been changed, or maybe emitting a change to null when doing a modify to default options (this might be the easiest way). Pinging @Kashnox just in case they are not watching this issue.

Kashnox commented 1 year ago

Yeah, we originally decided it was acceptable to add something to the history the first time you open the Lysosome or Chemoreceptor modification menus, but I can take another look later in the week to see if there's a simple solution I didn't see before now that I know my way around the editor a lot better.