Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
rotating.qc
Go to the documentation of this file.
1#include "rotating.qh"
2#ifdef SVQC
3
4void func_rotating_setactive(entity this, int astate)
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}
30
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}
44
46{
47 if (this.noise && this.noise != "" && this.active == ACTIVE_ACTIVE && IS_REAL_CLIENT(player))
48 {
49 msg_entity = player;
51 }
52}
53
54/*QUAKED spawnfunc_func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
55Brush model that spins in place on one axis (default Z).
56speed : speed to rotate (in degrees per second)
57noise : path/name of looping .wav file to play.
58dmg : Do this much damage every .dmgtime interval when blocked
59dmgtime : See above.
60*/
61
62spawnfunc(func_rotating)
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}
110#endif
float dmg
Definition breakable.qc:12
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string message
Definition powerups.qc:19
int spawnflags
Definition ammo.qh:15
vector avelocity
float time
float nextthink
const int ACTIVE_TOGGLE
Definition defs.qh:40
const int ACTIVE_NOT
Definition defs.qh:36
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
float speed
Definition dynlight.qc:9
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float MSG_ONE
Definition menudefs.qc:56
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
entity msg_entity
Definition progsdefs.qc:63
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_STARTOFF
Definition rotating.qh:6
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
const float VOL_BASE
Definition sound.qh:36
const int CH_AMBIENT_SINGLE
Definition sound.qh:25
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_IDLE
Definition sound.qh:32
void stopsound(entity e, int chan)
Definition all.qc:109
void soundto(int _dest, entity e, int chan, string samp, float vol, float _atten, float _pitch)
Definition all.qc:74
#define spawnfunc(id)
Definition spawnfunc.qh:96
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577
void SUB_NullThink(entity this)
Definition subs.qc:3
string noise
Definition subs.qh:83
vector pos1
Definition subs.qh:50
string message2
Definition triggers.qh:19
#define IS_REAL_CLIENT(v)
Definition utils.qh:17