Skip to content

Commit

Permalink
Merge pull request #168 from SantiSev/fix-reset-ammo
Browse files Browse the repository at this point in the history
Fix reset ammo common weapon
  • Loading branch information
maxogod authored Jun 25, 2024
2 parents 42beff7 + 40c5cb1 commit 74ca6d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enemy:
damage: 25
speed: 5
falling_speed: 10
respawn_time: 200 # unit is in game loops
respawn_time: 500 # unit is in game loops
movement_range: 60

map_editor: # Values should be multiples of 32
Expand Down
2 changes: 2 additions & 0 deletions server/game_logic/weapons/guns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ DefaultGun::DefaultGun(uint8_t weapon_id, Player& player_owner, CollisionManager
config->bullet_base_dmg * 2, config->bullet_base_shoot_rate,
config->bullet_base_speed, config) {}

void DefaultGun::reset_ammo() { ammo = 99; }

void DefaultGun::shoot() {

if (!can_shoot) {
Expand Down
1 change: 1 addition & 0 deletions server/game_logic/weapons/guns.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class DefaultGun: public Weapon {
DefaultGun(uint8_t weapon_id, Player& player_owner, CollisionManager& collision_manager,
const std::shared_ptr<Configuration>& config);
void shoot() override;
void reset_ammo() override;
};

#endif // GUNS_H
2 changes: 1 addition & 1 deletion server/game_logic/weapons/weapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Weapon {
void update_shoot_rate();
virtual void shoot();
void add_ammo(int added_ammo);
void reset_ammo();
virtual void reset_ammo();
void change_infinite_ammo();

virtual ~Weapon();
Expand Down

0 comments on commit 74ca6d7

Please sign in to comment.