Skip to content

Conversation

@Dubledice
Copy link
Owner

No description provided.

*/
public void setKeyProgress(String key, ResourceType rt, float value) {
if (key == null || key.isEmpty()) return;
var byKey = keyProgress.computeIfAbsent(rt, __ -> new java.util.HashMap<>());

Choose a reason for hiding this comment

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

Better to extract this line into a separate method because it repeats several times during this file and changes all other same occurences
It should be something like

Suggested change
var byKey = keyProgress.computeIfAbsent(rt, __ -> new java.util.HashMap<>());
var byKey = getKeyProgressOrCreate(rt);

* Set the exact cursor value for a specific key/resource.
* If value <= EPS the key entry is removed.
*/
public void setKeyProgress(String key, ResourceType rt, float value) {

Choose a reason for hiding this comment

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

This has no usage, maybe you should remove it?

var unit = Load.Unit(player);
if (unit != null) {
// Iterate only active keys per resource
for (var rt : com.robertx22.mine_and_slash.saveclasses.unit.ResourceType.values()) {

Choose a reason for hiding this comment

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

Use an import instead

Suggested change
for (var rt : com.robertx22.mine_and_slash.saveclasses.unit.ResourceType.values()) {
for (var rt : ResourceType.values()) {

if (procs > 0) {
spec.onProc(sp, procs);
spec.startCooldown(unit, now);
if (spec.resetOnProc()) {

Choose a reason for hiding this comment

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

To match names of other methods

Suggested change
if (spec.resetOnProc()) {
if (spec.dropProgressOnProc()) {

@Dubledice Dubledice requested a review from SaloEater September 5, 2025 12:28
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.

3 participants