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_DontUseTargets (entity this, entity actor, entity trigger)
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)
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
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 98 of file triggers.qc.

99{
100 //LOG_WARNF("Entity %s was (de)activated by a trigger, please update map to use relays", this.targetname);
101 this.setactive(this, ACTIVE_TOGGLE);
102}
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 76 of file triggers.qc.

77{
78 if(this.targetname && this.targetname != "")
79 {
80 if(this.spawnflags & START_ENABLED)
81 {
82 this.active = ACTIVE_ACTIVE;
83 }
84 else
85 {
86 this.active = ACTIVE_NOT;
87 }
88 }
89 else
90 {
91 this.active = ACTIVE_ACTIVE;
92 }
93
95}
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:118
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 65 of file triggers.qc.

66{
67 int old_status = this.active;
68 generic_setactive(this, act);
69
70 if (this.active != old_status)
71 {
73 }
74}
void generic_setactive(entity this, int act)
Definition triggers.qc:46

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 46 of file triggers.qc.

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

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

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

◆ SUB_DontUseTargets()

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

Definition at line 35 of file triggers.qc.

35{ }

References entity().

◆ SUB_UseTargets()

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

Definition at line 344 of file triggers.qc.

344{ 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:248

Referenced by DelayThink().

◆ SUB_UseTargets_PreventReuse()

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

Definition at line 345 of file triggers.qc.

345{ 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 )

Definition at line 346 of file triggers.qc.

346{ 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 += 1;
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:243
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 110 of file triggers.qc.

111{
112 int f = 0;
113 if(this.warpzone_isboxy)
114 BITSET_ASSIGN(f, 1);
115 if(this.origin != '0 0 0')
116 BITSET_ASSIGN(f, 4);
117 if(this.movedir != '0 0 0')
118 BITSET_ASSIGN(f, 8);
119 if(this.angles != '0 0 0')
120 BITSET_ASSIGN(f, 16);
122
123 if(withtarget)
124 {
125 // probably some way to clean this up...
126 int targbits = 0;
127 if(this.target && this.target != "") targbits |= BIT(0);
128 if(this.target2 && this.target2 != "") targbits |= BIT(1);
129 if(this.target3 && this.target3 != "") targbits |= BIT(2);
130 if(this.target4 && this.target4 != "") targbits |= BIT(3);
131 if(this.targetname && this.targetname != "") targbits |= BIT(4);
132 if(this.killtarget && this.killtarget != "") targbits |= BIT(5);
133
134 WriteByte(MSG_ENTITY, targbits);
135
136 if(targbits & BIT(0))
138 if(targbits & BIT(1))
140 if(targbits & BIT(2))
142 if(targbits & BIT(3))
144 if(targbits & BIT(4))
146 if(targbits & BIT(5))
148 }
149
150 if(f & 4)
151 WriteVector(MSG_ENTITY, this.origin);
152
153 if(f & 8)
154 WriteVector(MSG_ENTITY, this.movedir);
155
156 if(f & 16)
157 WriteVector(MSG_ENTITY, this.angles);
158
160 WriteVector(MSG_ENTITY, this.mins);
161 WriteVector(MSG_ENTITY, this.maxs);
162 WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
163}
#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
ent angles
Definition ent_cs.qc:121
const int MSG_ENTITY
Definition net.qh:115
#define BITSET_ASSIGN(a, b)
Definition common.qh:104
float warpzone_isboxy
Definition common.qh:12
vector movedir
Definition viewloc.qh:18
float bound(float min, float value, float max)
void WriteString(string data, float dest, float desto)
void WriteShort(float data, float dest, float desto)
void WriteByte(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.

◆ 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(), 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(), info_autoscreenshot_findtarget(), 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_init_verify(), 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