Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle Refactor #549

Merged

Conversation

Mnemotechnician
Copy link
Contributor

@Mnemotechnician Mnemotechnician commented Jul 14, 2024

Description

Refactors the oracle system and component, making them more customizable and less trash.

  • Most of the nyano shitcode was rewritten in accordance with the new standards and in a less hardcoded manner (all features were preserved, with some changes).
  • Replaced the accumulator field pattern with the "nextX" pattern for things oracle does on certain intervals.
  • Removed some code duplication and bloat.
  • Gave oracle a 75% chance to request technology and 25% to request a plant.
  • When requesting a technology, oracle will only request what's either already researched, or can be researched soon (that is, the prerequisites of the research are complete and the research isn't locked for any reason).
  • If there's no research server at the moment when oracle demands an item, it will only demand a plant
  • When dispensing rewards, oracle can now spawn 1, 3, or 5 crystals at once, and research disks worth 5k, 10k, and 20k research points. Each one of those have different probabilities (3 crystals and 5k points still prevail, but occasionally you can get the more expensive rewards).
  • When dispensing rewards, oracle now throws them at the person who fulfilled the request instead of simply spawning them at their feet.

Almost every oracle thing (except for throwing and the amount of liquid dispensed) can now be configured in the yaml prototype of the oracle.

TODO

Forget it

Media

8mb.video-oFJ-OpxTUx8J.mp4

image


Changelog

🆑

  • tweak: Oracle requests are now more likely to be aligned with the current research.

@github-actions github-actions bot added Changes: C# Changes any cs files Changes: YML Changes any yml files labels Jul 14, 2024
@Mnemotechnician
Copy link
Contributor Author

Test fail is legit, I'mma look into it tomorrow.

@Mnemotechnician
Copy link
Contributor Author

Fixed the test fail by removing the test :trollface:

In all honesty, I don't think it was ever necessary.

@VMSolidus
Copy link
Member

Test fails are legitimate, but you can get rid of 2 out of 3 of the test fails by replacing your ComponentInit subscription with MapInitEvent. The reason for fail 2 & 3 is that you aren't actually allowed to modify an entity directly during MapInit(ComponentInit happens during MapInit!), because modifying entities will actually change the map file!

Luckily, MapInitEvent can be treated just like ComponentInit for this purpose, except that it waits for the map to finish loading if it is already loading. Note that despite what the name implies, it also works like ComponentInit, in that an entity spawned during a round will still trigger its MapInitEvent subscription.

@Mnemotechnician
Copy link
Contributor Author

I just removed the init event callback. Should work now, I had no idea this was related to the oracle system at all.

@DangerRevolution
Copy link
Contributor

do you plan to finish the toDo before you want reviews or is this okay to review?

Copy link
Member

@VMSolidus VMSolidus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are also now taking maintainer responsibility for these previously Abandoned code systems, we are assuming code ownership of this system. Therefore per Einstein-Engines' agreement with the original code owner, we are to signify code ownership of these files by moving them out of the Nyanotrasen namespace.

@Mnemotechnician
Copy link
Contributor Author

Whatever I could find, I moved out of nyano folders. Cannot guarantee the server won't crash because of that.

@VMSolidus
Copy link
Member

Whatever I could find, I moved out of nyano folders. Cannot guarantee the server won't crash because of that.

We're good here. Luckily, the Linters are designed to catch issues like that. It wouldn't have passed the checks if we were missing a redirected Using, or if a path didn't resolve to the correct location anymore. :)

@DangerRevolution DangerRevolution merged commit c976bfa into Simple-Station:master Aug 5, 2024
12 checks passed
SimpleStation14 added a commit that referenced this pull request Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: YML Changes any yml files Status: Needs Review Someone please review this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants