// target = targets to trigger when broken
// health = amount of damage it can take
// spawnflags:
-// 1 = start disabled (needs to be triggered to activate)
-// 2 = indicate damage
-// 4 = don't take direct damage (needs to be triggered to 'explode', then triggered again to restore)
+// BREAKABLE_START_DISABLED: needs to be triggered to activate
+// BREAKABLE_INDICATE_DAMAGE: indicate damage
+// BREAKABLE_NODAMAGE: don't take direct damage (needs to be triggered to 'explode', then triggered again to restore)
+// NOSPLASH: don't take splash damage
// notes:
// for mdl_dead to work, origin must be set (using a common/origin brush).
// Otherwise mdl_dead will be displayed at the map origin, and nobody would
void func_breakable_colormod(entity this)
{
float h;
- if (!(this.spawnflags & 2))
+ if (!(this.spawnflags & BREAKABLE_INDICATE_DAMAGE))
return;
h = this.health / this.max_health;
if(h < 0.25)
this.bot_attack = false;
this.event_damage = func_null;
this.state = 1;
- if(this.spawnflags & 4)
+ if(this.spawnflags & BREAKABLE_NODAMAGE)
this.use = func_null;
func_breakable_colormod(this);
if (this.noise1)
WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
WaypointSprite_UpdateHealth(this.sprite, this.health);
}
- if(!(this.spawnflags & 4))
+ if(!(this.spawnflags & BREAKABLE_NODAMAGE))
{
this.takedamage = DAMAGE_AIM;
if(!this.bot_attack)
this.bot_attack = true;
this.event_damage = func_breakable_damage;
}
- if(this.spawnflags & 4)
+ if(this.spawnflags & BREAKABLE_NODAMAGE)
this.use = func_breakable_destroy; // don't need to set it usually, as .use isn't reset
this.state = 0;
//this.nextthink = 0; // cancel auto respawn
{
if(this.state == 1)
return;
- if(this.spawnflags & DOOR_NOSPLASH)
+ if(this.spawnflags & NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
if(this.team)
{
this.team = this.team_saved;
func_breakable_look_restore(this);
- if(this.spawnflags & 1)
+ if(this.spawnflags & BREAKABLE_START_DISABLED)
func_breakable_behave_destroyed(this);
else
func_breakable_behave_restore(this);
this.mdl = this.model;
SetBrushEntityModel(this);
- if(this.spawnflags & 4)
+ if(this.spawnflags & BREAKABLE_NODAMAGE)
this.use = func_breakable_destroy;
else
this.use = func_breakable_restore;
- if(this.spawnflags & 4)
+ if(this.spawnflags & BREAKABLE_NODAMAGE)
{
this.takedamage = DAMAGE_NO;
this.event_damage = func_null;
#pragma once
+// generic usage
+const int NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag
+
// bobbing
const int BOBBING_XAXIS = BIT(0);
const int BOBBING_YAXIS = BIT(1);
+// breakable
+const int BREAKABLE_START_DISABLED = BIT(0);
+const int BREAKABLE_INDICATE_DAMAGE = BIT(1);
+const int BREAKABLE_NODAMAGE = BIT(2);
+
// button
const int BUTTON_DONTACCUMULATEDMG = BIT(7);
const int SPAWNFLAGS_SILVER_KEY = BIT(4); // Quake 1 compat, can only be used with func_door!
const int DOOR_TOGGLE = BIT(5);
-const int DOOR_NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag
-
const int DOOR_NONSOLID = BIT(10);
const int DOOR_CRUSH = BIT(11); // can't use PLAT_CRUSH cause that is the same as DOOR_DONT_LINK