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

Go to the source code of this file.

Functions

 spawnfunc (target_give)
void target_give_use (entity this, entity actor, entity trigger)

Function Documentation

◆ spawnfunc()

spawnfunc ( target_give )

Definition at line 33 of file give.qc.

34{
35 this.use = target_give_use;
36}
#define use
void target_give_use(entity this, entity actor, entity trigger)
Definition give.qc:6

References target_give_use(), and use.

◆ target_give_use()

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

Definition at line 6 of file give.qc.

7{
8 if (!IS_PLAYER(actor) || IS_DEAD(actor))
9 return;
10
11 IL_EACH(g_items, it.targetname == this.target,
12 {
13 // Q3 calls the item's touch func then disables respawn, probably not a good idea here.
14 if (it.itemdef)
15 {
16 if (!ITEM_HANDLE(Pickup, it.itemdef, it, actor))
17 continue;
18 int ch = (it.itemdef.instanceOfPowerup && it.itemdef.m_itemid != IT_RESOURCE) ? CH_TRIGGER_SINGLE : CH_TRIGGER;
19 _sound(actor, ch, it.item_pickupsound, VOL_BASE, ATTEN_NORM);
20 }
21 else if (it.buffdef)
22 {
23 if (!GiveBuff(actor, it.buffdef, OP_PLUS, it.buffs_finished ? it.buffs_finished : it.buffdef.m_time(it.buffdef)))
24 continue;
25 sound(actor, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
26 }
27
28 if (it.target != "" && it.target != "###item###") // q3compat
29 SUB_UseTargets(it, actor, trigger);
30 });
31}
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
#define IL_EACH(this, cond, body)
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
IntrusiveList g_items
Definition items.qh:119
if(frag_attacker.flagcarried)
Definition sv_ctf.qc:2325

References entity(), g_items, if(), IL_EACH, IS_DEAD, IS_PLAYER, and SUB_UseTargets().

Referenced by spawnfunc().