forked from StrafesNET/strafe-client
rename best to collector
This commit is contained in:
parent
cead05b08b
commit
53605746d4
14
src/body.rs
14
src/body.rs
@ -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.
|
||||
fn next_instruction(&self) -> Option<TimedInstruction<PhysicsInstruction>> {
|
||||
//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)
|
||||
if self.grounded&&self.jump_trying {
|
||||
//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,
|
||||
instruction:PhysicsInstruction::Jump
|
||||
}));
|
||||
}
|
||||
//check for collision stop instructions with curent contacts
|
||||
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!!)
|
||||
for model in &self.models_cringe_clone {
|
||||
best.collect(self.predict_collision_start(model));
|
||||
collector.collect(self.predict_collision_start(model));
|
||||
}
|
||||
if self.grounded {
|
||||
//walk maintenance
|
||||
best.collect(self.next_walk_instruction());
|
||||
collector.collect(self.next_walk_instruction());
|
||||
}else{
|
||||
//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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user