diff --git a/ships/corvette01/corvette01.tres b/ships/corvette01/corvette01.tres index 7d36404a..ad399816 100644 --- a/ships/corvette01/corvette01.tres +++ b/ships/corvette01/corvette01.tres @@ -17,4 +17,4 @@ energy_recharge_rate = 5.0 thrust_energy_consumption = 8.0 turning_energy_consumption = 5.0 shield_recharge_rate = 0.0 -weapon_energy_consumption = 20.0 +weapon_energy_consumption = 5.0 diff --git a/ships/ship.gd b/ships/ship.gd index f3e50018..cdf69c48 100644 --- a/ships/ship.gd +++ b/ships/ship.gd @@ -113,6 +113,12 @@ func fire() -> void: var now := Time.get_ticks_msec() if now - self._last_fired_msec < self.ship_def.fire_interval_msec: return + + if self.energy < self.ship_def.weapon_energy_consumption: + return + + self.energy -= self.ship_def.weapon_energy_consumption + self.emit_signal("ship_energy_changed", self) var bullet_instance: RigidBody3D = self.bullet.instantiate() get_parent().add_child(bullet_instance)