How to DETECT a fire?

I’m new in GLUA coding… And now I’ve stucked on question: how to detect a fire? How to just detect its reaction with, e. g. player, on given position?

What I need is to make all entities ignite when they react with fire., any help?

:words: Some thoughts later…
Now I have question: **how to detect that position vector is inside some entity?
*1. I think that Entity:GetModelBounds() *is not for such purposes, cause I need to find actual model’s collisions.
2. PhysObj:GetAABB() is just box. So if you’ll rotate entity - you’ll get the most unexpected results.
3. Entity:FindInBox() - NO-NO!
4. Radius sux. :v:

:rock: SOLVED! See my last message.

Fire isn’t a default entity. If you have fire on your server, it’s from an addon. Figure out the name of the entity and check if the player is within some distance of an entity by that class.

I have experimented with bridges and other large props. Now I can’t figure out how to do it more accurately and simply.

I’ll try using GetCollisionBounds, thanks for idea though.

Some fires are entities, such as map placed fires ( for example in ravenholm hl2 levels )

It only indicates whether entity is ALREADY ignited. I need to detect fire itself.

:words: SO…
Now I have question: how to detect that position vector is inside some entity?

Fire is not entity, fire itself is an effect, you cannot “detect” it.

util.TraceLine is the easiest way to test that.

Before I submitted new question I have realised that.

How to detect that position vector is inside some entity?

As I said a line lower in my previous post, util.TraceLine is the easiest way to test that. Look it up on wiki.

ents.FindInBox maybe?

Oh, thanks, I’ll get try! It should work.

I have a question. Are you using model for fire?

No - no way. I have to use the model of entity without fail.

Try looking for env_fire

Seems like I can’t get environment states on entity with GLua…

:words: New problem
It’ll be better checking collisions between PLAYER and any ignited prop. Checking collisions between any two props is not actually what I need.

What’s the matter? As I said early, I’ve experemented with large (wide or high) non-solid props (like a bridge, wardrobe locker, benches, fence). Result: player’s (and, probably, tested props’) reaction on fire appears when it is situated within center of ignited props’ model only! I, of course, assumed that the fire in Source was not so very common thing to give all props a property to burn player even in any sides. And for this purposes we can use gibs, cause they’re small. But… I don’t need gibs, I do not have breakable bridge or fence, this things just burn and ignite players. How to implement this regardless of the size?

:words: **My idea
**Let’s go!

local nearestToPly = Player:NearestPoint(Ignited:GetPos())
local traceData = {
    start = nearestToPly,
    endpos = nearestToPly,
    filter = { Player }
local traceR = util.TraceLine(traceData)
if traceR.Entity == Ignited then

This is just a sketch, so about any mistakes please inform.


util.TraceHull to detect if a prop is inside/touching a player.

AirBlack suggested me in PM a function ents.FindInSphere(…). It also checks collisions hit-box. Now I have no problem.

local ply = player.GetHumans()[1]
local props = ents.FindInSphere(ply:GetPos(), 25) // 21.5 - 27 is norm
for i, prop in pairs(props) do
	if prop:GetClass() == "prop_physics" then
		if prop:IsOnFire() then

I need to check it every step, but it will damage the performance. What now?

[editline]17th February 2015[/editline]

Nice, I’ll get a taste.

entityflame, env_fire?

The problem about “center of a prop” is caused by how that prop was compiled ( PHX props are known to have this wrong ). It’s about hitboxes/hitgroups on the prop.

Are they created for ignited props though?

Finally, IT’S SOLVED! Thanks to all who have participated in discussion!

function GM:PlayerPostThink(ply)
    local trace = util.TraceHull({
        start = ply:GetPos(),
        endpos = ply:GetPos(),
        filter = { ply },
        mins = Vector(-24, -24, 0), 
        maxs = Vector(24, 24, 81)
    if IsValid(trace.Entity) then
        if trace.Entity:IsOnFire() then
            ply:Ignite(math.Rand(1, 5))

TraceHull - I see no lags.