diff --git a/movement sim/config.yaml b/movement sim/config.yaml index 1370f92..68246a9 100644 --- a/movement sim/config.yaml +++ b/movement sim/config.yaml @@ -17,6 +17,7 @@ Holding: # X axis on_ground: false holding: false +retained: true # whether to use retained speed if present # Y axis jump_timer: 0 # 11 if just jumped, 14 if wallbounced. jump speed will be based on current speed auto_jump: false # forced half peak gravity, from dashes, springs, etc. diff --git a/movement sim/sim.py b/movement sim/sim.py index c3ac7aa..b6a3af1 100644 --- a/movement sim/sim.py +++ b/movement sim/sim.py @@ -44,6 +44,7 @@ def __init__(self): self.on_ground: bool = bool(cfg_dict['on_ground']) self.ram_check: bool = bool(cfg_dict['ram_check']) self.append_keys: str = str(cfg_dict['append_keys']) + self.retained: bool = bool(cfg_dict['retained']) if self.axis not in ('x', 'y'): print("Axis must be x or y, exiting") @@ -72,11 +73,12 @@ def __init__(self): self.jump_timer = max(int(init_state[init_state.index('JumpTimer:') + 1]) - 1, 0) if 'JumpTimer:' in cfg_dict['init_state'] else self.jump_timer self.holding = 'Holding: Celeste.Holdable' in init_state if 'Holding:' in init_state else self.holding - for i in range(len(init_state)): - if init_state[i].startswith('Retained('): - self.speed_init = float(init_state[i + 1]) - print(f"Assuming retained speed ({self.speed_init:.3f}) applies next frame") - break + if self.axis == 'x' and self.retained: + for i in range(len(init_state)): + if init_state[i].startswith('Retained('): + self.speed_init = float(init_state[i + 1]) + print(f"Assuming retained speed ({self.speed_init:.3f}) applies next frame") + break def main():