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

Go to the source code of this file.

Functions

void func_breakable_setup (entity this)

Variables

const int BREAKABLE_INDICATE_DAMAGE = BIT(1)
const int BREAKABLE_NODAMAGE = BIT(2)
const int STATE_ALIVE = 0
const int STATE_BROKEN = 1

Function Documentation

◆ func_breakable_setup()

void func_breakable_setup ( entity this)

Definition at line 317 of file breakable.qc.

318{
319 float n, i;
320 if(!GetResource(this, RES_HEALTH))
321 SetResourceExplicit(this, RES_HEALTH, 100);
322 this.max_health = GetResource(this, RES_HEALTH);
323
324 // yes, I know, MOVETYPE_NONE is not available here, not that one would want it here anyway
326 if(!this.debrissolid) this.debrissolid = SOLID_NOT;
327 if(this.debrisvelocity == '0 0 0') this.debrisvelocity = '0 0 140';
328 if(this.debrisvelocityjitter == '0 0 0') this.debrisvelocityjitter = '70 70 70';
329 if(this.debrisavelocityjitter == '0 0 0') this.debrisavelocityjitter = '600 600 600';
330 if(!this.debristime) this.debristime = 3.5;
331 if(!this.debristimejitter) this.debristime = 2.5;
332
333 if(this.mdl != "")
334 this.cnt = _particleeffectnum(this.mdl);
335 if(this.count == 0)
336 this.count = 1;
337
338 if(this.message == "")
339 this.message = "got too close to an explosion";
340 if(this.message2 == "")
341 this.message2 = "was pushed into an explosion by";
342 if(!this.dmg_radius)
343 this.dmg_radius = 150;
344 if(!this.dmg_force)
345 this.dmg_force = 200;
346
347 this.mdl = this.model;
348 SetBrushEntityModel(this, true);
349
352 else
354
356 {
357 this.takedamage = DAMAGE_NO;
358 this.event_damage = func_null;
359 this.bot_attack = false;
360 this.monster_attack = false;
361 }
362
363 // precache all the models
364 if (this.mdl_dead)
365 precache_model(this.mdl_dead);
366 n = tokenize_console(this.debris);
367 for(i = 0; i < n; ++i)
368 precache_model(argv(i));
369 if(this.noise)
370 precache_sound(this.noise);
371 if(this.noise1)
373
374 this.team_saved = this.team;
375 IL_PUSH(g_saved_team, this);
376 this.dropped_origin = this.origin;
377
378 this.reset = func_breakable_reset;
379 this.reset(this);
380
381 if(this.monster_attack)
383
385 this.init_for_player = func_breakable_init_for_player;
386
387 CSQCMODEL_AUTOINIT(this);
388}
float bot_attack
Definition api.qh:38
float dmg_force
Definition breakable.qc:15
string mdl_dead
Definition breakable.qc:27
void func_breakable_init_for_player(entity this, entity player)
Definition breakable.qc:188
float debrissolid
Definition breakable.qc:17
vector debrisvelocityjitter
Definition breakable.qc:19
string debris
Definition breakable.qc:28
float debristimejitter
Definition breakable.qc:22
vector debrisavelocityjitter
Definition breakable.qc:20
void func_breakable_destroy(entity this, entity actor, entity trigger)
Definition breakable.qc:225
float debrismovetype
Definition breakable.qc:16
void func_breakable_reset(entity this)
Definition breakable.qc:307
float dmg_radius
Definition breakable.qc:14
void func_breakable_restore(entity this, entity actor, entity trigger)
Definition breakable.qc:203
vector debrisvelocity
Definition breakable.qc:18
float debristime
Definition breakable.qc:21
const int BREAKABLE_NODAMAGE
Definition breakable.qh:5
float max_health
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float cnt
Definition powerups.qc:24
string message
Definition powerups.qc:19
float count
Definition powerups.qc:22
int team
Definition main.qh:188
int spawnflags
Definition ammo.qh:15
string mdl
Definition item.qh:89
const float SOLID_NOT
vector origin
#define use
#define CSQCMODEL_AUTOINIT(e)
#define tokenize_console
model
Definition ent_cs.qc:139
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
string precache_sound(string sample)
string argv(float n)
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
var void func_null()
IntrusiveList g_initforplayer
Definition client.qh:370
IntrusiveList g_saved_team
Definition vote.qh:79
int team_saved
Definition vote.qh:70
void SetBrushEntityModel(entity this, bool with_lod)
Definition subs.qc:420
string noise
Definition subs.qh:83
string noise1
Definition subs.qh:83
const int DAMAGE_NO
Definition subs.qh:79
float takedamage
Definition subs.qh:78
bool monster_attack
IntrusiveList g_monster_targets
string message2
Definition triggers.qh:19
vector dropped_origin
Definition world.qh:154

References argv(), bot_attack, BREAKABLE_NODAMAGE, cnt, count, CSQCMODEL_AUTOINIT, DAMAGE_NO, debris, debrisavelocityjitter, debrismovetype, debrissolid, debristime, debristimejitter, debrisvelocity, debrisvelocityjitter, dmg_force, dmg_radius, dropped_origin, entity(), func_breakable_destroy(), func_breakable_init_for_player(), func_breakable_reset(), func_breakable_restore(), func_null(), g_initforplayer, g_monster_targets, g_saved_team, GetResource(), IL_PUSH(), max_health, mdl, mdl_dead, message, message2, model, monster_attack, MOVETYPE_BOUNCE, noise, noise1, origin, precache_sound(), SetBrushEntityModel(), SetResourceExplicit(), SOLID_NOT, spawnflags, takedamage, team, team_saved, tokenize_console, and use.

Referenced by CheatCommand(), spawnfunc(), spawnfunc(), and spawnfunc().

Variable Documentation

◆ BREAKABLE_INDICATE_DAMAGE

const int BREAKABLE_INDICATE_DAMAGE = BIT(1)

Definition at line 4 of file breakable.qh.

Referenced by func_breakable_colormod().

◆ BREAKABLE_NODAMAGE

const int BREAKABLE_NODAMAGE = BIT(2)

◆ STATE_ALIVE

const int STATE_ALIVE = 0

Definition at line 7 of file breakable.qh.

Referenced by func_breakable_behave_restore(), and func_breakable_init_for_player().

◆ STATE_BROKEN

const int STATE_BROKEN = 1

Definition at line 8 of file breakable.qh.

Referenced by func_breakable_behave_destroyed(), and func_breakable_damage().