group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
GrenadeConfig.hpp File Reference

Per-grenade-type tuning data (throw, flight, detonation). More...

#include "WeaponState.hpp"
#include <array>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <glm/vec3.hpp>
Include dependency graph for GrenadeConfig.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GrenadeConfig
 All tuning for one grenade type. More...

Enumerations

enum class  GrenadeDetonationKind : uint8_t { Explosion , FireField }
 How a grenade detonates. More...

Functions

bool isGrenadeType (WeaponType type)
 True if type is a grenade (covered by getGrenadeConfig).
std::size_t grenadeTypeIndex (WeaponType type)
WeaponType grenadeTypeAt (std::size_t index)
constexpr const char * grenadeTypeName (WeaponType type)
bool canAcceptType (WeaponSlot, WeaponType type)
 Weapon-slot type compatibility predicate for pickup guards.
const GrenadeConfiggetGrenadeConfig (WeaponType type)
 Returns the config for a grenade WeaponType.

Variables

constexpr float kGrenadeThrowAnimTime = 0.5f
 Duration of the throw "wind-up": the gun dips (client viewmodel) and firing is locked out for this long after a throw.
constexpr std::array< WeaponType, 3 > kGrenadeTypes
constexpr std::size_t kGrenadeTypeCount = kGrenadeTypes.size()

Detailed Description

Per-grenade-type tuning data (throw, flight, detonation).

Single source of truth for grenade tuning. Each WeaponType in {HEGrenade, Molotov, Sticky} maps to one row. Add a new grenade by:

  1. appending an entry to WeaponType
  2. appending a row to k_grenadeConfigs below.

Enumeration Type Documentation

◆ GrenadeDetonationKind

enum class GrenadeDetonationKind : uint8_t
strong

How a grenade detonates.

Enumerator
Explosion 

queueExplosion() with damage + knockback (HE, Sticky).

FireField 

Spawn a FireField entity for damage-over-time (Molotov).

Function Documentation

◆ canAcceptType()

bool canAcceptType ( WeaponSlot ,
WeaponType type )
inline

Weapon-slot type compatibility predicate for pickup guards.

Grenades are equipped through GrenadeState, not WeaponState, so weapon slots reject grenade types.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGrenadeConfig()

const GrenadeConfig & getGrenadeConfig ( WeaponType type)
inline

Returns the config for a grenade WeaponType.

Note
Behavior is undefined if type is not a grenade type.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ grenadeTypeAt()

WeaponType grenadeTypeAt ( std::size_t index)
inline
Here is the caller graph for this function:

◆ grenadeTypeIndex()

std::size_t grenadeTypeIndex ( WeaponType type)
inline
Here is the caller graph for this function:

◆ grenadeTypeName()

const char * grenadeTypeName ( WeaponType type)
inlineconstexpr

◆ isGrenadeType()

bool isGrenadeType ( WeaponType type)
inline

True if type is a grenade (covered by getGrenadeConfig).

Here is the caller graph for this function:

Variable Documentation

◆ kGrenadeThrowAnimTime

float kGrenadeThrowAnimTime = 0.5f
inlineconstexpr

Duration of the throw "wind-up": the gun dips (client viewmodel) and firing is locked out for this long after a throw.

Shorter than throwCooldown.

◆ kGrenadeTypeCount

std::size_t kGrenadeTypeCount = kGrenadeTypes.size()
inlineconstexpr

◆ kGrenadeTypes

std::array<WeaponType, 3> kGrenadeTypes
inlineconstexpr
Initial value:
= {
}
@ Sticky
Sticks to first surface or player; guaranteed kill when stuck to a player.
Definition WeaponState.hpp:20
@ HEGrenade
Bouncy grenade with 3s fuse, lethal explosion + big knockback.
Definition WeaponState.hpp:18
@ Molotov
Impact-detonate, leaves a fire field (damage over time).
Definition WeaponState.hpp:19