16 .float debrismovetype;
18 .vector debrisvelocity;
19 .vector debrisvelocityjitter;
20 .vector debrisavelocityjitter;
22 .float debristimejitter;
23 .float debrisfadetime;
24 .float debrisdamageforcescale;
51 void LaunchDebris (
entity this,
string debrisname,
vector force)
59 _setmodel (dbr, debrisname );
60 dbr.skin = this.debrisskin;
64 dbr.solid = this.debrissolid;
66 setsize(dbr,
'0 0 0',
'0 0 0');
67 dbr.velocity_x = this.debrisvelocity.x + this.debrisvelocityjitter.x *
crandom();
68 dbr.velocity_y = this.debrisvelocity.y + this.debrisvelocityjitter.y *
crandom();
69 dbr.velocity_z = this.debrisvelocity.z + this.debrisvelocityjitter.z *
crandom();
70 dbr.velocity = dbr.velocity + force * this.debrisdamageforcescale;
72 dbr.avelocity_x =
random()*this.debrisavelocityjitter.x;
73 dbr.avelocity_y =
random()*this.debrisavelocityjitter.y;
74 dbr.avelocity_z =
random()*this.debrisavelocityjitter.z;
75 dbr.damageforcescale = this.debrisdamageforcescale;
76 if(dbr.damageforcescale)
81 void func_breakable_colormod(
entity this)
90 this.
colormod =
'1 0 0' +
'0 1 0' * (2 * h - 0.5);
95 void func_breakable_look_destroyed(
entity this)
105 if (this.
origin ==
'0 0 0') {
108 this.origin_z = floorZ;
111 ApplyMinMaxScaleAngles(
this);
118 void func_breakable_look_restore(
entity this)
120 _setmodel(
this, this.mdl);
121 ApplyMinMaxScaleAngles(
this);
130 void func_breakable_behave_destroyed(
entity this)
141 func_breakable_colormod(
this);
151 void func_breakable_think(
entity this)
154 CSQCMODEL_AUTOUPDATE(
this);
158 void func_breakable_behave_restore(
entity this)
172 this.event_damage = func_breakable_damage;
175 this.
use = func_breakable_destroy;
178 setthink(
this, func_breakable_think);
180 func_breakable_colormod(
this);
185 void func_breakable_init_for_player(
entity this,
entity player)
194 void func_breakable_destroyed(
entity this)
196 func_breakable_look_destroyed(
this);
197 func_breakable_behave_destroyed(
this);
202 func_breakable_look_restore(
this);
203 func_breakable_behave_restore(
this);
206 void func_breakable_restore_self(
entity this)
218 func_breakable_restore(
this,
NULL,
NULL);
232 for(i = 0; i < n; ++i)
233 LaunchDebris(
this,
argv(i), debrisforce);
235 func_breakable_destroyed(
this);
241 RadiusDamage(
this, act, this.
dmg, this.
dmg_edge, this.
dmg_radius,
this,
NULL, this.
dmg_force, DEATH_HURTTRIGGER.m_id,
DMG_NOWEP,
NULL);
248 CSQCMODEL_AUTOUPDATE(
this);
249 setthink(
this, func_breakable_restore_self);
259 void func_breakable_destroy_self(
entity this)
261 func_breakable_destroy(
this,
NULL,
NULL);
272 if(attacker.team ==
this.team)
278 WaypointSprite_Ping(this.
sprite);
281 func_breakable_colormod(
this);
292 this.
owner = attacker;
299 CSQCMODEL_AUTOUPDATE(
this);
300 setthink(
this, func_breakable_destroy_self);
304 void func_breakable_reset(
entity this)
307 func_breakable_look_restore(
this);
309 func_breakable_behave_destroyed(
this);
311 func_breakable_behave_restore(
this);
314 void func_breakable_setup(
entity this)
323 if(!this.debrissolid) this.debrissolid =
SOLID_NOT;
324 if(this.debrisvelocity ==
'0 0 0') this.debrisvelocity =
'0 0 140';
325 if(this.debrisvelocityjitter ==
'0 0 0') this.debrisvelocityjitter =
'70 70 70';
326 if(this.debrisavelocityjitter ==
'0 0 0') this.debrisavelocityjitter =
'600 600 600';
327 if(!this.debristime) this.debristime = 3.5;
328 if(!this.debristimejitter) this.debristime = 2.5;
331 this.
cnt = _particleeffectnum(this.mdl);
336 this.
message =
"got too close to an explosion";
337 if(this.message2 ==
"")
338 this.message2 =
"was pushed into an explosion by";
344 this.mdl = this.
model;
345 SetBrushEntityModel(
this,
true);
348 this.
use = func_breakable_destroy;
350 this.
use = func_breakable_restore;
363 for(i = 0; i < n; ++i)
364 precache_model(
argv(i));
374 this.reset = func_breakable_reset;
378 this.init_for_player = func_breakable_init_for_player;
380 CSQCMODEL_AUTOINIT(
this);
384 spawnfunc(misc_breakablemodel) { func_breakable_setup(
this); }
387 spawnfunc(func_breakable) { func_breakable_setup(
this); }
const int HITTYPE_SPLASH
automatically set by RadiusDamage
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
#define IL_EACH(this, cond, body)
const int BREAKABLE_INDICATE_DAMAGE
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void SUB_UseTargets(entity this, entity actor, entity trigger)
spawnfunc(info_player_attacker)
IntrusiveList g_initforplayer
IntrusiveList g_bot_targets
#define IS_REAL_CLIENT(v)
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
const int BREAKABLE_NODAMAGE
#define crandom()
Returns a random number between -1.0 and 1.0.
const int CH_TRIGGER_SINGLE
vector(float skel, float bonenum) _skel_get_boneabs_hidden
IntrusiveList g_projectiles
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define _sound(e, c, s, v, a)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
IntrusiveList g_saved_team
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
#define DEATH_ISSPECIAL(t)
void set_movetype(entity this, int mt)