Skip to content

Commit

Permalink
Added option to disable retained speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kataiser committed Aug 10, 2023
1 parent 81857ff commit c530e96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions movement sim/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 7 additions & 5 deletions movement sim/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit c530e96

Please sign in to comment.