Skip to content

Commit

Permalink
Fix logging of intel and Parashield not having its effects (FAForever…
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored Feb 3, 2023
1 parent b7e409d commit ffaa966
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
3 changes: 1 addition & 2 deletions lua/defaultcomponents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ ShieldEffectsComponent = ClassSimple {
OnShieldEnabled = function(self)
self.ShieldEffectsBag:Destroy()
for _, v in self.ShieldEffects do
self.ShieldEffectsBag:Add(CreateAttachedEmitter(self, self.ShieldEffectsBone, self.Army, v):ScaleEmitter(self
.ShieldEffectsScale))
self.ShieldEffectsBag:Add(CreateAttachedEmitter(self, self.ShieldEffectsBone, self.Army, v):ScaleEmitter(self.ShieldEffectsScale))
end
end,

Expand Down
1 change: 0 additions & 1 deletion lua/system/blueprints-units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ local function PostProcessUnit(unit)

-- check if we have any intel
if table.empty(status.AllIntel) and table.empty(status.AllIntelMaintenanceFree) and not enhancementBlueprints then
LOG("No intel for: " .. unit.BlueprintId)
return
end

Expand Down
57 changes: 29 additions & 28 deletions units/UEL0307/UEL0307_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ local DefaultProjectileWeapon = import("/lua/sim/defaultweapons.lua").DefaultPro
---@class UEL0307 : TShieldLandUnit
UEL0307 = ClassUnit(TShieldLandUnit, ShieldEffectsComponent) {

Weapons = {
Weapons = {
TargetPointer = ClassWeapon(DefaultProjectileWeapon) {},
},

ShieldEffectsBone = 0,
ShieldEffects = {
'/effects/emitters/terran_shield_generator_mobile_01_emit.bp',
'/effects/emitters/terran_shield_generator_mobile_02_emit.bp',
Expand All @@ -28,47 +29,47 @@ UEL0307 = ClassUnit(TShieldLandUnit, ShieldEffectsComponent) {
TShieldLandUnit.OnCreate(self)
ShieldEffectsComponent.OnCreate(self)
end,
OnStopBeingBuilt = function(self,builder,layer)
TShieldLandUnit.OnStopBeingBuilt(self,builder,layer)

OnStopBeingBuilt = function(self, builder, layer)
TShieldLandUnit.OnStopBeingBuilt(self, builder, layer)

self.TargetPointer = self:GetWeapon(1) --save the pointer weapon for later - this is extra clever since the pointer weapon has to be first!
self.TargetLayerCaps = self:GetBlueprint().Weapon[1].FireTargetLayerCapsTable --we save this to the unit table so dont have to call every time.
self.PointerEnabled = true --a flag to let our thread know whether we should turn on our pointer.
end,

OnShieldEnabled = function(self)
TShieldLandUnit.OnShieldEnabled(self)
ShieldEffectsComponent.OnShieldDisabled(self)
ShieldEffectsComponent.OnShieldEnabled(self)

KillThread( self.DestroyManipulatorsThread )
KillThread(self.DestroyManipulatorsThread)
if not self.RotatorManipulator then
self.RotatorManipulator = CreateRotator( self, 'Spinner', 'y' )
self.Trash:Add( self.RotatorManipulator )
self.RotatorManipulator = CreateRotator(self, 'Spinner', 'y')
self.Trash:Add(self.RotatorManipulator)
end
self.RotatorManipulator:SetAccel( 5 )
self.RotatorManipulator:SetTargetSpeed( 30 )
self.RotatorManipulator:SetAccel(5)
self.RotatorManipulator:SetTargetSpeed(30)
if not self.AnimationManipulator then
local myBlueprint = self:GetBlueprint()
--LOG( 'it is ', repr(myBlueprint.Display.AnimationOpen) )
self.AnimationManipulator = CreateAnimator(self)
self.AnimationManipulator:PlayAnim( myBlueprint.Display.AnimationOpen )
self.Trash:Add( self.AnimationManipulator )
self.AnimationManipulator:PlayAnim(myBlueprint.Display.AnimationOpen)
self.Trash:Add(self.AnimationManipulator)
end
self.AnimationManipulator:SetRate(1)
end,

OnShieldDisabled = function(self)
TShieldLandUnit.OnShieldDisabled(self)
ShieldEffectsComponent.OnShieldDisabled(self)
KillThread( self.DestroyManipulatorsThread )
self.DestroyManipulatorsThread = self:ForkThread( self.DestroyManipulators )
KillThread(self.DestroyManipulatorsThread)
self.DestroyManipulatorsThread = self:ForkThread(self.DestroyManipulators)
end,

DestroyManipulators = function(self)
if self.RotatorManipulator then
self.RotatorManipulator:SetAccel( 10 )
self.RotatorManipulator:SetTargetSpeed( 0 )
self.RotatorManipulator:SetAccel(10)
self.RotatorManipulator:SetTargetSpeed(0)
-- Unless it goes smoothly back to its original position,
-- it will snap there when the manipulator is destroyed.
-- So for now, we'll just keep it on.
Expand All @@ -78,26 +79,26 @@ UEL0307 = ClassUnit(TShieldLandUnit, ShieldEffectsComponent) {
end
if self.AnimationManipulator then
self.AnimationManipulator:SetRate(-1)
WaitFor( self.AnimationManipulator )
WaitFor(self.AnimationManipulator)
self.AnimationManipulator:Destroy()
self.AnimationManipulator = nil
end
end,

DisablePointer = function(self)
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
self.PointerRestartThread = self:ForkThread( self.PointerRestart )
self.PointerRestartThread = self:ForkThread(self.PointerRestart)
end,

PointerRestart = function(self)
--sadly i couldnt find some way of doing this without a thread. dont know where to check if its still assisting other than this.
while not self.PointerEnabled do

WaitSeconds(1)

-- break if we're a gooner
if IsDestroyed(self) or IsDestroyed(self.TargetPointer) then
break
if IsDestroyed(self) or IsDestroyed(self.TargetPointer) then
break
end

-- if not gooner, check whether we need to enable our weapon to keep reasonable distance
Expand All @@ -107,16 +108,16 @@ UEL0307 = ClassUnit(TShieldLandUnit, ShieldEffectsComponent) {
end
end
end,

OnLayerChange = function(self, new, old)
TShieldLandUnit.OnLayerChange(self, new, old)
if not IsDestroyed(self) then

if not IsDestroyed(self) then
if self.PointerEnabled == false then
self.TargetPointer:SetFireTargetLayerCaps('None') --since its reset on layer change we need to do this. unfortunate.
end
end
end,
}

TypeClass = UEL0307
TypeClass = UEL0307

0 comments on commit ffaa966

Please sign in to comment.