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

Update regen to depend on Health module #12

Merged
merged 4 commits into from
Aug 12, 2019
Merged

Conversation

e-aakash
Copy link
Member

@e-aakash e-aakash commented Jun 26, 2019

Removes regeneration authority system, as new regen has a scheduler to handle regen.

How to test:

  1. Checkout PR Health Overhaul MovingBlocks/Terasology#3677 branch
  2. Checkout PR Update regen potion handling Potions#54 branch.
  3. Start a new game with Potions and Core (which will add Health).
  4. Console command setRegenRate 0, so that base regeneration does not affect the potion
  5. Console command damage 50 to cause damage to player.
  6. Test regen potion: console command potions:regenpotion, and activate it, which regenerates player at 3 hp/s for 10 seconds

Copy link
Member

@syntaxi syntaxi left a comment

Choose a reason for hiding this comment

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

LGTM. Just a deletion/move of where the regen is managed.

I see that the RegenSystem you deleted used a RegenerationComponent. Do you intend to delete that as well?

@@ -53,6 +54,7 @@ public RegenerationAlterationEffect(Context context) {
* @param magnitude The magnitude of the regen effect.
* @param duration The duration of the regen effect.
*/
@SuppressWarnings("CheckStyle")
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this shouldn't be included. We usually want to fix rather than suppress checkstyle issues

Copy link
Member Author

Choose a reason for hiding this comment

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

This was unintentional, I thought suppressing some issues will not show up in code. I will remove this in next commit.

* @param magnitude The magnitude of the regen effect.
* @param duration The duration of the regen effect.
*/
@Override
public void applyEffect(EntityRef instigator, EntityRef entity, String id, float magnitude, long duration) {
applyEffect(instigator, entity, magnitude, duration);
//applyEffect(instigator, entity, magnitude, duration);
entity.send(new ActivateRegenEvent(id, (int) magnitude, ((float) duration) / 1000));
Copy link
Member

Choose a reason for hiding this comment

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

Slight nitpick here. Do we want to round down, round up or use natural rounding?

Ie, if we use this method twice with 0.3 & 0.7 what should the event send?
Down →0 & 0 (this is the current method)
Natural →0 & 1
Up →1 & 1

I can see legitimate arguments for all of these. I would personally go for natural but it's up to you which one you pick. Just make sure you've considered the options.

Additionally, we can avoid sending an ActivateRegenEvent when the magnitude is 0 because it just won't do anything correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just realized that the RegenComponent is saving the regen value in floats. But the event does not take floats. Calls for an update in the event, which would resolve this issue, leaving it for regen scheduler to handle

@syntaxi syntaxi marked this pull request as ready for review August 12, 2019 17:33
@syntaxi syntaxi merged commit c114a65 into Terasology:master Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants