fix(D-01/E): padlock resistance double-count + knife progress persist (review)
BUG-001: PacketV2StruggleStart only adds padlock resistance bonus on first session (when resistance >= base). Interrupted sessions that persisted combined resistance no longer re-add the bonus, preventing infinite resistance inflation. BUG-002: PacketV2LockToggle UNLOCK clears knifeCutProgress and accessoryStruggleResistance NBT keys, preventing partial knife-cut progress from persisting across lock/unlock cycles.
This commit is contained in:
@@ -149,6 +149,10 @@ public class PacketV2LockToggle {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear partial knife-cut progress and stale struggle resistance on unlock
|
||||||
|
com.tiedup.remake.util.ItemNBTHelper.remove(stack, "knifeCutProgress");
|
||||||
|
com.tiedup.remake.util.ItemNBTHelper.remove(stack, "accessoryStruggleResistance");
|
||||||
|
|
||||||
TiedUpMod.LOGGER.debug(
|
TiedUpMod.LOGGER.debug(
|
||||||
"[V2LockToggle] Unlocked region {} on entity {}",
|
"[V2LockToggle] Unlocked region {} on entity {}",
|
||||||
region.name(),
|
region.name(),
|
||||||
|
|||||||
@@ -84,7 +84,21 @@ public class PacketV2StruggleStart {
|
|||||||
if (stack.getItem() instanceof ILockable lockable) {
|
if (stack.getItem() instanceof ILockable lockable) {
|
||||||
isLocked = lockable.isLocked(stack);
|
isLocked = lockable.isLocked(stack);
|
||||||
if (isLocked) {
|
if (isLocked) {
|
||||||
resistance += com.tiedup.remake.core.SettingsAccessor.getPadlockResistance(null);
|
// Only add padlock bonus on FIRST session (fresh resistance = base).
|
||||||
|
// If resistance was already decremented and persisted from a prior
|
||||||
|
// interrupted session, the padlock bonus is already baked in.
|
||||||
|
int baseResistance = resistance; // getCurrentResistance returns base if no NBT
|
||||||
|
com.tiedup.remake.v2.bondage.component.ResistanceComponent comp =
|
||||||
|
com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem.getComponent(
|
||||||
|
stack, com.tiedup.remake.v2.bondage.component.ComponentType.RESISTANCE,
|
||||||
|
com.tiedup.remake.v2.bondage.component.ResistanceComponent.class);
|
||||||
|
if (comp != null) {
|
||||||
|
baseResistance = comp.getBaseResistance();
|
||||||
|
}
|
||||||
|
if (resistance >= baseResistance) {
|
||||||
|
// Fresh or fully restored — add padlock bonus
|
||||||
|
resistance += com.tiedup.remake.core.SettingsAccessor.getPadlockResistance(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user