dsisco11 / SR_Plugin_Loader

A plugin loader for SlimeRancher
Apache License 2.0
2 stars 1 forks source link

Player upgrades locked down #7

Closed dylanrenwick closed 8 years ago

dylanrenwick commented 8 years ago

This is a long shot, and frankly I'm not sure there's anything you can do about this issue, but I've found that player upgrades are managed via an enum in the PlayerState class (and applied by passing a value of this enum to the AddUpgrade method), and this seems to be the only way to edit the Player's core stats (Max Health, max energy etc etc).

However, as this enum is in the PlayerState class, there's no way to add additional values to it, and thus no way to add additional max energy/max health upgrades.

Again, I'm unsure whether this is simply out of your hands, but would it be possible for you to look into a way to fix this?

dsisco11 commented 8 years ago

I have been thinking of how I could add a system to allow plugin makers to add their own custom upgrades because of this reason exactly. We can't do anything with SlimeRancher's enum based system, but we can tack-in a custom system that uses string values and operates alongside the native upgrades system using my event hooks. I just haven't had time to do it as of yet.

I might be able to whip up some basic implementation tonight or something, now that there is interest in it.

dylanrenwick commented 8 years ago

That was my idea, the issue I've found is actually modifying player values such as Max Energy and Max Health. They seem to be calculated at runtime based on the active upgrades, and modifying "defaultMaxEnergy" has no effect

dsisco11 commented 8 years ago

The proposed system would alter those stats in https://github.com/dsisco11/SR_Plugin_Loader/wiki/Events-List#player_applyupgrade

The PlayerState class has two variables named maxHealth and maxEnergy but they are private by default. Fortunately I programmed my installer such that I could make it force those to public variables instead, which I will do once the system starts getting underway. I'll whip up some basic structures/classes for all the data a custom upgrade would need to be given now.

dylanrenwick commented 8 years ago

Ah nice! I look forward to it.

dsisco11 commented 8 years ago

I got carried away and fully implemented a system for making custom player upgrades. Plot upgrades aren't fully implemented yet but the basic structure for them is there. https://github.com/dsisco11/SR_Plugin_Loader/wiki/Custom-Upgrades