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

Go to the source code of this file.

Functions

void multivibrator_reset (entity this)
void multivibrator_send (entity this)
void multivibrator_send_think (entity this)
void multivibrator_toggle (entity this, entity actor, entity trigger)
 spawnfunc (trigger_multivibrator)

Function Documentation

◆ multivibrator_reset()

void multivibrator_reset ( entity this)

Definition at line 41 of file multivibrator.qc.

42{
43 if(!(this.spawnflags & START_ENABLED))
44 this.nextthink = 0; // wait for a trigger event
45 else
46 this.nextthink = max(1, time);
47}
int spawnflags
Definition ammo.qh:15
float time
float nextthink
const int START_ENABLED
Definition defs.qh:6
float max(float f,...)

References entity(), max(), nextthink, spawnflags, START_ENABLED, and time.

Referenced by spawnfunc().

◆ multivibrator_send()

void multivibrator_send ( entity this)

Definition at line 3 of file multivibrator.qc.

4{
5 float cyclestart = floor((time + this.phase) / (this.wait + this.respawntime)) * (this.wait + this.respawntime) - this.phase;
6
7 float newstate = (time < cyclestart + this.wait);
8
9 if(this.state != newstate)
10 SUB_UseTargets(this, this, NULL);
11 this.state = newstate;
12
13 if(this.state)
14 this.nextthink = cyclestart + this.wait + 0.01;
15 else
16 this.nextthink = cyclestart + this.wait + this.respawntime + 0.01;
17}
float wait
Definition items.qc:17
int state
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
float floor(float f)
float phase
Definition platforms.qh:10
#define NULL
Definition post.qh:14
float respawntime
Definition items.qh:31

References entity(), floor(), nextthink, NULL, phase, respawntime, state, SUB_UseTargets(), time, and wait.

Referenced by multivibrator_send_think(), and multivibrator_toggle().

◆ multivibrator_send_think()

void multivibrator_send_think ( entity this)

Definition at line 19 of file multivibrator.qc.

20{
22}
void multivibrator_send(entity this)

References entity(), and multivibrator_send().

Referenced by spawnfunc().

◆ multivibrator_toggle()

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

Definition at line 24 of file multivibrator.qc.

25{
26 if(this.nextthink == 0)
27 {
29 }
30 else
31 {
32 if(this.state)
33 {
34 SUB_UseTargets(this, actor, trigger);
35 this.state = 0;
36 }
37 this.nextthink = 0;
38 }
39}

References entity(), multivibrator_send(), nextthink, state, and SUB_UseTargets().

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( trigger_multivibrator )

Definition at line 60 of file multivibrator.qc.

61{
62 if(!this.wait)
63 this.wait = 1;
64 if(!this.respawntime)
65 this.respawntime = this.wait;
66
67 this.state = 0;
70 this.nextthink = max(1, time);
71
72 if(this.targetname && this.targetname != "")
74}
#define use
void multivibrator_reset(entity this)
void multivibrator_toggle(entity this, entity actor, entity trigger)
void multivibrator_send_think(entity this)
#define setthink(e, f)
string targetname
Definition triggers.qh:56

References max(), multivibrator_reset(), multivibrator_send_think(), multivibrator_toggle(), nextthink, respawntime, setthink, state, targetname, time, use, and wait.