Jump to content

Spiky Bush and Summer's heat


Recommended Posts

6 minutes ago, shadowDigga said:

Spiky bushes are flammable, however:

1) they grow in winter;

2) they don't get withered by heat;

3) they don't require fertilizer;

4) they don't get diseased.

Isn't like they don't smolder on their own during summer? They can burn but if something else sets them on fire, but if they are isolated with eachother, out of flingo range, and not near something that may burn, I think they will remain safe from wildfires.

Link to comment
Share on other sites

On 4.4.2020 at 4:23 PM, shadowDigga said:

The function that checks whether something is allowed to smolder due to summer heat is a bit hard for me to understand so I'm not sure. I personally never seen spiky bushes or cacti smolder because of heat during summer.

local function LightFireForPlayer(player, rescheduleFn)
    _scheduledtasks[player] = nil

    if math.random() <= _chance and
        not (_world.components.sandstorms ~= nil and
            _world.components.sandstorms:IsInSandstorm(player)) then
        local x, y, z = player.Transform:GetWorldPosition()
        local firestarters = TheSim:FindEntities(x, y, z, _radius, nil, _excludetags)
        if #firestarters > 0 then
            local highprio = {}
            local lowprio = {}
            for i, v in ipairs(firestarters) do
                if v.components.burnable ~= nil then
                    table.insert(v:HasTag("wildfirepriority") and highprio or lowprio, v)
                end
            end
            firestarters = #highprio > 0 and highprio or lowprio
            while #firestarters > 0 do
                local i = math.random(#firestarters)
                if CheckValidWildfireStarter(firestarters[i]) then
                    firestarters[i].components.burnable:StartWildfire()
                    break
                else
                    table.remove(firestarters, i)
                end
            end
        end
    end

    rescheduleFn(player)
end

^ That's the function which checks if there are any objects around a player which could be targeted by Wildfire. If the player is caught in a sandstorm, then it always returns false i.e. Players in a Sandstorm can't cast Wildfires.

Any object which doesn't have any of the following tags ("wildfireprotected", "fire", "burnt", "player", "companion", "NOCLICK", "INLIMBO") can't start Wildfires:

  • "wildfireprotected": e.g. Butterflies, Moles, Fire Pit, Torch, Willow's Lighter, Pig Torch
  • "fire"/"burnt": As much as I understand if it's burning or already burnt
  • "companion": e.g. Chester, Glommer, Beefalo, Critters, Houndious Shootius, Smallbird
  • "NOCLICK": i.e. objects which you can't click with your mouse on
  • "INLIMBO": i.e. if it's not available anymore but still here

It randomly checks any object around you if it is a valid target for Wildfires, but priorizes objects with the "wildfirepriority" tag (e.g. Lureplant). Once it finds an object which can be affected by Wildfires, then it will make that object smolder. Here we have the function which checks if that object is valid:

local function CheckValidWildfireStarter(obj)
    if not obj:IsValid() or
        obj:HasTag("fireimmune") or
        (obj.components.witherable ~= nil and obj.components.witherable:IsProtected()) then
        return false --Invalid, immune, or temporarily protected
    elseif obj.components.pickable ~= nil then
        if obj.components.pickable:IsWildfireStarter() then
            --Wild plants
            return true
        end
    elseif obj.components.crop == nil and obj.components.growable == nil then
        --Non-plant
        return true
    end
    --Farm crop or tree
    return (obj.components.crop ~= nil and obj.components.witherable:IsWithered())
        or (obj.components.workable ~= nil and obj.components.workable:GetWorkAction() == ACTIONS.CHOP)
end
  1. If that object is "fireimmune", or witherable (like Berry Bush, Grass Tuft, Sapling, or Stone Fruit Bush) but also temporarily protected from withering (e.g. by fertilizing or throwing a Water Balloon on it), then it isn't a valid target for Wildfire and can't start smoldering without having a fire nearby.
  2. If that object is pickable and the function "IsWildfireStarter" returns true for that object, then it is a valid target for Wildfire. But this only applies on the Flower or Evil Flower, they don't wither during summer but are still valid targets.
  3. If it's neither a crop (Crop in Farms or planted by Wormwood) nor growable (like Trees, Beefalos, Stone Fruit Bushes, Spider Dens, Smallbirds, etc.), then it's a valid target for Wildfire.
  4. If it's not decided by 1.-3., then it does a last check:
    1. If it is a crop, and already withered, then it's a valid target for Wildfire.
    2. If it is "workable", and the "WorkAction" of that object is CHOP (in that case it applies to any kind of tree), then it's a valid target for Wildfire.

 

I don't see any hints in Spiky Bush or Cactus which prevents it from catching Wildfires: They don't have the Tags "wildfireprotected", "player", "companion", "fireimmune", and they appear not to be crops or growable. Unless I did a mistake while inspecting the lua, they should be affected by wildfires like any other objects.

Link to comment
Share on other sites

Well, since spiky bushes and cacti don't return true for any of condtions listed in the first if

if not obj:IsValid() or
        obj:HasTag("fireimmune") or
        (obj.components.witherable ~= nil and obj.components.witherable:IsProtected()) then
        return false

but are pickable, their case is handled by first elseif

 elseif obj.components.pickable ~= nil then

where they don't pass additional if check

obj.components.pickable:IsWildfireStarter()

because only flowers return true for IsWildfireStarter() and as such we don't reach

--Wild plants
            return true

Second elseif is not reached too because only first met if/elseif condition is executed; from there we go to

return (obj.components.crop ~= nil and obj.components.witherable:IsWithered())
        or (obj.components.workable ~= nil and obj.components.workable:GetWorkAction() == ACTIONS.CHOP)

None of these conditions return true, so it returns false. Oddly enough, it seems most grass tufts/saplings/berry bushes/stone fruit bushes are handled in this expression, and are not vulnerable to wildfires until they become withered. But since they become withered so quickly, we never notice that.

This also means that any pickable wild plant that is not flower and is not witherable is immune to wildfires. Feel free to keep your spiky bushes and bull kelps unprotected by ice flingo, but do note that while they can't start wildfires, they can and mostly likely will catch fires from other stuff, such as seeds that birds drop every now and then.

Link to comment
Share on other sites

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...