func_breakable

func_breakable #

TWHL

New parameters #

  • Most of spawnobject values are compatible with those in Sven Co-op.
  • Relative to attack option is now working as intended (was buggy in Half-Life).
  • HUD Info name - name to display when player is looking at this breakable. Requires Show HUD Info spawnflag.
  • Switch to alternate texture - switch the textures (from +0 to +A variant or vice-versa) on the brush model when half or less health has left. This allows to simulate the half-broken materials (e.g. cracked glass).
  • Spark When Hit - allow spark effect when the breakable is hit, even if material is not a Computer.

New spawnflags #

  • Show HUD Info - whether to show HUD info for players looking at this breakable. This is not affected by mp_allowmonsterinfo and sp_allowmonsterinfo cvars.
  • Explosive Only - make the breakable immune to any non-explosive damage.
  • Op4Mortar only - make the breakable resistant to anything besides op4mortar shells.
  • Not solid - make breakable non-solid (can be destroyed only with trigger).
  • Smoke trails on gibs - add gray particle trails on gibs (using the default effect from the engine).
  • Transparent gibs - make gibs semi-transparent.

Calc Ratio #

Reports the health / max health fraction.

Soundscripts #

When the breakable gets hit (depending on the material):

  • Breakable.Computer - computer.
  • Breakable.Concrete - concrete or rocks.
  • Breakable.Flesh - flesh.
  • Breakable.Glass - glass.
  • Breakable.Metal - metal.
  • Breakable.Wood - wood.

In addition to the breakable sound the material sound of the texture is also playing (with decreased volume).

Changing the breakable hit soundscripts globally also affects the sounds produced by gibs spawned via env_shooter.

When the breakable gets destroyed (depending on the material):

  • Breakable.BustCeiling - ceiling tile.
  • Breakable.BustConcrete - concrete (cinder block).
  • Breakable.BustComputer - computer. By default it’s the same as Breakable.BustMetal.
  • Breakable.BustFlesh - flesh.
  • Breakable.BustGlass - glass.
  • Breakable.BustMetal - metal.
  • Breakable.BustRocks - rocks. By default it’s the same as Breakable.BustConcrete.
  • Breakable.BustWood - wood.

Other soundscripts:

  • Breakable.Spark - the spark sound to play along with the spark sprite effect. Derived from Material.Spark.

Bugfixes #

  • Fixed func_breakable taking damage from some attacks even if Only Trigger spawnflag is set (original Half-Life bug).

Entity template examples #

The take damage rules that emulate entity’s native ones. Could be used as a starting point for further changes.

{
    "func_breakable": {
        "take_damage": [
            {
                "conditions": {
                    "dmg_type": "club"
                },
                "modifier": {
                    "dmg": "*2"
                }
            },
            {
                "conditions": {
                    "dmg_type": "poison"
                },
                "modifier": {
                    "dmg": "*0.1"
                }
            }
        ]
    }
}

The func_breakable belonging to the following entity template will take damage from shockroach projectiles only.

{
    "shockable_breakable": {
        "take_damage": [
            {
                "conditions": {
                    "inflictor": {
                        "classname": "shock_beam",
                        "negate": true
                    }
                },
                "modifier": {
                    "skip_damage": true
                }
            }
        ]
    }
}