Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
frozen.qc
Go to the documentation of this file.
1#include "frozen.qh"
2
3#ifdef SVQC
4.entity frozen_ice;
5
7{
8 if(this.frozen_ice)
9 delete(this.frozen_ice);
10 this.frozen_ice = NULL;
11}
12
14{
15 if(this.owner.frozen_ice != this || wasfreed(this.owner))
16 {
17 delete(this);
18 return;
19 }
20 vector ice_org = this.owner.origin - '0 0 16';
21 if(this.origin != ice_org)
22 setorigin(this, ice_org);
23 this.nextthink = time;
24}
25
27{
28 entity ice = new(ice);
29 // set_movetype(ice, MOVETYPE_FOLLOW) would rotate the ice model with the player
30 ice.owner = this;
31 ice.scale = this.scale;
33 ice.nextthink = time;
34 ice.frame = floor(random() * 21); // ice model has 20 different looking frames
35 // TODO: unique (less pronounced) model
36 setmodel(ice, MDL_ICE);
37 ice.alpha = 0.5;
38
39 this.frozen_ice = ice;
40
42}
43
44METHOD(Frozen, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
45{
46 bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
47 if(!wasactive)
48 {
49 Frozen_ice_create(actor);
51 // TODO: should hooks targeting this entity also be removed?
52 // TODO: special items as well?
53 }
54 SUPER(Frozen).m_apply(this, actor, eff_time, eff_flags);
55}
56METHOD(Frozen, m_remove, void(StatusEffect this, entity actor, int removal_type))
57{
58 Frozen_ice_remove(actor);
59 SUPER(Frozen).m_remove(this, actor, removal_type);
60}
61METHOD(Frozen, m_tick, void(StatusEffect this, entity actor))
62{
63 if(STAT(FROZEN, actor) || (actor.waterlevel && actor.watertype == CONTENT_LAVA))
64 {
65 this.m_remove(this, actor, STATUSEFFECT_REMOVE_NORMAL);
66 return;
67 }
68 SUPER(Frozen).m_tick(this, actor);
69}
70#endif
71#ifdef CSQC
72METHOD(Frozen, m_tick, void(StatusEffect this, entity actor))
73{
74 vector col = '0.25 0.90 1';
75 float alpha_fade = 0.3;
77}
78#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
entity owner
Definition main.qh:87
#define setmodel(this, m)
Definition model.qh:26
const float DRAWFLAG_ADDITIVE
float time
float nextthink
vector origin
const float CONTENT_LAVA
int m_id
Definition effect.qh:19
void Frozen_ice_create(entity this)
Definition frozen.qc:26
entity frozen_ice
Definition frozen.qc:4
void Frozen_ice_think(entity this)
Definition frozen.qc:13
void Frozen_ice_remove(entity this)
Definition frozen.qc:6
noref float vid_conwidth
Definition draw.qh:8
noref float vid_conheight
Definition draw.qh:9
#define STAT(...)
Definition stats.qh:82
float random(void)
float floor(float f)
@ STATUSEFFECT_REMOVE_NORMAL
Effect is being removed by a function, calls regular removal mechanics.
Definition all.qh:28
@ STATUSEFFECT_FLAG_ACTIVE
Definition all.qh:22
#define SUPER(cname)
Definition oo.qh:231
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define NULL
Definition post.qh:14
float scale
Definition projectile.qc:14
#define setthink(e, f)
vector
Definition self.qh:92
void RemoveGrapplingHooks(entity pl)
Definition hook.qc:30
#define vec2(...)
Definition vector.qh:90
float autocvar_hud_colorflash_alpha
Definition view.qh:39