mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Updated comments in states code.
This commit is contained in:
parent
7828112486
commit
0961f00c7c
@ -82,7 +82,10 @@ impl CharacterBehavior for Data {
|
||||
crit_chance,
|
||||
crit_mult,
|
||||
);
|
||||
// Shoots all projectiles simultaneously
|
||||
for i in 0..self.static_data.num_projectiles {
|
||||
// Adds a slight spread to the projectiles. First projectile has no spread,
|
||||
// and spread increases linearly with number of projectiles created.
|
||||
let dir = Dir::from_unnormalized(data.inputs.look_dir.map(|x| {
|
||||
let offset = (2.0 * thread_rng().gen::<f32>() - 1.0)
|
||||
* self.static_data.projectile_spread
|
||||
@ -90,6 +93,7 @@ impl CharacterBehavior for Data {
|
||||
x + offset
|
||||
}))
|
||||
.unwrap_or(data.inputs.look_dir);
|
||||
// Tells server to create and shoot the projectile
|
||||
update.server_events.push_front(ServerEvent::Shoot {
|
||||
entity: data.entity,
|
||||
dir,
|
||||
|
@ -100,7 +100,6 @@ impl CharacterBehavior for Data {
|
||||
);
|
||||
update.server_events.push_front(ServerEvent::Shoot {
|
||||
entity: data.entity,
|
||||
// Provides slight variation to projectile direction
|
||||
dir: data.inputs.look_dir,
|
||||
body: self.static_data.projectile_body,
|
||||
projectile,
|
||||
@ -109,6 +108,7 @@ impl CharacterBehavior for Data {
|
||||
object: None,
|
||||
});
|
||||
|
||||
// Removes energy from character when arrow is fired
|
||||
update.server_events.push_front(ServerEvent::EnergyChange {
|
||||
entity: data.entity,
|
||||
change: EnergyChange {
|
||||
@ -117,6 +117,7 @@ impl CharacterBehavior for Data {
|
||||
},
|
||||
});
|
||||
|
||||
// Sets new speed of shoot. Scales based off of the number of projectiles fired.
|
||||
let new_speed = 1.0
|
||||
+ self.projectiles_fired as f32
|
||||
/ (self.static_data.half_speed_at as f32
|
||||
|
Loading…
Reference in New Issue
Block a user