fix access

This commit is contained in:
Evan Pratten 2021-04-24 16:39:36 -04:00
parent 8c142d2711
commit 43eab974b0
2 changed files with 4 additions and 4 deletions

View File

@ -12,8 +12,8 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct StunGun { pub struct StunGun {
range: f32, pub range: f32,
duration: f64 pub duration: f64
} }
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
@ -24,5 +24,5 @@ pub struct Flashlight;
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct Flippers { pub struct Flippers {
speed_increase: f32 pub speed_increase: f32
} }

View File

@ -79,7 +79,7 @@ impl Player {
/// Try to attack with the stun gun /// Try to attack with the stun gun
pub fn begin_attack(&mut self) { pub fn begin_attack(&mut self) {
if true || self.inventory.stun_gun.is_some() && self.stun_timer == 0.0 { if true || self.inventory.stun_gun.is_some() && self.stun_timer == 0.0 {
self.attacking_timer = STUN_ATTACK_TIME; self.attacking_timer = self.inventory.stun_gun.as_ref().unwrap().duration;
} }
} }