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)

Function Documentation

◆ nade_ice_boom()

void nade_ice_boom ( entity this)

Definition at line 80 of file ice.qc.

81{
82 entity fountain = new(nade_ice_fountain);
83 fountain.owner = this.owner;
84 fountain.realowner = this.realowner;
85 fountain.origin = this.origin;
86 setorigin(fountain, fountain.origin);
87 setthink(fountain, nade_ice_think);
88 fountain.nextthink = time;
89 fountain.pushltime = fountain.wait = fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
90 fountain.team = this.team;
91 set_movetype(fountain, MOVETYPE_TOSS);
92 fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
93 fountain.bot_dodge = false;
94 setsize(fountain, '-16 -16 -16', '16 16 16');
95 fountain.nade_special_time = time + 0.3;
96 fountain.angles = this.angles;
97
99 {
100 setmodel(fountain, MDL_PROJECTILE_GRENADE);
101 entity timer = new(nade_timer);
102 setmodel(timer, MDL_NADE_TIMER);
103 setattachment(timer, fountain, "");
104 timer.colormap = this.colormap;
105 timer.glowmod = this.glowmod;
107 timer.nextthink = time;
108 timer.wait = fountain.wait;
109 timer.nade_lifetime = this.nade_lifetime;
110 timer.owner = fountain;
111 timer.skin = 10;
112 }
113 else
114 setmodel(fountain, MDL_Null);
115}
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
float time
float colormap
vector origin
vector glowmod
ent angles
Definition ent_cs.qc:121
float timer
Definition hud.qh:125
void nade_ice_think(entity this)
Definition ice.qc:12
bool autocvar_g_nades_ice_explode
Definition ice.qh:8
float autocvar_g_nades_ice_freeze_time
Definition ice.qh:7
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_TOSS
Definition movetypes.qh:135
#define setthink(e, f)
void nade_timer_think(entity this)
Definition sv_nades.qc:23
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(), glowmod, 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:124
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 12 of file ice.qc.

13{
16 {
17 delete(this);
18 return;
19 }
20
21 if(time >= this.ltime)
22 {
24 {
25 vector expcol_min = nades_PlayerColor(this.realowner, false);
26 vector expcol_max = nades_PlayerColor(this.realowner, true);
27 entity expef = EFFECT_NADE_EXPLODE;
28 Send_Effect_Except(expef, this.origin + '0 0 1', '0 0 0', 1, expcol_min, expcol_max, NULL);
29 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
30
31 nade_normal_boom(this);
32 }
33 delete(this);
34 return;
35 }
36
37
38 this.nextthink = time + 0.1;
39
40 // gaussian
41 float randomr;
42 randomr = random();
43 randomr = exp(-5 * randomr * randomr) * autocvar_g_nades_nade_radius;
44 float randomw;
45 randomw = random() * (2 * M_PI);
46 vector randomp;
47 randomp.x = randomr * cos(randomw);
48 randomp.y = randomr * sin(randomw);
49 randomp.z = 1;
50 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, this.origin + randomp, '0 0 0', 1);
51
52 if(time >= this.nade_special_time)
53 {
54 this.nade_special_time = time + 0.7;
55
56 Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
57 Send_Effect(EFFECT_ICEFIELD, this.origin, '0 0 0', 1);
58 }
59
60
61 float current_freeze_time = this.ltime - time - 0.1;
62
63 FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage
64 && (IS_PLAYER(it) || IS_MONSTER(it)) && !IS_DEAD(it) && GetResource(it, RES_HEALTH) > 0 && current_freeze_time > 0
65 && (!it.revival_time || ((time - it.revival_time) >= 1.5))
66 && !STAT(FROZEN, it) && !StatusEffects_active(STATUSEFFECT_Frozen, it),
67 {
69 {
70 case 0: break; // affect everyone
71 default:
72 case 2: if(SAME_TEAM(it, this.realowner)) continue; // don't affect teammates
73 // fall through (check case 1 condition too)
74 case 1: if(it == this.realowner) continue; // don't affect the player who threw the nade
75 }
76 nade_ice_freeze(this, it, current_freeze_time);
77 });
78}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
float nextthink
void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, entity ignore)
Definition all.qc:105
void nade_ice_freeze(entity freezefield, entity frost_target, float freezetime)
Definition ice.qc:4
bool autocvar_g_nades_ice_teamcheck
Definition ice.qh:9
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
#define STAT(...)
Definition stats.qh:82
float exp(float e)
Definition mathlib.qc:73
#define M_PI
Definition mathlib.qh:108
float cos(float f)
float random(void)
float sin(float f)
float ltime
Definition net.qc:10
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:92
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
bool StatusEffects_active(StatusEffect this, entity actor)
vector nades_PlayerColor(entity this, bool isPants)
Definition sv_nades.qc:13
float autocvar_g_nades_nade_radius
Definition sv_nades.qh:21
float nade_special_time
Definition sv_nades.qh:47
#define SAME_TEAM(a, b)
Definition teams.qh:241
#define IS_MONSTER(v)
Definition utils.qh:21

References ATTEN_NORM, autocvar_g_nades_ice_explode, autocvar_g_nades_ice_teamcheck, autocvar_g_nades_nade_radius, CH_SHOTS, cos(), entity(), exp(), FOREACH_ENTITY_RADIUS, GetResource(), IS_DEAD, IS_MONSTER, IS_PLAYER, ltime, M_PI, nade_ice_freeze(), 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_Except(), sin(), sound, STAT, StatusEffects_active(), time, vector, and VOL_BASE.

Referenced by nade_ice_boom().