pull out named variables in checkpoint_check
This commit is contained in:
parent
47c9b77b00
commit
3797408bc8
@ -1494,10 +1494,12 @@ fn checkpoint_check(
|
||||
stage_element:&gameplay_modes::StageElement,
|
||||
mode:&gameplay_modes::Mode,
|
||||
)->CheckpointCheckOutcome{
|
||||
if mode_state.get_stage_id()<stage_element.stage_id(){
|
||||
let current_stage_id=mode_state.get_stage_id();
|
||||
let target_stage_id=stage_element.stage_id();
|
||||
if current_stage_id<target_stage_id{
|
||||
//checkpoint check
|
||||
//check if current stage is complete
|
||||
if let Some(current_stage)=mode.get_stage(mode_state.get_stage_id()){
|
||||
if let Some(current_stage)=mode.get_stage(current_stage_id){
|
||||
if !current_stage.is_complete(mode_state.ordered_checkpoint_count(),mode_state.unordered_checkpoint_count()){
|
||||
return CheckpointCheckOutcome{
|
||||
set_stage:None,
|
||||
@ -1506,7 +1508,7 @@ fn checkpoint_check(
|
||||
}
|
||||
}
|
||||
//check if all between stages have no checkpoints required to pass them
|
||||
for stage_id in mode_state.get_stage_id().get()+1..stage_element.stage_id().get(){
|
||||
for stage_id in current_stage_id.get()+1..target_stage_id.get(){
|
||||
let stage_id=StageId::new(stage_id);
|
||||
//check if none of the between stages has checkpoints, if they do teleport back to that stage
|
||||
match mode.get_stage(stage_id){
|
||||
@ -1525,13 +1527,13 @@ fn checkpoint_check(
|
||||
};
|
||||
//notably you do not get teleported for touching ordered checkpoints in the wrong order within the same stage.
|
||||
return CheckpointCheckOutcome{
|
||||
set_stage:Some(stage_element.stage_id()),
|
||||
set_stage:Some(target_stage_id),
|
||||
teleport_to_model:None,
|
||||
};
|
||||
}else if stage_element.force(){
|
||||
//forced stage_element will set the stage_id even if the stage has already been passed
|
||||
return CheckpointCheckOutcome{
|
||||
set_stage:Some(stage_element.stage_id()),
|
||||
set_stage:Some(target_stage_id),
|
||||
teleport_to_model:None,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user