#Thermal Signature/Heat System not updating properly

1 messages · Page 1 of 1 (latest)

round nova
#

Was testing out the system, in the video i first test the signature-silhouette range with the APCs on and the target ship having a thermal sig of about 500k, later i turn off the apcs on the target ship and the signature gets reduced to 50k. Despite the thermal sig being 1/10th of what it was before the signature-silhouette range stays the same

outer bobcat
#

@silent igloo Is this something that has to do w./ gunnery changes?

#

AKA is it new

silent igloo
#

nope

silent igloo
round nova
#

my theory is that it just only uses the heat that it gets when it shows up on the mass scanner and it stays static

silent igloo
#

oh

#

i see the error

#

no actually

#

it's pretty trivial

round nova
#

wat is it..

silent igloo
#
    public override void Update(float frameTime)
    {
        if (_timing.CurTime < _nextUpdateTime)
            return;

        _nextUpdateTime = _timing.CurTime + UpdateInterval;

        var gridQuery = EntityQueryEnumerator<MapGridComponent, ThermalSignatureComponent>();
        while (gridQuery.MoveNext(out _, out _, out var gridSigComp))
        {
            gridSigComp.TotalHeat = 0f;
        }

        var query = EntityQueryEnumerator<ThermalSignatureComponent>();
        while (query.MoveNext(out var uid, out var sigComp))
        {
            var ev = new GetThermalSignatureEvent();
            RaiseLocalEvent(uid, ref ev);

            sigComp.StoredHeat += ev.Signature * UpdateIntervalSeconds;
            sigComp.StoredHeat *= MathF.Pow(sigComp.HeatDissipation, UpdateIntervalSeconds);

            if (_mapGridQuery.HasComp(uid))
            {
                sigComp.TotalHeat += sigComp.StoredHeat;

                // don't sync it if it didn't change heat much since last time, we don't need to sync 500 cold asteroids every system update
                if (sigComp.TotalHeat <= sigComp.LastUpdateHeat * HeatChangeThreshold
                    && sigComp.TotalHeat >= sigComp.LastUpdateHeat / HeatChangeThreshold)
                    continue;

                sigComp.LastUpdateHeat = sigComp.TotalHeat;
                Dirty(uid, sigComp);
            }
            else
            {
                var xform = Transform(uid);
                sigComp.TotalHeat = sigComp.StoredHeat;
                if (xform.GridUid != null && _sigQuery.TryGetComponent(xform.GridUid.Value, out var gridSig))
                    gridSig.TotalHeat += sigComp.StoredHeat;
            }
        }
    }
#

do you see it

round nova
#

uhh no

silent igloo
#

it updates grids in the same loop as other entities

#

which means it can go through a couple entities, run into the grid, then update the rest

round nova
#

ahh ok

silent igloo
#

after having synced only partially updated heat

vivid rivet
#

resolved i think