-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add Run Energy depleting/restoring #423
base: kotlin-experiments
Are you sure you want to change the base?
Changes from all commits
75f4d23
5975c66
6505c22
4ab38e8
ec165b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package org.apollo.game.sync.task; | ||
|
||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.apollo.game.message.impl.ClearRegionMessage; | ||
import org.apollo.game.message.impl.GroupedRegionUpdateMessage; | ||
import org.apollo.game.message.impl.RegionChangeMessage; | ||
import org.apollo.game.message.impl.RegionUpdateMessage; | ||
import org.apollo.game.model.Direction; | ||
import org.apollo.game.model.Position; | ||
import org.apollo.game.model.area.Region; | ||
import org.apollo.game.model.area.RegionCoordinates; | ||
import org.apollo.game.model.area.RegionRepository; | ||
import org.apollo.game.model.entity.Player; | ||
import org.apollo.game.model.entity.Skill; | ||
|
||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* A {@link SynchronizationTask} which does pre-synchronization work for the specified {@link Player}. | ||
|
@@ -58,6 +60,15 @@ public void run() { | |
Position old = player.getPosition(); | ||
player.getWalkingQueue().pulse(); | ||
|
||
if (player.getSecondDirection() != Direction.NONE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't right. We should only decrement the run energy when the player actually moves (see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't fond of the condition, but it seemed to be the best fitting choice for what needed to be done. Sorry if I'm wrong here and just wasting your time, but I believe the direction is only set if the collision map allows the movement (see https://github.com/apollo-rsps/apollo/blob/kotlin-experiments/game/src/main/java/org/apollo/game/model/entity/WalkingQueue.java#L156). Also, am I wrong to assume that if I use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I need to re-look at the assignment of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @garyttierney any update on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code is fine as is, and what we expect. That's the only assignment of |
||
// TODO: implement weight depending on carried and worn items. | ||
double weight = 0.0; | ||
player.decrementRunEnergy(weight); | ||
} else { | ||
int agilityLevel = player.getSkillSet().getCurrentLevel(Skill.AGILITY); | ||
player.incrementRunEnergy(agilityLevel); | ||
} | ||
|
||
boolean local = true; | ||
|
||
if (player.isTeleporting()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Major- any thoughts on this being in core? Seems like it might be the responsibility of a plugin, but I'm not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think core is correct