fa
fa copied to clipboard
Improve intel management
Changes intel from checking the energy levels every half second to only using the AIBrain's EnergyDependingEntity
callbacks. This also involves some cooperation from the enhancement code, since some enhancements add or create intel traits (it also keeps the radar flickering synced up to the enhancement completion). ~~In order to not change the radar flickering behavior, I ended up partially restoring that half-second loop since the flickering was originally created by an interaction between it and the low energy level disabler. This does mean we now have freedom over the flicker duty cycle, which I've taken the liberty of implementing via Blueprint.Intel.DeactivateTime
(to counterpart ReactivateTime
).~~ Intel no longer flickers and ReactivationTime
is used as a reactivation delay after the player stops power stalling
A unit's IntelDisables
are now only allocated for what they need; it is no longer the case that all units create the table with all fields, despite most units having nothing to do with intel, and even those that do not using all of the fields anyway. You will find that IntelDisables
is now very often nil
.
There may have been a bit of refactoring as well...
I'll pick this up when I'm back 👍
Fixed the issue I mentioned. There's one more though: when you change the script bits (for say, a radar) then it adds in all remaining intel types into the table. See also:
OnScriptBitSet = function(self, bit)
if bit == 0 then -- Shield toggle
self:PlayUnitAmbientSound('ActiveLoop')
self:EnableShield()
elseif bit == 1 then -- Weapon toggle
-- Amended in individual unit's script file
elseif bit == 2 then -- Jamming toggle
self:StopUnitAmbientSound('ActiveLoop')
self:SetMaintenanceConsumptionInactive()
self:DisableUnitIntel('ToggleBit2', 'Jammer')
elseif bit == 3 then -- Intel toggle
self:StopUnitAmbientSound('ActiveLoop')
self:SetMaintenanceConsumptionInactive()
self:DisableUnitIntel('ToggleBit3', 'RadarStealth')
self:DisableUnitIntel('ToggleBit3', 'RadarStealthField')
self:DisableUnitIntel('ToggleBit3', 'SonarStealth')
self:DisableUnitIntel('ToggleBit3', 'SonarStealthField')
self:DisableUnitIntel('ToggleBit3', 'Sonar')
self:DisableUnitIntel('ToggleBit3', 'Omni')
self:DisableUnitIntel('ToggleBit3', 'Cloak')
self:DisableUnitIntel('ToggleBit3', 'CloakField') -- We really shouldn't use this. Cloak/Stealth fields are pretty busted
self:DisableUnitIntel('ToggleBit3', 'Spoof')
self:DisableUnitIntel('ToggleBit3', 'Jammer')
self:DisableUnitIntel('ToggleBit3', 'Radar')
elseif bit == 4 then -- Production toggle
self:OnProductionPaused()
elseif bit == 5 then -- Stealth toggle
self:StopUnitAmbientSound('ActiveLoop')
self:SetMaintenanceConsumptionInactive()
self:DisableUnitIntel('ToggleBit5', 'RadarStealth')
self:DisableUnitIntel('ToggleBit5', 'RadarStealthField')
self:DisableUnitIntel('ToggleBit5', 'SonarStealth')
self:DisableUnitIntel('ToggleBit5', 'SonarStealthField')
Preferably, it wouldn't do that. Question is whether it is worth fixing?
Well, it's very easy to fix. The question is whether it impacts mods dynamically enabling intel fields after the disable, as they then won't have the proper disables set on the field. This is already a problem for the construction disabler, but I think it's safe to presume that no radar field will be active while it's building.
The solution still expands the intel table to everything when disabling and enabling. It won't make it for this patch, maybe we need to rebuild how intel works from the ground up. What if we can solely enable / disable what the unit is able to produce (at any point in time)?
And there's also issues with animations and effects that trigger, even though the intel is disabled by say energy.
@Hdt80bro I am closing this, we'll need to find the time for a better solution someday.