Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
ice.qc File Reference
#include "ice.qh"
Include dependency graph for ice.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void nade_ice_boom (entity this)
void nade_ice_freeze (entity freezefield, entity frost_target, float freezetime)
void nade_ice_think (entity this)
bool nade_ice_think_cond (entity e)

Variables

float nade_current_freeze_time

Function Documentation

◆ nade_ice_boom()

void nade_ice_boom ( entity this)

Definition at line 81 of file ice.qc.

82{
83 entity fountain = new(nade_ice_fountain);
84 fountain.owner = this.owner;
85 fountain.realowner = this.realowner;
86 fountain.origin = this.origin;
87 fountain.flags = FL_PROJECTILE;
88 IL_PUSH(g_projectiles, fountain);
89 setorigin(fountain, fountain.origin);
90 setthink(fountain, nade_ice_think);
91 fountain.nextthink = time;
92 fountain.pushltime = fountain.wait = fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
93 fountain.team = this.team;
94 set_movetype(fountain, MOVETYPE_TOSS);
95 fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
96 fountain.bot_dodge = false;
97 setsize(fountain, '-16 -16 -16', '16 16 16');
98 fountain.nade_special_time = time + 0.3;
99 fountain.angles = this.angles;
100
102 {
103 setmodel(fountain, MDL_PROJECTILE_GRENADE);
104 entity timer = new(nade_timer);
105 setmodel(timer, MDL_NADE_TIMER);
106 setattachment(timer, fountain, "");
107 timer.colormap = this.colormap;
108 timer.glowmod = this.glowmod;
110 timer.nextthink = time;
111 timer.wait = fountain.wait;
112 timer.nade_lifetime = this.nade_lifetime;
113 timer.owner = fountain;
114 timer.skin = 10;
115 }
116 else
117 setmodel(fountain, MDL_Null);
118}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity owner
Definition main.qh:87
int team
Definition main.qh:188
#define setmodel(this, m)
Definition model.qh:26
const int FL_PROJECTILE
Definition constants.qh:77
float time
float colormap
vector origin
vector glowmod
ent angles
Definition ent_cs.qc:146
float timer
Definition hud.qh:125
void nade_ice_think(entity this)
Definition ice.qc:21
bool autocvar_g_nades_ice_explode
Definition ice.qh:8
float autocvar_g_nades_ice_freeze_time
Definition ice.qh:7
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_TOSS
Definition movetypes.qh:139
#define setthink(e, f)
IntrusiveList g_projectiles
Definition common.qh:70
void nade_timer_think(entity this)
Definition sv_nades.qc:28
float nade_lifetime
Definition sv_nades.qh:45
entity realowner

References angles, autocvar_g_nades_ice_explode, autocvar_g_nades_ice_freeze_time, colormap, entity(), FL_PROJECTILE, g_projectiles, glowmod, IL_PUSH(), MOVETYPE_TOSS, nade_ice_think(), nade_lifetime, nade_timer_think(), origin, owner, realowner, set_movetype(), setmodel, setthink, team, time, and timer.

Referenced by nade_boom().

◆ nade_ice_freeze()

void nade_ice_freeze ( entity freezefield,
entity frost_target,
float freezetime )

Definition at line 4 of file ice.qc.

5{
6 Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
7 StatusEffects_apply(STATUSEFFECT_Frozen, frost_target, time + freezetime, 0);
8
9 //Drop_Special_Items(frost_target);
10}
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:155
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)

References entity(), Send_Effect(), StatusEffects_apply(), and time.

Referenced by nade_ice_think().

◆ nade_ice_think()

void nade_ice_think ( entity this)

Definition at line 21 of file ice.qc.

22{
24 {
25 delete(this);
26 return;
27 }
28
29 if (time >= this.ltime)
30 {
32 {
33 vector expcol_min = nades_PlayerColor(this.realowner, false);
34 vector expcol_max = nades_PlayerColor(this.realowner, true);
35 Send_Effect_Core(EFFECT_NADE_EXPLODE, this.origin + '0 0 1', '0 0 0', 1, expcol_min, expcol_max, -1, -1, -1, NULL);
36 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
37
38 nade_normal_boom(this);
39 }
40 delete(this);
41 return;
42 }
43
44 this.nextthink = time + 0.1;
45
46 // gaussian
47 float randomr = random();
48 randomr = exp(-5 * randomr * randomr) * autocvar_g_nades_ice_radius;
49 float randomw = random() * (2 * M_PI);
50 vector randomp;
51 randomp.x = randomr * cos(randomw);
52 randomp.y = randomr * sin(randomw);
53 randomp.z = 1;
54 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, this.origin + randomp, '0 0 0', 1);
55
56 if (time >= this.nade_special_time)
57 {
58 this.nade_special_time = time + 5/16; // 0.3125
59
60 Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
61 Send_Effect(EFFECT_ICEFIELD, this.origin, '0 0 0', 1);
62 }
63
67 for (; head; head = head.chain)
68 {
70 {
71 case 0: break; // affect everyone
72 default:
73 case 2: if (SAME_TEAM(head, this.realowner)) continue; // don't affect teammates
74 // fall through (check case 1 condition too)
75 case 1: if (head == this.realowner) continue; // don't affect the player who threw the nade
76 }
78 }
79}
float ltime
Definition net.qh:10
float nextthink
void Send_Effect_Core(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)
Definition all.qc:74
void nade_ice_freeze(entity freezefield, entity frost_target, float freezetime)
Definition ice.qc:4
bool nade_ice_think_cond(entity e)
Definition ice.qc:13
float nade_current_freeze_time
Definition ice.qc:12
float autocvar_g_nades_ice_radius
Definition ice.qh:10
bool autocvar_g_nades_ice_teamcheck
Definition ice.qh:9
entity WarpZone_SearchInRadius(vector org, float rad, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
Definition common.qc:680
noref entity WarpZone_SearchInRadius_otherent
Free to use in the callback.
Definition common.qh:71
#define MOVE_NOTHING
Definition common.qh:35
float exp(float e)
Definition mathlib.qc:70
#define M_PI
pi
Definition mathlib.qh:114
float cos(float f)
float random(void)
float sin(float f)
void nade_normal_boom(entity this)
Definition normal.qc:4
#define NULL
Definition post.qh:14
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
vector
Definition self.qh:96
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
vector nades_PlayerColor(entity this, bool isPants)
Definition sv_nades.qc:14
float nade_special_time
Definition sv_nades.qh:47
#define SAME_TEAM(a, b)
Definition teams.qh:241

References ATTEN_NORM, autocvar_g_nades_ice_explode, autocvar_g_nades_ice_radius, autocvar_g_nades_ice_teamcheck, CH_SHOTS, cos(), entity(), exp(), ltime, M_PI, MOVE_NOTHING, nade_current_freeze_time, nade_ice_freeze(), nade_ice_think_cond(), nade_normal_boom(), nade_special_time, nades_PlayerColor(), nextthink, NULL, origin, random(), realowner, round_handler_IsActive, round_handler_IsRoundStarted, SAME_TEAM, Send_Effect(), Send_Effect_Core(), sin(), sound, time, vector, VOL_BASE, WarpZone_SearchInRadius(), and WarpZone_SearchInRadius_otherent.

Referenced by nade_ice_boom().

◆ nade_ice_think_cond()

bool nade_ice_think_cond ( entity e)

Definition at line 13 of file ice.qc.

14{
15 return (e != WarpZone_SearchInRadius_otherent && e.takedamage
16 && (IS_PLAYER(e) || IS_MONSTER(e))
17 && !IS_DEAD(e) && GetResource(e, RES_HEALTH) > 0 && nade_current_freeze_time > 0
18 && (!e.revival_time || (time - e.revival_time) >= 1.5)
19 && !STAT(FROZEN, e) && !StatusEffects_active(STATUSEFFECT_Frozen, e));
20}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
#define STAT(...)
Definition stats.qh:94
bool StatusEffects_active(StatusEffect this, entity actor)
#define IS_MONSTER(v)
Definition utils.qh:23

References entity(), GetResource(), IS_DEAD, IS_MONSTER, IS_PLAYER, nade_current_freeze_time, STAT, StatusEffects_active(), time, and WarpZone_SearchInRadius_otherent.

Referenced by nade_ice_think().

Variable Documentation

◆ nade_current_freeze_time

float nade_current_freeze_time

Definition at line 12 of file ice.qc.

Referenced by nade_ice_think(), and nade_ice_think_cond().