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

Go to the source code of this file.

Functions

void func_vectormamamam_controller_think (entity this)
void func_vectormamamam_findtarget (entity this)
void func_vectormamamam_init_for_player (entity this, entity player)
vector func_vectormamamam_origin (entity o, float timestep)
void func_vectormamamam_setactive (entity this, int astate)
 spawnfunc (func_vectormamamam)

Variables

float target2factor
vector target2normal
float target3factor
vector target3normal
float target4factor
vector target4normal
float targetfactor
vector targetnormal
entity wp00
entity wp01
entity wp02
entity wp03

Function Documentation

◆ func_vectormamamam_controller_think()

void func_vectormamamam_controller_think ( entity this)

Definition at line 59 of file vectormamamam.qc.

60{
62
63 if(this.owner.active != ACTIVE_ACTIVE)
64 {
65 this.owner.velocity = '0 0 0';
66 return;
67 }
68
69 if(this.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed
70 this.owner.velocity = (this.owner.destvec + func_vectormamamam_origin(this.owner, VECTORMAMAMAM_TIMESTEP) - this.owner.origin) * 10;
71}
entity owner
Definition main.qh:87
float time
float nextthink
const int ACTIVE_ACTIVE
Definition defs.qh:37
vector func_vectormamamam_origin(entity o, float timestep)
const float VECTORMAMAMAM_TIMESTEP

References ACTIVE_ACTIVE, entity(), func_vectormamamam_origin(), nextthink, owner, time, and VECTORMAMAMAM_TIMESTEP.

Referenced by func_vectormamamam_findtarget().

◆ func_vectormamamam_findtarget()

void func_vectormamamam_findtarget ( entity this)

Definition at line 73 of file vectormamamam.qc.

74{
75 if(this.target && this.target != "")
76 this.wp00 = find(NULL, targetname, this.target);
77
78 if(this.target2 && this.target2 != "")
79 this.wp01 = find(NULL, targetname, this.target2);
80
81 if(this.target3 && this.target3 != "")
82 this.wp02 = find(NULL, targetname, this.target3);
83
84 if(this.target4 && this.target4 != "")
85 this.wp03 = find(NULL, targetname, this.target4);
86
87 if(!this.wp00 && !this.wp01 && !this.wp02 && !this.wp03)
88 objerror(this, "No reference entity found, so there is nothing to move. Aborting.");
89
90 this.destvec = this.origin - func_vectormamamam_origin(this, 0);
91
92 entity controller = new_pure(func_vectormamamam_controller);
93 controller.owner = this;
94 controller.nextthink = time + 1;
96}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector origin
entity find(entity start,.string field, string match)
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define NULL
Definition post.qh:14
#define objerror
Definition pre.qh:8
#define setthink(e, f)
vector destvec
Definition subs.qh:35
string target4
Definition subs.qh:55
string target3
Definition subs.qh:54
string target2
string targetname
Definition triggers.qh:56
string target
Definition triggers.qh:55
entity wp01
void func_vectormamamam_controller_think(entity this)
entity wp03
entity wp02
entity wp00

References destvec, entity(), find(), func_vectormamamam_controller_think(), func_vectormamamam_origin(), new_pure, NULL, objerror, origin, setthink, target, target2, target3, target4, targetname, time, wp00, wp01, wp02, and wp03.

Referenced by spawnfunc().

◆ func_vectormamamam_init_for_player()

void func_vectormamamam_init_for_player ( entity this,
entity player )

Definition at line 123 of file vectormamamam.qc.

124{
125 if (this.noise && this.noise != "" && this.active == ACTIVE_ACTIVE && IS_REAL_CLIENT(player))
126 {
127 msg_entity = player;
129 }
130}
int active
Definition defs.qh:34
float MSG_ONE
Definition menudefs.qc:56
entity msg_entity
Definition progsdefs.qc:63
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_IDLE
Definition sound.qh:32
void soundto(int _dest, entity e, int chan, string samp, float vol, float _atten, float _pitch)
Definition all.qc:74
string noise
Definition subs.qh:83
#define IS_REAL_CLIENT(v)
Definition utils.qh:17

References active, ACTIVE_ACTIVE, ATTEN_IDLE, CH_TRIGGER_SINGLE, entity(), IS_REAL_CLIENT, msg_entity, MSG_ONE, noise, soundto(), and VOL_BASE.

Referenced by spawnfunc().

◆ func_vectormamamam_origin()

vector func_vectormamamam_origin ( entity o,
float timestep )

Definition at line 9 of file vectormamamam.qc.

10{
11 vector p;
12 entity e;
13 int myflags = o.spawnflags;
14 vector v = '0 0 0';
15
16 e = o.wp00;
17 if(e)
18 {
19 p = e.origin + timestep * e.velocity;
20 if(myflags & PROJECT_ON_TARGETNORMAL)
21 v = v + (p * o.targetnormal) * o.targetnormal * o.targetfactor;
22 else
23 v = v + (p - (p * o.targetnormal) * o.targetnormal) * o.targetfactor;
24 }
25
26 e = o.wp01;
27 if(e)
28 {
29 p = e.origin + timestep * e.velocity;
30 if(myflags & PROJECT_ON_TARGET2NORMAL)
31 v = v + (p * o.target2normal) * o.target2normal * o.target2factor;
32 else
33 v = v + (p - (p * o.target2normal) * o.target2normal) * o.target2factor;
34 }
35
36 e = o.wp02;
37 if(e)
38 {
39 p = e.origin + timestep * e.velocity;
40 if(myflags & PROJECT_ON_TARGET3NORMAL)
41 v = v + (p * o.target3normal) * o.target3normal * o.target3factor;
42 else
43 v = v + (p - (p * o.target3normal) * o.target3normal) * o.target3factor;
44 }
45
46 e = o.wp03;
47 if(e)
48 {
49 p = e.origin + timestep * e.velocity;
50 if(myflags & PROJECT_ON_TARGET4NORMAL)
51 v = v + (p * o.target4normal) * o.target4normal * o.target4factor;
52 else
53 v = v + (p - (p * o.target4normal) * o.target4normal) * o.target4factor;
54 }
55
56 return v;
57}
vector
Definition self.qh:92
const int PROJECT_ON_TARGETNORMAL
const int PROJECT_ON_TARGET2NORMAL
const int PROJECT_ON_TARGET3NORMAL
const int PROJECT_ON_TARGET4NORMAL

References entity(), PROJECT_ON_TARGET2NORMAL, PROJECT_ON_TARGET3NORMAL, PROJECT_ON_TARGET4NORMAL, PROJECT_ON_TARGETNORMAL, and vector.

Referenced by func_vectormamamam_controller_think(), and func_vectormamamam_findtarget().

◆ func_vectormamamam_setactive()

void func_vectormamamam_setactive ( entity this,
int astate )

Definition at line 98 of file vectormamamam.qc.

99{
100 if (astate == ACTIVE_TOGGLE)
101 {
102 if(this.active == ACTIVE_ACTIVE)
103 this.active = ACTIVE_NOT;
104 else
105 this.active = ACTIVE_ACTIVE;
106 }
107 else
108 this.active = astate;
109
110 if(this.active == ACTIVE_NOT)
111 {
113 }
114 else
115 {
116 if(this.noise && this.noise != "")
117 {
119 }
120 }
121}
const int ACTIVE_TOGGLE
Definition defs.qh:40
const int ACTIVE_NOT
Definition defs.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
void stopsound(entity e, int chan)
Definition all.qc:109

References _sound, active, ACTIVE_ACTIVE, ACTIVE_NOT, ACTIVE_TOGGLE, ATTEN_IDLE, CH_TRIGGER_SINGLE, entity(), noise, stopsound(), and VOL_BASE.

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( func_vectormamamam )

Definition at line 132 of file vectormamamam.qc.

133{
134 if (this.noise != "")
135 {
136 precache_sound(this.noise);
137 }
138
139 if(!this.targetfactor)
140 this.targetfactor = 1;
141
142 if(!this.target2factor)
143 this.target2factor = 1;
144
145 if(!this.target3factor)
146 this.target3factor = 1;
147
148 if(!this.target4factor)
149 this.target4factor = 1;
150
151 if(this.targetnormal)
153
154 if(this.target2normal)
156
157 if(this.target3normal)
159
160 if(this.target4normal)
162
164 if(this.dmg && (!this.message || this.message == ""))
165 this.message = " was squished";
166 if(this.dmg && (!this.message2 || this.message2 == ""))
167 this.message2 = "was squished by";
168 if(this.dmg && (!this.dmgtime))
169 this.dmgtime = 0.25;
170 this.dmgtime2 = time;
171
172 if (!InitMovingBrushTrigger(this))
173 return;
174
175 // wait for targets to spawn
176 this.nextthink = this.ltime + 999999999;
177 setthink(this, SUB_NullThink); // for PushMove
178
179 // Savage: Reduce bandwith, critical on e.g. nexdm02
180 this.effects |= EF_LOWPRECISION;
181
182 this.setactive = func_vectormamamam_setactive;
183 this.setactive(this, ACTIVE_ACTIVE);
184
185 // maybe send sound to new players
187 this.init_for_player = func_vectormamamam_init_for_player;
188
190}
float dmg
Definition breakable.qc:12
string message
Definition powerups.qc:19
const int INITPRIO_FINDTARGET
Definition constants.qh:96
float effects
float EF_LOWPRECISION
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
string precache_sound(string sample)
vector normalize(vector v)
float ltime
Definition net.qc:10
void generic_plat_blocked(entity this, entity blocker)
Definition platforms.qc:3
float dmgtime
Definition platforms.qh:7
float dmgtime2
Definition platforms.qh:8
#define setblocked(e, f)
IntrusiveList g_initforplayer
Definition client.qh:370
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577
void SUB_NullThink(entity this)
Definition subs.qc:3
string message2
Definition triggers.qh:19
void func_vectormamamam_init_for_player(entity this, entity player)
float target3factor
void func_vectormamamam_findtarget(entity this)
float target4factor
void func_vectormamamam_setactive(entity this, int astate)
vector target4normal
vector targetnormal
float target2factor
vector target2normal
vector target3normal
float targetfactor
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2209

References ACTIVE_ACTIVE, dmg, dmgtime, dmgtime2, EF_LOWPRECISION, effects, func_vectormamamam_findtarget(), func_vectormamamam_init_for_player(), func_vectormamamam_setactive(), g_initforplayer, generic_plat_blocked(), IL_PUSH(), InitializeEntity(), InitMovingBrushTrigger(), INITPRIO_FINDTARGET, ltime, message, message2, nextthink, noise, normalize(), precache_sound(), setblocked, setthink, SUB_NullThink(), target2factor, target2normal, target3factor, target3normal, target4factor, target4normal, targetfactor, targetnormal, and time.

Variable Documentation

◆ target2factor

float target2factor

Definition at line 6 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ target2normal

vector target2normal

Definition at line 7 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ target3factor

float target3factor

Definition at line 6 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ target3normal

vector target3normal

Definition at line 7 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ target4factor

float target4factor

Definition at line 6 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ target4normal

vector target4normal

Definition at line 7 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ targetfactor

float targetfactor

Definition at line 6 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ targetnormal

vector targetnormal

Definition at line 7 of file vectormamamam.qc.

Referenced by spawnfunc().

◆ wp00

◆ wp01

entity wp01

Definition at line 4 of file vectormamamam.qc.

Referenced by func_vectormamamam_findtarget().

◆ wp02

entity wp02

Definition at line 4 of file vectormamamam.qc.

Referenced by func_vectormamamam_findtarget().

◆ wp03

entity wp03

Definition at line 4 of file vectormamamam.qc.

Referenced by func_vectormamamam_findtarget().