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

Go to the source code of this file.

Functions

void generic_netlinked_legacy_use (entity this, entity actor, entity trigger)
void generic_netlinked_reset (entity this)
void generic_netlinked_setactive (entity this, int act)
void generic_setactive (entity this, int act)
void SUB_UseTargets (entity this, entity actor, entity trigger)
void SUB_UseTargets_PreventReuse (entity this, entity actor, entity trigger)
void SUB_UseTargets_SkipTargets (entity this, entity actor, entity trigger, int skiptargets)
 allow excluding certain .target* fields without needing to nullify them use BIT(1) through BIT(4)
void target_voicescript_clear (entity pl)
void target_voicescript_next (entity pl)
void trigger_common_read (entity this, bool withtarget)
void trigger_common_write (entity this, bool withtarget)
string trigger_magicear_processmessage_forallears (entity source, float teamsay, entity privatesay, string msgin)
void trigger_remove_generic (entity this)

Variables

float antiwall_flag
float atten
float cnt
float count
vector dest
float height
float lip
int loopdetector
 bitfield for recursive functions to avoid crashing
string message2
bool pushable
float sub_target_used
string target
string targetname
float volume

Function Documentation

◆ generic_netlinked_legacy_use()

void generic_netlinked_legacy_use ( entity this,
entity actor,
entity trigger )

Definition at line 96 of file triggers.qc.

97{
98 //LOG_WARNF("Entity %s was (de)activated by a trigger, please update map to use relays", this.targetname);
99 this.setactive(this, ACTIVE_TOGGLE);
100}
const int ACTIVE_TOGGLE
Definition defs.qh:40

References ACTIVE_TOGGLE, and entity().

Referenced by conveyor_init(), spawnfunc(), and spawnfunc().

◆ generic_netlinked_reset()

void generic_netlinked_reset ( entity this)

Definition at line 74 of file triggers.qc.

75{
76 if(this.targetname && this.targetname != "")
77 {
78 if(this.spawnflags & START_ENABLED)
79 {
80 this.active = ACTIVE_ACTIVE;
81 }
82 else
83 {
84 this.active = ACTIVE_NOT;
85 }
86 }
87 else
88 {
89 this.active = ACTIVE_ACTIVE;
90 }
91
93}
int spawnflags
Definition ammo.qh:15
const int ACTIVE_NOT
Definition defs.qh:36
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
const int START_ENABLED
Definition defs.qh:6
const int SF_TRIGGER_UPDATE
Definition defs.qh:23
int SendFlags
Definition net.qh:159
string targetname
Definition triggers.qh:56

References active, ACTIVE_ACTIVE, ACTIVE_NOT, entity(), SendFlags, SF_TRIGGER_UPDATE, spawnflags, START_ENABLED, and targetname.

Referenced by conveyor_init(), spawnfunc(), and spawnfunc().

◆ generic_netlinked_setactive()

void generic_netlinked_setactive ( entity this,
int act )

Definition at line 63 of file triggers.qc.

64{
65 int old_status = this.active;
66 generic_setactive(this, act);
67
68 if (this.active != old_status)
69 {
71 }
72}
void generic_setactive(entity this, int act)
Definition triggers.qc:44

References active, entity(), generic_setactive(), SendFlags, and SF_TRIGGER_UPDATE.

Referenced by conveyor_init(), spawnfunc(), spawnfunc(), and spawnfunc().

◆ generic_setactive()

void generic_setactive ( entity this,
int act )

Definition at line 44 of file triggers.qc.

45{
46 if(act == ACTIVE_TOGGLE)
47 {
48 if(this.active == ACTIVE_ACTIVE)
49 {
50 this.active = ACTIVE_NOT;
51 }
52 else
53 {
54 this.active = ACTIVE_ACTIVE;
55 }
56 }
57 else
58 {
59 this.active = act;
60 }
61}

References active, ACTIVE_ACTIVE, ACTIVE_NOT, ACTIVE_TOGGLE, and entity().

Referenced by generic_netlinked_setactive(), relay_activators_use(), and spawnfunc().

◆ SUB_UseTargets()

void SUB_UseTargets ( entity this,
entity actor,
entity trigger )

Definition at line 353 of file triggers.qc.

353{ SUB_UseTargets_Ex(this, actor, trigger, false, 0); }
void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
Definition triggers.qc:246

Referenced by DelayThink().

◆ SUB_UseTargets_PreventReuse()

void SUB_UseTargets_PreventReuse ( entity this,
entity actor,
entity trigger )

Definition at line 354 of file triggers.qc.

354{ SUB_UseTargets_Ex(this, actor, trigger, true, 0); }

References entity(), and SUB_UseTargets_Ex().

◆ SUB_UseTargets_SkipTargets()

void SUB_UseTargets_SkipTargets ( entity this,
entity actor,
entity trigger,
int skiptargets )

allow excluding certain .target* fields without needing to nullify them use BIT(1) through BIT(4)

Definition at line 355 of file triggers.qc.

355{ SUB_UseTargets_Ex(this, actor, trigger, false, skiptargets); }

References entity(), and SUB_UseTargets_Ex().

Referenced by WarpZone_Touch().

◆ target_voicescript_clear()

void target_voicescript_clear ( entity pl)

Definition at line 8 of file voicescript.qc.

9{
10 pl.voicescript = NULL;
11}
#define NULL
Definition post.qh:14

References entity(), and NULL.

Referenced by PutPlayerInServer().

◆ target_voicescript_next()

void target_voicescript_next ( entity pl)

Definition at line 25 of file voicescript.qc.

26{
27 entity vs;
28 float i, n, dt;
29
30 vs = pl.voicescript;
31 if(!vs)
32 return;
33 if(vs.active != ACTIVE_ACTIVE)
34 {
35 pl.voicescript = NULL;
36 return;
37 }
38 if(vs.message == "")
39 return;
40 if (!IS_PLAYER(pl))
41 return;
42 if(game_stopped)
43 return;
44
45 if(time >= pl.voicescript_voiceend)
46 {
47 if(time >= pl.voicescript_nextthink)
48 {
49 // get the next voice...
50 n = tokenize_console(vs.message);
51
52 if(pl.voicescript_index < vs.cnt)
53 i = pl.voicescript_index * 2;
54 else if(n > vs.cnt * 2)
55 i = ((pl.voicescript_index - vs.cnt) % ((n - vs.cnt * 2 - 1) / 2)) * 2 + vs.cnt * 2 + 1;
56 else
57 i = -1;
58
59 if(i >= 0)
60 {
61 play2(pl, strcat(vs.netname, "/", argv(i), ".wav"));
62 dt = stof(argv(i + 1));
63 if(dt >= 0)
64 {
65 pl.voicescript_voiceend = time + dt;
66 pl.voicescript_nextthink = pl.voicescript_voiceend + vs.wait * (0.5 + random());
67 }
68 else
69 {
70 pl.voicescript_voiceend = time - dt;
71 pl.voicescript_nextthink = pl.voicescript_voiceend;
72 }
73
74 ++pl.voicescript_index;
75 }
76 else
77 {
78 pl.voicescript = NULL; // stop trying then
79 }
80 }
81 }
82}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define IS_PLAYER(s)
Definition player.qh:242
float game_stopped
Definition stats.qh:81
float time
#define tokenize_console
float stof(string val,...)
float random(void)
string argv(float n)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void play2(entity e, string filename)
Definition all.qc:116

References ACTIVE_ACTIVE, argv(), entity(), game_stopped, IS_PLAYER, NULL, play2(), random(), stof(), strcat(), time, and tokenize_console.

Referenced by PlayerPreThink().

◆ trigger_common_read()

void trigger_common_read ( entity this,
bool withtarget )

References entity().

◆ trigger_common_write()

void trigger_common_write ( entity this,
bool withtarget )

Definition at line 108 of file triggers.qc.

109{
110 int f = 0;
111 if(this.warpzone_isboxy)
112 BITSET_ASSIGN(f, 1);
113 if(this.origin != '0 0 0')
114 BITSET_ASSIGN(f, 4);
115 if(this.movedir != '0 0 0')
116 BITSET_ASSIGN(f, 8);
117 if(this.angles != '0 0 0')
118 BITSET_ASSIGN(f, 16);
120
121 if(withtarget)
122 {
123 // probably some way to clean this up...
124 int targbits = 0;
125 if(this.target && this.target != "") targbits |= BIT(0);
126 if(this.target2 && this.target2 != "") targbits |= BIT(1);
127 if(this.target3 && this.target3 != "") targbits |= BIT(2);
128 if(this.target4 && this.target4 != "") targbits |= BIT(3);
129 if(this.targetname && this.targetname != "") targbits |= BIT(4);
130 if(this.killtarget && this.killtarget != "") targbits |= BIT(5);
131
132 WriteByte(MSG_ENTITY, targbits);
133
134 if(targbits & BIT(0))
136 if(targbits & BIT(1))
138 if(targbits & BIT(2))
140 if(targbits & BIT(3))
142 if(targbits & BIT(4))
144 if(targbits & BIT(5))
146 }
147
148 if(f & 4)
149 WriteVector(MSG_ENTITY, this.origin);
150
151 if(f & 8)
152 WriteVector(MSG_ENTITY, this.movedir);
153
154 if(f & 16)
155 WriteVector(MSG_ENTITY, this.angles);
156
158 WriteVector(MSG_ENTITY, this.mins);
159 WriteVector(MSG_ENTITY, this.maxs);
160 WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
161}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
float modelindex
vector mins
vector maxs
vector origin
WriteString(chan, ent.netname)
ent angles
Definition ent_cs.qc:146
WriteByte(chan, ent.angles.y/DEC_FACTOR)
const int MSG_ENTITY
Definition net.qh:156
#define BITSET_ASSIGN(a, b)
Definition common.qh:122
float warpzone_isboxy
Definition common.qh:15
vector movedir
Definition viewloc.qh:18
float bound(float min, float value, float max)
void WriteShort(float data, float dest, float desto)
float scale
Definition projectile.qc:14
string killtarget
Definition subs.qh:48
string target4
Definition subs.qh:55
string target3
Definition subs.qh:54
string target2
string target
Definition triggers.qh:55

References angles, BIT, BITSET_ASSIGN, bound(), entity(), killtarget, maxs, mins, modelindex, movedir, MSG_ENTITY, origin, scale, target, target2, target3, target4, targetname, warpzone_isboxy, WriteByte(), WriteShort(), and WriteString().

Referenced by door_send(), func_ladder_send(), plat_send(), train_send(), trigger_impulse_send(), trigger_keylock_send(), trigger_push_send(), trigger_push_velocity_send(), and trigger_teleport_send().

◆ trigger_magicear_processmessage_forallears()

string trigger_magicear_processmessage_forallears ( entity source,
float teamsay,
entity privatesay,
string msgin )

Definition at line 149 of file magicear.qc.

150{
151 entity ear;
152 string msgout;
153 for(ear = magicears; ear; ear = ear.enemy)
154 {
155 msgout = trigger_magicear_processmessage(ear, source, teamsay, privatesay, msgin);
156 if(!(ear.spawnflags & MAGICEAR_CONTINUE))
158 return msgout;
159 msgin = msgout;
160 }
161 return msgin;
162}
bool magicear_matched
Definition magicear.qc:4
string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
Definition magicear.qc:5
entity magicears
Definition magicear.qc:148
const int MAGICEAR_CONTINUE
Definition magicear.qh:10

References entity(), MAGICEAR_CONTINUE, magicear_matched, magicears, and trigger_magicear_processmessage().

Referenced by ClientCommand_tell(), Say(), and W_Tuba_NoteOff().

◆ trigger_remove_generic()

void trigger_remove_generic ( entity this)

References entity().

Variable Documentation

◆ antiwall_flag

float antiwall_flag

Definition at line 6 of file triggers.qh.

Referenced by g_clientmodel_use(), and SUB_UseTargets_Ex().

◆ atten

◆ cnt

float cnt

Definition at line 14 of file triggers.qh.

◆ count

float count

Definition at line 15 of file triggers.qh.

◆ dest

vector dest

Definition at line 49 of file triggers.qh.

◆ height

float height

Definition at line 9 of file triggers.qh.

◆ lip

float lip

Definition at line 11 of file triggers.qh.

◆ loopdetector

int loopdetector

bitfield for recursive functions to avoid crashing

Definition at line 29 of file triggers.qh.

Referenced by SUB_UseTargets_Ex().

◆ message2

◆ pushable

bool pushable

Definition at line 4 of file triggers.qh.

◆ sub_target_used

float sub_target_used

Definition at line 45 of file triggers.qh.

◆ target

◆ targetname

string targetname

Definition at line 56 of file triggers.qh.

Referenced by bot_getplace(), buff_Reset(), conveyor_init(), conveyor_send(), corner_send(), door_init_shared(), dynlight_find_aiment(), dynlight_find_path(), dynlight_find_target(), ewheel_findtarget(), follow_init(), func_vectormamamam_findtarget(), generic_netlinked_reset(), get_pusher_from_trigger(), info_autoscreenshot_findtarget(), Item_Reset(), jumppad_push(), LinkDoors(), LODmodel_attach(), misc_laser_init(), Monster_Move(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), ons_DelayedLinkSetup(), plat_delayedinit(), plat_reset(), relay_activators_use(), Simple_TeleportPlayer(), Spawn_Score(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), StartItem(), SUB_UseTargets_Ex(), target_checkpoint_setup(), target_music_reset(), target_objective_decrease_activate(), target_push_send(), target_spawn_use(), target_spawn_useon(), target_speed_send(), target_teleporter_checktarget(), teleport_dest_send(), teleport_findtarget(), train_next(), train_next_find(), train_use(), train_wait(), trigger_common_write(), trigger_disablerelay_use(), trigger_heal_touch(), trigger_impulse_touch_directional(), trigger_keylock_kill(), trigger_keylock_trigger(), trigger_push_test(), turret_checkpoint_init(), turret_findtarget(), vehicle_initialize(), viewloc_init(), walker_findtarget(), WarpZone_InitStep_FindOriginTarget(), WarpZone_InitStep_FindTarget(), WarpZoneCamera_InitStep_FindTarget(), and WarpZonePosition_InitStep_FindTarget().

◆ volume