Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
magnet.qc
Go to the documentation of this file.
1#include "magnet.qh"
2
3#ifdef SVQC
5{
6 return (e.itemdef // this (intentionally) doesn't include buffs -- they use .buffdef not .itemdef
7 && gettouch(e));
8}
9METHOD(MagnetBuff, m_tick, void(StatusEffect this, entity actor))
10{
11 SUPER(MagnetBuff).m_tick(this, actor);
12 if(!this.m_active(this, actor))
13 return;
14 if (IS_PLAYER(actor))
15 {
17 actor.origin + actor.view_ofs, // line from eyes
19 MOVE_NOMONSTERS, // require line of sight
21 for (; head; head = next)
22 {
23 next = head.chain; // save next entity in case head is deleted (or head.chain changed) by gettouch(head)
24 gettouch(head)(head, actor);
25 }
26 }
27
28 vector vel = randomvec() * 75;
29 buff_Effect(actor, EFFECT_MAGNET, CENTER_OF_ENT(actor) - vel, vel, 1, true); // needs countabsolute 1, spawning more requires calling buff_Effect repeatedly but that uses more bandwidth
30}
31#endif // SVQC
32#ifdef MENUQC
33METHOD(MagnetBuff, describe, string(MagnetBuff this))
34{
35 TC(MagnetBuff, this);
37 PAR(_("The %s buff increases your item pickup range, collecting nearby items for you while the buff is active."), COLORED_NAME(this));
38 return PAGE_TEXT;
39}
40#endif // MENUQC
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
#define IS_PLAYER(s)
Definition player.qh:242
#define CENTER_OF_ENT(ent)
Definition util.qh:10
const float MOVE_NOMONSTERS
next
Definition all.qh:75
#define TC(T, sym)
Definition _all.inc:82
entity WarpZone_SearchInRadius(vector org, float rad, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
Definition common.qc:680
bool buff_Magnet_cond(entity e)
Definition magnet.qc:4
float autocvar_g_buffs_magnet_range
Definition magnet.qh:6
vector randomvec(void)
#define SUPER(cname)
Definition oo.qh:236
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define gettouch(e)
Definition self.qh:78
vector
Definition self.qh:96
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
void buff_Effect(entity player, entity eff, vector eff_loc, vector eff_vel, int eff_cnt, bool hide)
Spawn effects on a player with a buff.
Definition sv_buffs.qc:103