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

Go to the source code of this file.

Functions

bool M_Spider_Attack (int attack_type, entity actor, entity targ,.entity weaponentity)
void M_Spider_Attack_Web (entity this)
void M_Spider_Attack_Web_Explode (entity this)
void M_Spider_Attack_Web_Explode_use (entity this, entity actor, entity trigger)
void M_Spider_Attack_Web_Touch (entity this, entity toucher)
 MUTATOR_HOOKFUNCTION (spiderweb, MonsterMove)
 MUTATOR_HOOKFUNCTION (spiderweb, PlayerPhysics_UpdateStats)
 REGISTER_MUTATOR (spiderweb, true)
 SOUND (SpiderAttack_FIRE, W_Sound("electro_fire2"))
 spawnfunc (monster_spider)

Variables

float autocvar_g_monster_spider_attack_bite_damage
float autocvar_g_monster_spider_attack_bite_delay
float autocvar_g_monster_spider_attack_web_damagetime
float autocvar_g_monster_spider_attack_web_delay
float autocvar_g_monster_spider_attack_web_range = 800
float autocvar_g_monster_spider_attack_web_speed
float autocvar_g_monster_spider_attack_web_speed_up
float autocvar_g_monster_spider_damageforcescale = 0.6
float autocvar_g_monster_spider_health
string autocvar_g_monster_spider_loot = "health_medium"
float autocvar_g_monster_spider_speed_run
float autocvar_g_monster_spider_speed_stop
float autocvar_g_monster_spider_speed_walk
float spider_web_delay

Function Documentation

◆ M_Spider_Attack()

bool M_Spider_Attack ( int attack_type,
entity actor,
entity targ,
.entity weaponentity )

Definition at line 148 of file spider.qc.

149{
150 Weapon wep = WEP_SPIDER_ATTACK;
151 switch(attack_type)
152 {
154 {
155 wep.wr_think(wep, actor, weaponentity, 2);
156 return true;
157 }
159 {
160 if(vdist(actor.enemy.origin - actor.origin, <=, autocvar_g_monster_spider_attack_web_range))
161 {
162 wep.wr_think(wep, actor, weaponentity, 1);
163 return true;
164 }
165 }
166 }
167
168 return false;
169}
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
virtual void wr_think()
(SERVER) logic to run every frame
Definition weapon.qh:90
float autocvar_g_monster_spider_attack_web_range
Definition spider.qc:17
const int MONSTER_ATTACK_MELEE
const int MONSTER_ATTACK_RANGED
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References autocvar_g_monster_spider_attack_web_range, entity(), MONSTER_ATTACK_MELEE, MONSTER_ATTACK_RANGED, vdist, and Weapon::wr_think().

◆ M_Spider_Attack_Web()

void M_Spider_Attack_Web ( entity this)

Definition at line 110 of file spider.qc.

111{
112 sound(this, CH_SHOTS, SND_SpiderAttack_FIRE, VOL_BASE, ATTEN_NORM);
113
114 entity proj = new(plasma);
115 proj.owner = proj.realowner = this;
118 proj.bot_dodge = true;
119 proj.bot_dodgerating = 0;
120 proj.nextthink = time + 5;
122 proj.projectiledeathtype = DEATH_MONSTER_SPIDER.m_id;
123 setorigin(proj, CENTER_OR_VIEWOFS(this));
124
125 //proj.glow_size = 50;
126 //proj.glow_color = 45;
130 setsize(proj, '-4 -4 -4', '4 4 4');
131 proj.takedamage = DAMAGE_NO;
132 proj.damageforcescale = 0;
133 SetResourceExplicit(proj, RES_HEALTH, 500);
134 proj.event_damage = func_null;
135 proj.flags = FL_PROJECTILE;
136 IL_PUSH(g_projectiles, proj);
137 IL_PUSH(g_bot_dodge, proj);
138 proj.damagedbycontents = true;
140
141 proj.bouncefactor = 0.3;
142 proj.bouncestop = 0.05;
143 proj.missile_flags = MIF_SPLASH | MIF_ARC;
144
145 CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true);
146}
IntrusiveList g_bot_dodge
Definition api.qh:150
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
const int FL_PROJECTILE
Definition constants.qh:85
vector v_up
float time
vector v_forward
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
IntrusiveList g_damagedbycontents
Definition damage.qh:135
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
var void func_null()
const int PROJECTILE_ELECTRO
Definition projectiles.qh:3
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:73
void adaptor_think2use_hittype_splash(entity this)
Definition common.qc:106
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
const int MIF_ARC
Definition common.qh:47
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger)
Definition spider.qc:98
float autocvar_g_monster_spider_attack_web_speed
Definition spider.qc:14
void M_Spider_Attack_Web_Touch(entity this, entity toucher)
Definition spider.qc:103
float autocvar_g_monster_spider_attack_web_speed_up
Definition spider.qc:15
const int DAMAGE_NO
Definition subs.qh:79
void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
Definition tracing.qc:192
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:29

References adaptor_think2use_hittype_splash(), ATTEN_NORM, autocvar_g_monster_spider_attack_web_speed, autocvar_g_monster_spider_attack_web_speed_up, CENTER_OR_VIEWOFS, CH_SHOTS, CSQCProjectile(), DAMAGE_NO, entity(), FL_PROJECTILE, func_null(), g_bot_dodge, g_damagedbycontents, g_projectiles, IL_PUSH(), M_Spider_Attack_Web_Explode_use(), M_Spider_Attack_Web_Touch(), MIF_ARC, MIF_SPLASH, MOVETYPE_BOUNCE, PROJECTILE_ELECTRO, PROJECTILE_MAKETRIGGER, set_movetype(), SetResourceExplicit(), setthink, settouch, sound, time, v_forward, v_up, VOL_BASE, and W_SetupProjVelocity_Explicit().

◆ M_Spider_Attack_Web_Explode()

void M_Spider_Attack_Web_Explode ( entity this)

Definition at line 82 of file spider.qc.

83{
84 if(this)
85 {
86 Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
87 RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, DMG_NOWEP, NULL);
88
89 FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResource(it, RES_HEALTH) > 0 && it.monsterdef != MON_SPIDER,
90 {
91 StatusEffects_apply(STATUSEFFECT_Webbed, it, time + autocvar_g_monster_spider_attack_web_damagetime, 0);
92 });
93
94 delete(this);
95 }
96}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define IS_DEAD(s)
Definition player.qh:245
vector origin
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:981
#define DMG_NOWEP
Definition damage.qh:104
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
#define NULL
Definition post.qh:14
int projectiledeathtype
Definition common.qh:21
entity realowner

References DMG_NOWEP, entity(), FOREACH_ENTITY_RADIUS, GetResource(), IS_DEAD, NULL, origin, projectiledeathtype, RadiusDamage(), realowner, and Send_Effect().

Referenced by M_Spider_Attack_Web_Explode_use(), and M_Spider_Attack_Web_Touch().

◆ M_Spider_Attack_Web_Explode_use()

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

Definition at line 98 of file spider.qc.

99{
101}
void M_Spider_Attack_Web_Explode(entity this)
Definition spider.qc:82

References entity(), and M_Spider_Attack_Web_Explode().

Referenced by M_Spider_Attack_Web().

◆ M_Spider_Attack_Web_Touch()

void M_Spider_Attack_Web_Touch ( entity this,
entity toucher )

Definition at line 103 of file spider.qc.

104{
106
108}
entity entity toucher
Definition self.qh:72
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

References entity(), M_Spider_Attack_Web_Explode(), PROJECTILE_TOUCH, and toucher.

Referenced by M_Spider_Attack_Web().

◆ MUTATOR_HOOKFUNCTION() [1/2]

MUTATOR_HOOKFUNCTION ( spiderweb ,
MonsterMove  )

Definition at line 36 of file spider.qc.

37{
38 entity mon = M_ARGV(0, entity);
39
40 if(StatusEffects_active(STATUSEFFECT_Webbed, mon))
41 {
42 M_ARGV(1, float) *= 0.5; // run speed
43 M_ARGV(2, float) *= 0.5; // walk speed
44 }
45}
#define M_ARGV(x, type)
Definition events.qh:17
bool StatusEffects_active(StatusEffect this, entity actor)

References entity(), M_ARGV, and StatusEffects_active().

◆ MUTATOR_HOOKFUNCTION() [2/2]

MUTATOR_HOOKFUNCTION ( spiderweb ,
PlayerPhysics_UpdateStats  )

Definition at line 28 of file spider.qc.

29{
30 entity player = M_ARGV(0, entity);
31
32 if(StatusEffects_active(STATUSEFFECT_Webbed, player))
33 STAT(MOVEVARS_HIGHSPEED, player) *= 0.5;
34}
#define STAT(...)
Definition stats.qh:82

References entity(), M_ARGV, STAT, and StatusEffects_active().

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( spiderweb ,
true  )

◆ SOUND()

SOUND ( SpiderAttack_FIRE ,
W_Sound("electro_fire2")  )

◆ spawnfunc()

spawnfunc ( monster_spider )

Definition at line 171 of file spider.qc.

171{ Monster_Spawn(this, true, MON_SPIDER); }
bool Monster_Spawn(entity this, bool check_appear, Monster mon)

References Monster_Spawn().

Variable Documentation

◆ autocvar_g_monster_spider_attack_bite_damage

float autocvar_g_monster_spider_attack_bite_damage

Definition at line 11 of file spider.qc.

◆ autocvar_g_monster_spider_attack_bite_delay

float autocvar_g_monster_spider_attack_bite_delay

Definition at line 12 of file spider.qc.

◆ autocvar_g_monster_spider_attack_web_damagetime

float autocvar_g_monster_spider_attack_web_damagetime

Definition at line 13 of file spider.qc.

◆ autocvar_g_monster_spider_attack_web_delay

float autocvar_g_monster_spider_attack_web_delay

Definition at line 16 of file spider.qc.

Referenced by SOUND().

◆ autocvar_g_monster_spider_attack_web_range

float autocvar_g_monster_spider_attack_web_range = 800

Definition at line 17 of file spider.qc.

Referenced by M_Spider_Attack().

◆ autocvar_g_monster_spider_attack_web_speed

float autocvar_g_monster_spider_attack_web_speed

Definition at line 14 of file spider.qc.

Referenced by M_Spider_Attack_Web().

◆ autocvar_g_monster_spider_attack_web_speed_up

float autocvar_g_monster_spider_attack_web_speed_up

Definition at line 15 of file spider.qc.

Referenced by M_Spider_Attack_Web().

◆ autocvar_g_monster_spider_damageforcescale

float autocvar_g_monster_spider_damageforcescale = 0.6

Definition at line 10 of file spider.qc.

◆ autocvar_g_monster_spider_health

float autocvar_g_monster_spider_health

Definition at line 8 of file spider.qc.

◆ autocvar_g_monster_spider_loot

string autocvar_g_monster_spider_loot = "health_medium"

Definition at line 9 of file spider.qc.

◆ autocvar_g_monster_spider_speed_run

float autocvar_g_monster_spider_speed_run

Definition at line 19 of file spider.qc.

◆ autocvar_g_monster_spider_speed_stop

float autocvar_g_monster_spider_speed_stop

Definition at line 18 of file spider.qc.

◆ autocvar_g_monster_spider_speed_walk

float autocvar_g_monster_spider_speed_walk

Definition at line 20 of file spider.qc.

◆ spider_web_delay

float spider_web_delay

Definition at line 22 of file spider.qc.