Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
swamp.qc
Go to the documentation of this file.
1
#include "
swamp.qh
"
2
#if defined(CSQC)
3
#elif defined(MENUQC)
4
#elif defined(SVQC)
5
#include <
lib/warpzone/util_server.qh
>
6
#include <
common/weapons/_all.qh
>
7
#include <
common/weapons/_all.qh
>
8
#include <
common/stats.qh
>
9
#include <
common/deathtypes/all.qh
>
10
#endif
11
12
/*
13
* t_swamp.c
14
* Adds spawnfunc_trigger_swamp and support routines for nexuiz 1.2.1+ and xonotic
15
* Author tZork (Jakob MG)
16
* jakob@games43.se
17
* 2005 11 29
18
*/
19
20
#ifdef SVQC
21
void
swamp_think
(
entity
this
)
22
{
23
// set myself as current swampslug where possible
24
IL_EACH
(
g_swamped
, it.swampslug ==
this
,
25
{
26
it.swampslug = NULL;
27
IL_REMOVE(g_swamped, it);
28
});
29
30
if
(this.
active
==
ACTIVE_ACTIVE
)
31
{
32
FOREACH_ENTITY_RADIUS
((this.
absmin
+ this.
absmax
) * 0.5,
vlen
(this.
absmax
- this.
absmin
) * 0.5 + 1, it.swampslug.active ==
ACTIVE_NOT
&&
IS_PLAYER
(it) && !
IS_DEAD
(it),
33
{
34
if
(
WarpZoneLib_ExactTrigger_Touch
(
this
, it,
false
))
35
{
36
if
(!it.swampslug)
37
IL_PUSH
(
g_swamped
, it);
38
it.swampslug =
this
;
39
}
40
});
41
42
IL_EACH
(
g_swamped
, it.swampslug ==
this
,
43
{
44
if(time > it.swamp_interval)
45
{
46
Damage (it, this, this, this.dmg, DEATH_SWAMP.m_id, DMG_NOWEP, it.origin,
'0 0 0'
);
47
it.swamp_interval = time + this.swamp_interval;
48
}
49
});
50
}
51
52
this.
nextthink
=
time
;
53
}
54
55
/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
56
Players in the swamp will be
57
slowed down and damaged over time
58
*/
59
spawnfunc
(trigger_swamp)
60
{
61
// Init stuff
62
EXACTTRIGGER_INIT
;
63
this.
active
=
ACTIVE_ACTIVE
;
64
setthink
(
this
,
swamp_think
);
65
this.
nextthink
=
time
;
66
67
// Setup default keys, if missing
68
if
(!this.
dmg
)
69
this.
dmg
= 5;
70
if
(!this.
swamp_interval
)
71
this.
swamp_interval
= 1;
72
if
(!this.
swamp_slowdown
)
73
this.
swamp_slowdown
= 0.5;
74
}
75
#endif
_all.qh
dmg
float dmg
Definition
breakable.qc:12
entity
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
IS_DEAD
#define IS_DEAD(s)
Definition
player.qh:245
IS_PLAYER
#define IS_PLAYER(s)
Definition
player.qh:243
stats.qh
time
float time
Definition
csprogsdefs.qc:16
nextthink
float nextthink
Definition
csprogsdefs.qc:125
absmax
vector absmax
Definition
csprogsdefs.qc:96
absmin
vector absmin
Definition
csprogsdefs.qc:96
all.qh
ACTIVE_NOT
const int ACTIVE_NOT
Definition
defs.qh:36
active
int active
Definition
defs.qh:34
ACTIVE_ACTIVE
const int ACTIVE_ACTIVE
Definition
defs.qh:37
IL_PUSH
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
Definition
intrusivelist.qh:61
IL_EACH
#define IL_EACH(this, cond, body)
Definition
intrusivelist.qh:186
FOREACH_ENTITY_RADIUS
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition
iter.qh:160
WarpZoneLib_ExactTrigger_Touch
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
Definition
common.qc:815
EXACTTRIGGER_INIT
#define EXACTTRIGGER_INIT
Definition
common.qh:116
vlen
float vlen(vector v)
setthink
#define setthink(e, f)
spawnfunc
#define spawnfunc(id)
Definition
spawnfunc.qh:96
swamp_think
void swamp_think(entity this)
Definition
swamp.qc:21
swamp.qh
swamp_slowdown
float swamp_slowdown
Definition
swamp.qh:10
swamp_interval
float swamp_interval
Definition
swamp.qh:9
g_swamped
IntrusiveList g_swamped
Definition
swamp.qh:4
util_server.qh
common
mapobjects
trigger
swamp.qc
Generated on
for Xonotic QuakeC by
1.14.0