Xonotic
net.qc
Go to the documentation of this file.
1
#include "
net.qh
"
2
3
#ifdef GAMEQC
4
5
#include "
nades.qh
"
6
7
#ifdef CSQC
8
.float
ltime
;
9
void
orb_draw(
entity
this
)
10
{
11
float
dt =
time
- this.
move_time
;
12
this.move_time =
time
;
13
if
(dt <= 0)
14
return
;
15
16
this.
alpha
= (this.
ltime
-
time
) / this.
orb_lifetime
;
17
this.
scale
=
min
((1 - this.
alpha
)*this.
orb_lifetime
*4,1)*this.
orb_radius
;
18
this.
angles
= this.
angles
+ dt * this.
avelocity
;
19
}
20
21
void
orb_setup(
entity
e)
22
{
23
setmodel
(e, MDL_NADE_ORB);
24
e.skin = 1;
25
26
setorigin
(e, e.origin);
27
28
float
model_radius = e.maxs.x;
29
vector
size
=
'1 1 1'
* e.orb_radius / 2;
30
setsize(e,-size,size);
31
e.orb_radius = e.orb_radius/model_radius*0.6;
32
33
e.draw = orb_draw;
34
IL_PUSH
(
g_drawables
, e);
35
SetResourceExplicit
(e,
RES_HEALTH
, 255);
36
set_movetype
(e,
MOVETYPE_NONE
);
37
e.solid =
SOLID_NOT
;
38
e.drawmask =
MASK_NORMAL
;
39
e.scale = 0.01;
40
e.avelocity =
'7 0 11'
;
41
e.renderflags |=
RF_ADDITIVE
;
42
}
43
#endif
44
45
REGISTER_NET_LINKED
(Nade_Orb)
46
47
#ifdef CSQC
48
NET_HANDLE
(Nade_Orb,
bool
isNew)
49
{
50
Net_Accept(Nade_Orb);
51
int
sf = ReadByte();
52
if
(sf & 1) {
53
this.
origin
= ReadVector();
54
setorigin
(
this
, this.
origin
);
55
this.
colormod
= ReadVector();
56
this.
orb_lifetime
= ReadByte();
57
this.
orb_radius
= ReadShort();
58
this.
ltime
=
time
+ ReadByte()/10.0;
59
// this.ltime = time + this.orb_lifetime;
60
orb_setup(
this
);
61
}
62
return
true
;
63
}
64
#endif
65
66
#ifdef SVQC
67
bool
orb_send(
entity
this
,
entity
to
,
int
sf)
68
{
69
int
channel = MSG_ENTITY;
70
WriteHeader(channel, Nade_Orb);
71
WriteByte
(channel, sf);
72
if
(sf & 1) {
73
WriteVector(channel, this.
origin
);
74
75
WriteVector(channel, this.
colormod
);
76
77
WriteByte
(channel, this.
orb_lifetime
);
78
//WriteByte(MSG_ENTITY, this.ltime - time + 1);
79
WriteShort
(channel, this.
orb_radius
);
80
// round time delta to a 1/10th of a second
81
WriteByte
(channel, (this.
ltime
-
time
)*10.0+0.5);
82
}
83
return
true
;
84
}
85
#endif
86
87
#endif
SOLID_NOT
const float SOLID_NOT
Definition:
csprogsdefs.qc:244
MOVETYPE_NONE
float MOVETYPE_NONE
Definition:
progsdefs.qc:246
alpha
float alpha
Definition:
items.qc:14
REGISTER_NET_LINKED
#define REGISTER_NET_LINKED(id)
Definition:
net.qh:67
colormod
vector colormod
Definition:
powerups.qc:21
nades.qh
SetResourceExplicit
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Definition:
cl_resources.qc:15
WriteByte
void WriteByte(float data, float dest, float desto)
net.qh
entity
entity() spawn
NET_HANDLE
#define NET_HANDLE(id, param)
Definition:
net.qh:12
to
entity to
Definition:
self.qh:96
origin
origin
Definition:
ent_cs.qc:114
avelocity
vector avelocity
Definition:
csprogsdefs.qc:105
WriteShort
void WriteShort(float data, float dest, float desto)
size
vector size
Definition:
csprogsdefs.qc:114
ltime
float ltime
Definition:
progsdefs.qc:107
setmodel
#define setmodel(this, m)
Definition:
model.qh:26
RES_HEALTH
RES_HEALTH
Definition:
ent_cs.qc:126
IL_PUSH
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
Definition:
intrusivelist.qh:58
min
float min(float f,...)
orb_lifetime
float orb_lifetime
Definition:
nades.qh:129
MASK_NORMAL
const float MASK_NORMAL
Definition:
csprogsdefs.qc:164
RF_ADDITIVE
const float RF_ADDITIVE
Definition:
csprogsdefs.qc:169
scale
float scale
Definition:
projectile.qc:14
vector
vector(float skel, float bonenum) _skel_get_boneabs_hidden
orb_radius
float orb_radius
Definition:
nades.qh:130
move_time
float move_time
Definition:
movetypes.qh:77
setorigin
setorigin(ent, v)
angles
vector angles
Definition:
csprogsdefs.qc:104
time
float time
Definition:
csprogsdefs.qc:16
g_drawables
IntrusiveList g_drawables
Definition:
main.qh:77
set_movetype
void set_movetype(entity this, int mt)
common
mutators
mutator
nades
net.qc
Generated on Thu Mar 17 2022 17:26:28 for Xonotic by
1.8.13