Jump to content

Disperse clouds with fans


Recommended Posts

Additional functionality for fans to disperse clouds.

156215018_GIF10-May-2117-35-43.gif.f7baf1e1a296ebd37ece06335e9b4bae.gif

Quote

local function DisperseCloud(inst)
    if inst.components.timer ~= nil and inst.components.timer:TimerExists("disperse") then        
        inst.components.timer:SetTimeLeft("disperse", 0)
    end
end

local FANTARGET_CANT_TAGS = { "FX", "NOCLICK", "DECOR", "INLIMBO", "playerghost" }
local FANTARGET_ONEOF_TAGS = { "smolder", "fire", "player" }
local function OnUse(inst, target)
    local x, y, z = target.Transform:GetWorldPosition()
    local ents = TheSim:FindEntities(x, y, z, TUNING.FEATHERFAN_RADIUS, nil, FANTARGET_CANT_TAGS, FANTARGET_ONEOF_TAGS)
    for i, v in pairs(ents) do
        if v.components.burnable ~= nil then
            -- Extinguish smoldering/fire and reset the propagator to a heat of .2
            v.components.burnable:Extinguish(true, 0)
        end
        if v.components.temperature ~= nil then
            -- cool off yourself and any other nearby players
            v.components.temperature:DoDelta(math.clamp(TUNING.FEATHERFAN_MINIMUM_TEMP - v.components.temperature:GetCurrent(), TUNING.FEATHERFAN_COOLING, 0))
        end
    end
    
    --todo: add a special tag to distinguish clouds
    FindEntity(target, TUNING.FEATHERFAN_RADIUS, DisperseCloud)
end

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...