forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code Formatting Units V1 (FAForever#5759)
Co-authored-by: lL1l1 <[email protected]>
- Loading branch information
Showing
40 changed files
with
675 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- (#5759) Fix rotators on Aeon T2 shield never restarting and on T3 Mass Fabricator never stopping. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- (#5759) Refactor Seraphim Lightning Tank's weapons and collision beams. | ||
|
||
- (#5759) Reduce overhead of many unit scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local SCCollisionBeam = import("/lua/sim/collisionBeams/SCCollisionBeam.lua").SCCollisionBeam | ||
|
||
LightningSmallCollisionBeam = Class(SCCollisionBeam) { | ||
FxBeamStartPoint = { | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_01_emit.bp', | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_02_emit.bp', | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_03_emit.bp', | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_04_emit.bp', | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_05_emit.bp', | ||
'/Effects/Emitters/seraphim_experimental_phasonproj_muzzle_flash_06_emit.bp', | ||
'/Effects/Emitters/seraphim_electricity_emit.bp' | ||
}, | ||
FxBeam = { | ||
'/Effects/Emitters/seraphim_lightning_beam_01_emit.bp', | ||
}, | ||
FxBeamEndPoint = { | ||
'/Effects/Emitters/seraphim_lightning_hit_01_emit.bp', | ||
'/Effects/Emitters/seraphim_lightning_hit_02_emit.bp', | ||
'/Effects/Emitters/seraphim_lightning_hit_03_emit.bp', | ||
'/Effects/Emitters/seraphim_lightning_hit_04_emit.bp', | ||
}, | ||
|
||
TerrainImpactType = 'LargeBeam01', | ||
TerrainImpactScale = 0.2, | ||
} |
63 changes: 63 additions & 0 deletions
63
lua/sim/collisionBeams/LightningSmallSurfaceCollisionBeam.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
local EffectTemplate = import("/lua/effecttemplates.lua") | ||
local Util = import("/lua/utilities.lua") | ||
|
||
local CollisionBeam = import("/lua/sim/collisionbeam.lua").CollisionBeam | ||
local LightningSmallCollisionBeam = import("/lua/sim/collisionBeams/LightningSmallCollisionBeam.lua").LightningSmallCollisionBeam | ||
|
||
LightningSmallSurfaceCollisionBeam = Class(LightningSmallCollisionBeam) { | ||
TerrainImpactScale = 0.1, | ||
FxBeam = { '/Effects/Emitters/seraphim_lightning_beam_02_emit.bp', }, | ||
|
||
SplatTexture = 'czar_mark01_albedo', | ||
ScorchSplatDropTime = 0.25, | ||
|
||
---@param self LightningSmallSurfaceCollisionBeam | ||
---@param impactType ImpactType | ||
---@param targetEntity? Prop|Unit | ||
OnImpact = function(self, impactType, targetEntity) | ||
if impactType ~= 'Shield' and impactType ~= 'Water' and impactType ~= 'Air' and impactType ~= 'UnitAir' and impactType ~= 'Projectile' then | ||
if self.Scorching == nil then | ||
self.Scorching = self:ForkThread(self.ScorchThread) | ||
end | ||
else | ||
KillThread(self.Scorching) | ||
self.Scorching = nil | ||
end | ||
CollisionBeam.OnImpact(self, impactType, targetEntity) | ||
end, | ||
|
||
---@param self LightningSmallSurfaceCollisionBeam | ||
OnDisable = function(self) | ||
CollisionBeam.OnDisable(self) | ||
KillThread(self.Scorching) | ||
self.Scorching = nil | ||
end, | ||
|
||
---@param self LightningSmallSurfaceCollisionBeam | ||
ScorchThread = function(self) | ||
local army = self:GetArmy() | ||
local size = 1.1 + (Random() * 1.1) | ||
local CurrentPosition = self:GetPosition(1) | ||
local LastPosition = Vector(0,0,0) | ||
local skipCount = 1 | ||
-- local FriendlyFire = self.DamageData.DamageFriendly | ||
|
||
while true do | ||
if Util.GetDistanceBetweenTwoVectors(CurrentPosition, LastPosition) > 0.25 or skipCount > 100 then | ||
CreateSplat( CurrentPosition, Util.GetRandomFloat(0,2*math.pi), self.SplatTexture, size, size, 100, 100, army ) | ||
LastPosition = CurrentPosition | ||
skipCount = 1 | ||
|
||
-- commented due to hard-crash potential | ||
-- DamageArea(self, CurrentPosition, size, 1, 'Force', FriendlyFire) | ||
-- DamageArea(self, CurrentPosition, size, 1, 'Force', FriendlyFire) | ||
else | ||
skipCount = skipCount + self.ScorchSplatDropTime | ||
end | ||
|
||
WaitSeconds(self.ScorchSplatDropTime) | ||
size = 1 + (Random() * 1.1) | ||
CurrentPosition = self:GetPosition(1) | ||
end | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local DefaultBeamWeapon = import("/lua/sim/defaultweapons.lua").DefaultBeamWeapon | ||
local EffectTemplate = import('/lua/effecttemplates.lua') | ||
local LightningSmallCollisionBeam = import("/lua/sim/collisionBeams/LightningSmallCollisionBeam.lua").LightningSmallCollisionBeam | ||
|
||
--- Used by DSLK004 | ||
---@class SAALightningWeapon : DefaultProjectileWeapon | ||
SAALightningWeapon = ClassWeapon(DefaultBeamWeapon) { | ||
BeamType = LightningSmallCollisionBeam, | ||
FxMuzzleFlash = { }, | ||
FxUpackingChargeEffects = EffectTemplate.CMicrowaveLaserCharge01, | ||
FxUpackingChargeEffectScale = 0.2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.