group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Projectile.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "WeaponState.hpp"
7#include "ecs/physics/SurfaceType.hpp" // SurfaceType moved here in Phase 3; this re-include preserves existing call sites.
8
9#include <cstdint>
10#include <entt/entt.hpp>
11#include <glm/vec3.hpp>
12
18{
20 float damage = 0.0f;
21 entt::entity owner = entt::null;
22 bool explosive = false;
23 float currentLifeTime = 0.0f;
24
25 // Grenade-specific extensions. Defaults preserve rocket-style behavior.
26 float fuseTimer = -1.0f;
27 float bounceRestitution = 0.0f;
28 bool sticky = false;
29
30 // Stick state (sticky grenades). Once `stuck`, the projectile is frozen in
31 // place and its fuse runs to detonation — no gravity, no further collision.
32 // If `stuckTo` is a live player, the projectile also rides that player
33 // (pos = host pos + stuckOffset) and detonation guarantees a kill on the
34 // host. A null `stuckTo` while `stuck` means it is glued to static world
35 // geometry (wall / ceiling / floor).
36 bool stuck = false;
37 entt::entity stuckTo = entt::null;
38 glm::vec3 stuckOffset{0.0f};
39
40 glm::vec3 tint = {1.0f, 1.0f, 1.0f};
41};
Surface-material classification shared across collision, raycasts, VFX, SFX, and damage falloff.
Weapon state component for armed entities.
WeaponType
Weapon type — determines tracer style, damage, sound, and impact effects.
Definition WeaponState.hpp:12
@ Rifle
Fast hitscan/projectile (R301-style capsule tracer).
Definition WeaponState.hpp:13
Component attached to projectile entities.
Definition Projectile.hpp:18
glm::vec3 tint
Render tint multiplier (cosmetic, client-side).
Definition Projectile.hpp:40
WeaponType type
Weapon that spawned this projectile.
Definition Projectile.hpp:19
float fuseTimer
Countdown; <0 means no fuse (impact-only).
Definition Projectile.hpp:26
glm::vec3 stuckOffset
Offset from the host's origin at stick time.
Definition Projectile.hpp:38
bool sticky
If true, sets vel=0 on first surface hit and starts fuse.
Definition Projectile.hpp:28
float currentLifeTime
Seconds since spawn (destroyed when exceeding max).
Definition Projectile.hpp:23
bool explosive
True if the projectile detonates on impact.
Definition Projectile.hpp:22
entt::entity owner
Entity that fired this projectile.
Definition Projectile.hpp:21
float damage
Damage dealt on hit.
Definition Projectile.hpp:20
entt::entity stuckTo
Player this grenade is stuck to, or null (world).
Definition Projectile.hpp:37
float bounceRestitution
0 = no bounce. CollisionSystem reflects velocity * this on hit.
Definition Projectile.hpp:27
bool stuck
True once attached to a surface or player.
Definition Projectile.hpp:36