rename best to collector

This commit is contained in:
Quaternions 2023-09-08 20:12:58 -07:00
parent cead05b08b
commit 53605746d4

View File

@ -236,31 +236,31 @@ impl crate::instruction::InstructionEmitter<PhysicsInstruction> for PhysicsState
//this little next instruction function can cache its return value and invalidate the cached value by watching the State. //this little next instruction function can cache its return value and invalidate the cached value by watching the State.
fn next_instruction(&self) -> Option<TimedInstruction<PhysicsInstruction>> { fn next_instruction(&self) -> Option<TimedInstruction<PhysicsInstruction>> {
//JUST POLLING!!! NO MUTATION //JUST POLLING!!! NO MUTATION
let mut best = crate::instruction::InstructionCollector::new(); let mut collector = crate::instruction::InstructionCollector::new();
//autohop (already pressing spacebar; the signal to begin trying to jump is different) //autohop (already pressing spacebar; the signal to begin trying to jump is different)
if self.grounded&&self.jump_trying { if self.grounded&&self.jump_trying {
//scroll will be implemented with InputInstruction::Jump(true) but it blocks setting self.jump_trying=true //scroll will be implemented with InputInstruction::Jump(true) but it blocks setting self.jump_trying=true
best.collect(Some(TimedInstruction{ collector.collect(Some(TimedInstruction{
time:self.time, time:self.time,
instruction:PhysicsInstruction::Jump instruction:PhysicsInstruction::Jump
})); }));
} }
//check for collision stop instructions with curent contacts //check for collision stop instructions with curent contacts
for collision_data in self.contacts.iter() { for collision_data in self.contacts.iter() {
best.collect(self.predict_collision_end(self.models_cringe_clone.get(collision_data.model as usize).unwrap())); collector.collect(self.predict_collision_end(self.models_cringe_clone.get(collision_data.model as usize).unwrap()));
} }
//check for collision start instructions (against every part in the game with no optimization!!) //check for collision start instructions (against every part in the game with no optimization!!)
for model in &self.models_cringe_clone { for model in &self.models_cringe_clone {
best.collect(self.predict_collision_start(model)); collector.collect(self.predict_collision_start(model));
} }
if self.grounded { if self.grounded {
//walk maintenance //walk maintenance
best.collect(self.next_walk_instruction()); collector.collect(self.next_walk_instruction());
}else{ }else{
//check to see when the next strafe tick is //check to see when the next strafe tick is
best.collect(self.next_strafe_instruction()); collector.collect(self.next_strafe_instruction());
} }
best.instruction() collector.instruction()
} }
} }