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

Go to the source code of this file.

Functions

void func_rotating_init_for_player (entity this, entity player)
void func_rotating_reset (entity this)
void func_rotating_setactive (entity this, int astate)
 spawnfunc (func_rotating)

Function Documentation

◆ func_rotating_init_for_player()

void func_rotating_init_for_player ( entity this,
entity player )

Definition at line 45 of file rotating.qc.

46{
47 if (this.noise && this.noise != "" && this.active == ACTIVE_ACTIVE && IS_REAL_CLIENT(player))
48 {
49 msg_entity = player;
51 }
52}
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
float MSG_ONE
Definition menudefs.qc:56
entity msg_entity
Definition progsdefs.qc:63
const float VOL_BASE
Definition sound.qh:36
const int CH_AMBIENT_SINGLE
Definition sound.qh:25
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_AMBIENT_SINGLE, entity(), IS_REAL_CLIENT, msg_entity, MSG_ONE, noise, soundto(), and VOL_BASE.

Referenced by spawnfunc().

◆ func_rotating_reset()

void func_rotating_reset ( entity this)

Definition at line 31 of file rotating.qc.

32{
33 // TODO: reset angles as well?
34
36 {
37 this.setactive(this, ACTIVE_NOT);
38 }
39 else
40 {
41 this.setactive(this, ACTIVE_ACTIVE);
42 }
43}
int spawnflags
Definition ammo.qh:15
const int ACTIVE_NOT
Definition defs.qh:36
const int FUNC_ROTATING_STARTOFF
Definition rotating.qh:6

References ACTIVE_ACTIVE, ACTIVE_NOT, entity(), FUNC_ROTATING_STARTOFF, and spawnflags.

Referenced by spawnfunc().

◆ func_rotating_setactive()

void func_rotating_setactive ( entity this,
int astate )

Definition at line 4 of file rotating.qc.

5{
6 if (astate == ACTIVE_TOGGLE)
7 {
8 if(this.active == ACTIVE_ACTIVE)
9 this.active = ACTIVE_NOT;
10 else
11 this.active = ACTIVE_ACTIVE;
12 }
13 else
14 this.active = astate;
15
16 if(this.active == ACTIVE_NOT)
17 {
18 this.avelocity = '0 0 0';
20 }
21 else
22 {
23 this.avelocity = this.pos1;
24 if(this.noise && this.noise != "")
25 {
27 }
28 }
29}
vector avelocity
const int ACTIVE_TOGGLE
Definition defs.qh:40
#define _sound(e, c, s, v, a)
Definition sound.qh:43
void stopsound(entity e, int chan)
Definition all.qc:109
vector pos1
Definition subs.qh:50

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

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( func_rotating )

Definition at line 62 of file rotating.qc.

63{
64 if (this.noise && this.noise != "")
65 {
67 }
68
69 this.setactive = func_rotating_setactive;
70
71 if (!this.speed)
72 this.speed = 100;
74 this.avelocity = '0 0 1' * this.speed;
75 else if (this.spawnflags & FUNC_ROTATING_YAXIS)
76 this.avelocity = '1 0 0' * this.speed;
77 else // Z
78 this.avelocity = '0 1 0' * this.speed;
79
80 this.pos1 = this.avelocity;
81
82 if(this.dmg && (this.message == ""))
83 this.message = " was squished";
84 if(this.dmg && (this.message2 == ""))
85 this.message2 = "was squished by";
86
87
88 if(this.dmg && (!this.dmgtime))
89 this.dmgtime = 0.25;
90
91 this.dmgtime2 = time;
92
93 if (!InitMovingBrushTrigger(this))
94 return;
95 // no EF_LOWPRECISION here, as rounding angles is bad
96
98
99 // wait for targets to spawn
100 this.nextthink = this.ltime + 999999999;
101 setthink(this, SUB_NullThink); // for PushMove
102
103 this.reset = func_rotating_reset;
104 this.reset(this);
105
106 // maybe send sound to new players
108 this.init_for_player = func_rotating_init_for_player;
109}
float dmg
Definition breakable.qc:12
string message
Definition powerups.qc:19
float time
float nextthink
float speed
Definition dynlight.qc:9
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
string precache_sound(string sample)
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
void func_rotating_setactive(entity this, int astate)
Definition rotating.qc:4
void func_rotating_init_for_player(entity this, entity player)
Definition rotating.qc:45
void func_rotating_reset(entity this)
Definition rotating.qc:31
const int FUNC_ROTATING_XAXIS
Definition rotating.qh:4
const int FUNC_ROTATING_YAXIS
Definition rotating.qh:5
#define setthink(e, f)
#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

References avelocity, dmg, dmgtime, dmgtime2, func_rotating_init_for_player(), func_rotating_reset(), func_rotating_setactive(), FUNC_ROTATING_XAXIS, FUNC_ROTATING_YAXIS, g_initforplayer, generic_plat_blocked(), IL_PUSH(), InitMovingBrushTrigger(), ltime, message, message2, nextthink, noise, pos1, precache_sound(), setblocked, setthink, spawnflags, speed, SUB_NullThink(), and time.