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).
bool canAcceptType (WeaponSlot slot, WeaponType type)
 Slot/type compatibility predicate for pickups.
WeaponType nextGrenadeType (WeaponType type)
 Cycle to the next grenade type. HE → Molotov → Impulse → HE.
const GrenadeConfiggetGrenadeConfig (WeaponType type)
 Returns the config for a grenade WeaponType.

Detailed Description

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

Single source of truth for grenade tuning. Each WeaponType in {HEGrenade, Molotov, Impulse} 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, Impulse).

FireField 

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

Function Documentation

◆ canAcceptType()

bool canAcceptType ( WeaponSlot slot,
WeaponType type )
inline

Slot/type compatibility predicate for pickups.

The grenade slot only accepts grenade types; non-grenade slots only accept non-grenade types. WeaponSpawnerSystem calls this before assigning any picked-up gun to a slot, so a rifle pickup never overwrites the player's grenade and a hypothetical world-spawned grenade never overwrites a real gun.

Note
XNOR works for the current 2-family partition (grenade vs everything else). Adding a 3rd family (e.g. melee) will require a slot-keyed table — see WeaponSlot doc.
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:

◆ isGrenadeType()

bool isGrenadeType ( WeaponType type)
inline

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

Here is the caller graph for this function:

◆ nextGrenadeType()

WeaponType nextGrenadeType ( WeaponType type)
inline

Cycle to the next grenade type. HE → Molotov → Impulse → HE.

Here is the caller graph for this function: