-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commenting the main flows #156
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,6 +766,7 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
let team = ship_data.team; | ||
let gun = { | ||
let gun = &mut ship_data.guns[index as usize]; | ||
// Exit if gun is still reloading | ||
if gun.reload_ticks_remaining > 0 { | ||
return; | ||
} | ||
|
@@ -932,13 +933,10 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
} | ||
|
||
pub fn tick(&mut self) { | ||
// Weapons. | ||
// Weapons | ||
// Handle reload timers | ||
{ | ||
let ship_data = self | ||
.simulation | ||
.ship_data | ||
.get_mut(self.handle.index()) | ||
.unwrap(); | ||
Comment on lines
-937
to
-941
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line was the same as |
||
let ship_data = self.data_mut(); | ||
for gun in ship_data.guns.iter_mut() { | ||
if gun.reload_ticks_remaining > 0 { | ||
gun.reload_ticks_remaining -= 1; | ||
|
@@ -952,7 +950,8 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
} | ||
} | ||
|
||
// Acceleration. | ||
// Movement | ||
// Apply boosts, consume fuel | ||
{ | ||
let mut acceleration = self.data().acceleration; | ||
if self.readonly().is_ability_active(Ability::Boost) { | ||
|
@@ -976,7 +975,7 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
self.data_mut().acceleration = vector![0.0, 0.0]; | ||
} | ||
|
||
// Torque. | ||
// Torque | ||
{ | ||
let inertia_sqrt = 1.0 | ||
/ self | ||
|
@@ -991,6 +990,7 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
} | ||
|
||
// TTL | ||
// Destroy ship if it exceeds TTL | ||
{ | ||
if let Some(ttl) = self.data_mut().ttl { | ||
self.data_mut().ttl = Some(ttl - 1); | ||
|
@@ -1000,7 +1000,8 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
} | ||
} | ||
|
||
// Special abilities. | ||
// Special abilities | ||
// Handle reload and remaining time | ||
{ | ||
for ship_ability in self.data_mut().abilities.iter_mut() { | ||
ship_ability.active_time_remaining = | ||
|
@@ -1010,7 +1011,8 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
} | ||
} | ||
|
||
// Destruction. | ||
// Destruction | ||
// If a ship has been destroyed, remove it from the simulation | ||
if self.data().destroyed { | ||
if let Some(team_ctrl) = self.simulation.get_team_controller(self.data().team) { | ||
team_ctrl.borrow_mut().remove_ship(self.handle); | ||
|
@@ -1022,7 +1024,7 @@ impl<'a: 'b, 'b> ShipAccessorMut<'a> { | |
&mut self.simulation.colliders, | ||
&mut self.simulation.impulse_joints, | ||
&mut self.simulation.multibody_joints, | ||
/*remove_attached_colliders=*/ true, | ||
true, | ||
); | ||
self.simulation | ||
.ship_data | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having a little trouble parsing this when I was looking at it. It was unclear to me why mutations were being done inside the constructor for the team variable, so I restructured the code to make it a little easier to read.