Skip to content

Commit

Permalink
Refactor projectiles part 5 (FAForever#4533)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRowey authored Dec 29, 2022
1 parent 5f6447a commit 0c8232d
Show file tree
Hide file tree
Showing 28 changed files with 197 additions and 336 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
--****************************************************************************
--**
--** File : /data/projectiles/SDFShieeihAutoCannon01/SDFShieeihAutoCannon01_script.lua
--** Author(s): Gordon Duclos, Aaron Lundquist
--**
--** Summary : Shie-eih Auto-Cannon Projectile script, XSS0103
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************

SDFShieeihAutoCannon01 = Class(import("/lua/seraphimprojectiles.lua").SShriekerAutoCannon) {
}
-- File : /data/projectiles/SDFShieeihAutoCannon01/SDFShieeihAutoCannon01_script.lua
-- Author(s): Gordon Duclos, Aaron Lundquist
-- Summary : Shie-eih Auto-Cannon Projectile script, XSS0103
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--------------------------------------------------------------------------------------------
SDFShieeihAutoCannon01 = Class(import("/lua/seraphimprojectiles.lua").SShriekerAutoCannon) {}
TypeClass = SDFShieeihAutoCannon01
20 changes: 7 additions & 13 deletions projectiles/SDFSinnuntheWeapon01/SDFSinnuntheWeapon01_script.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
--****************************************************************************
--**
--** File : /data/projectiles/SDFSinnuntheWeapon01/SDFSinnuntheWeapon01_script.lua
--** Author(s): Matt Vainio
--**
--** Summary : Sinn-Uthe Projectile script, XSL0401
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
local SDFSinnuntheWeaponProjectile = import("/lua/seraphimprojectiles.lua").SDFSinnuntheWeaponProjectile
SDFSinnuntheWeapon01 = Class(SDFSinnuntheWeaponProjectile) {}

TypeClass = SDFSinnuntheWeapon01

-- File : /data/projectiles/SDFSinnuntheWeapon01/SDFSinnuntheWeapon01_script.lua
-- Author(s): Matt Vainio
-- Summary : Sinn-Uthe Projectile script, XSL0401
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
---------------------------------------------------------------------------------------
SDFSinnuntheWeapon01 = Class(import("/lua/seraphimprojectiles.lua").SDFSinnuntheWeaponProjectile) {}
TypeClass = SDFSinnuntheWeapon01
18 changes: 7 additions & 11 deletions projectiles/SDFSniperShot01/SDFSniperShot01_script.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
--****************************************************************************
--**
--** File : /data/projectiles/SDFSniperShot01/SDFSniperShot01_script.lua
--** Author(s): Matt Vainio
--**
--** Summary : Seraphim Sih Sniper Energy Rifle script, XSL0305
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
SDFSniperShot01 = Class(import("/lua/seraphimprojectiles.lua").SDFSniperShotNormal) {
}

-- File : /data/projectiles/SDFSniperShot01/SDFSniperShot01_script.lua
-- Author(s): Matt Vainio
-- Summary : Seraphim Sih Sniper Energy Rifle script, XSL0305
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
------------------------------------------------------------------------------
SDFSniperShot01 = Class(import("/lua/seraphimprojectiles.lua").SDFSniperShotNormal) {}
TypeClass = SDFSniperShot01
17 changes: 6 additions & 11 deletions projectiles/SDFSniperShot02/SDFSniperShot02_script.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
--****************************************************************************
--**
--** File : /data/projectiles/SDFSniperShot02/SDFSniperShot02_script.lua
--** Author(s): Matt Vainio
--**
--** Summary : Seraphim Sih Sniper Energy Rifle script, XSL0305
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
SDFSniperShot02 = Class(import("/lua/seraphimprojectiles.lua").SDFSniperShot) {
}
-- File : /data/projectiles/SDFSniperShot02/SDFSniperShot02_script.lua
-- Author(s): Matt Vainio
-- Summary : Seraphim Sih Sniper Energy Rifle script, XSL0305
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
------------------------------------------------------------------------------
SDFSniperShot02 = Class(import("/lua/seraphimprojectiles.lua").SDFSniperShot) {}
TypeClass = SDFSniperShot02
18 changes: 6 additions & 12 deletions projectiles/SDFTauCannon01/SDFTauCannon01_script.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
--****************************************************************************
--**
--** File : /data/projectiles/SDFTauCannon01/SDFTauCannon01_script.lua
--** Author(s): Gordon Duclos
--**
--** Summary : Tau Cannon Projectile script, XSL0303
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************

SDFTauCannon01 = Class(import("/lua/seraphimprojectiles.lua").STauCannon) {
}
-- File : /data/projectiles/SDFTauCannon01/SDFTauCannon01_script.lua
-- Author(s): Gordon Duclos
-- Summary : Tau Cannon Projectile script, XSL0303
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
----------------------------------------------------------------------------
SDFTauCannon01 = Class(import("/lua/seraphimprojectiles.lua").STauCannon) {}
TypeClass = SDFTauCannon01
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ SIFExperimentalStrategicDeath01 = Class(NullShell) {

EffectThread = function(self)
local army = self.Army
-- CreateLightParticle(self, -1, army, 50, 50, 'beam_white_01', 'ramp_quantum_warhead_flash_01')
-- Create full-screen glow flash

CreateLightParticle(self, -1, self.Army, 80, 10, 'glow_02', 'ramp_blue_22')
WaitSeconds(0.3)
WaitTicks(4)
CreateLightParticle(self, -1, self.Army, 40, 30, 'glow_02', 'ramp_blue_16')
WaitSeconds(3.0)
WaitTicks(31)
CreateLightParticle(self, -1, self.Army, 60, 15, 'glow_02', 'ramp_blue_16')
WaitSeconds(0.1)
WaitTicks(11)
CreateLightParticle(self, -1, self.Army, 30, 30, 'glow', 'ramp_blue_22')
self:ForkThread(self.ShakeAndBurnMe, army)
self:ForkThread(self.DistortionField)

self.Trash:Add(ForkThread(self.ShakeAndBurnMe,self, army))
self.Trash:Add(ForkThread(self.DistortionField,self))

for k, v in self.NormalEffects do
CreateEmitterAtEntity(self, army, v)
Expand All @@ -28,29 +27,28 @@ SIFExperimentalStrategicDeath01 = Class(NullShell) {

ShakeAndBurnMe = function(self, army)
self:ShakeCamera(75, 3, 0, 10)
WaitSeconds(0.5)
-- CreateDecal(position, heading, textureName, type, sizeX, sizeZ, lodParam, duration, army)");
WaitTicks(6)

local orientation = RandomFloat(0,2*math.pi)
local pos = self:GetPosition()

DamageArea(self, pos, 25, 1, 'TreeForce', true)
DamageArea(self, pos, 25, 1, 'TreeForce', true)

CreateDecal(pos, orientation, 'Scorch_012_albedo', '', 'Albedo', 70, 70, 800, 0, army)
CreateDecal(pos, orientation, 'Crater01_normals', '', 'Normals', 70, 70, 800, 0, army)
self:ShakeCamera(105, 10, 0, 2)
WaitSeconds(2)
WaitTicks(21)
self:ShakeCamera(75, 1, 0, 15)
end,

DistortionField = function(self)
local proj = self:CreateProjectile('/effects/QuantumWarhead/QuantumWarheadEffect01_proj.bp')
local scale = proj:GetBlueprint().Display.UniformScale
local scale = proj.Blueprint.Display.UniformScale

proj:SetScaleVelocity(0.3 * scale,0.3 * scale,0.3 * scale)
WaitSeconds(17.0)
WaitTicks(171)
proj:SetScaleVelocity(0.01 * scale,0.01 * scale,0.01 * scale)
end,
}

TypeClass = SIFExperimentalStrategicDeath01
TypeClass = SIFExperimentalStrategicDeath01
16 changes: 6 additions & 10 deletions projectiles/SIFHuAntiNuke01/SIFHuAntiNuke01_script.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
--****************************************************************************
--**
--** File : /data/projectiles/SIFHuAntiNuke01/SIFHuAntiNuke01_script.lua
--** Author(s): Greg Kohne, Matt Vainio
--**
--** Summary : Seraphim Anti Nuke Missile
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
-- File : /data/projectiles/SIFHuAntiNuke01/SIFHuAntiNuke01_script.lua
-- Author(s): Greg Kohne, Matt Vainio
-- Summary : Seraphim Anti Nuke Missile
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
-------------------------------------------------------------------------------

local EffectTemplate = import("/lua/effecttemplates.lua")
local SIFHuAntiNuke = import("/lua/seraphimprojectiles.lua").SIFHuAntiNuke
Expand All @@ -20,7 +16,7 @@ SIFHuAntiNuke01 = Class(SIFHuAntiNuke) {
local SmallTendrilProjectile = '/effects/Entities/SIFHuAntiNuke03/SIFHuAntiNuke03_proj.bp'
--Play the hit effect for the core explosion on the anti nuke.
for k, v in FxHitEffect do
CreateEmitterAtEntity( self, self:GetArmy(), v )
CreateEmitterAtEntity( self, self.Army, v )
end
local vx, vz = self:GetVelocity()
local velocity = 19
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
--****************************************************************************
--**
--** File : /data/projectiles/SIFInainoStrategicMissileEffect01/SIFInainoStrategicMissileEffect01_script.lua
--** Author(s): Greg Kohne, Gordon Duclos
--**
--** Summary : Ohwalli Strategic Bomb effect script, non-damaging
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
-- File : /data/projectiles/SIFInainoStrategicMissileEffect01/SIFInainoStrategicMissileEffect01_script.lua
-- Author(s): Greg Kohne, Gordon Duclos
-- Summary : Ohwalli Strategic Bomb effect script, non-damaging
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
----------------------------------------------------------------------------------------------------------------
local EffectTemplate = import("/lua/effecttemplates.lua")

SIFInainoStrategicMissileEffect01 = Class(import("/lua/sim/defaultprojectiles.lua").EmitterProjectile) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
--****************************************************************************
--**
--** File : /data/projectiles/SIFLaanseTacticalMissile01/SIFLaanseTacticalMissile01_script.lua
--** Author(s): Gordon Duclos, Aaron Lundquist
--**
--** Summary : Laanse Tactical Missile Projectile script, XSL0111
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
-- File : /data/projectiles/SIFLaanseTacticalMissile01/SIFLaanseTacticalMissile01_script.lua
-- Author(s): Gordon Duclos, Aaron Lundquist
-- Summary : Laanse Tactical Missile Projectile script, XSL0111
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
---------------------------------------------------------------------------------------------------
local SLaanseTacticalMissile = import("/lua/seraphimprojectiles.lua").SLaanseTacticalMissile

SIFLaanseTacticalMissile01 = Class(SLaanseTacticalMissile) {
Expand All @@ -16,39 +12,39 @@ SIFLaanseTacticalMissile01 = Class(SLaanseTacticalMissile) {
self.MoveThread = self:ForkThread(self.MovementThread)
end,

MovementThread = function(self)
self.WaitTime = 0.1
MovementThread = function(self)
self.WaitTime = 2
self.Distance = self:GetDistanceToTarget()
self:SetTurnRate(8)
WaitSeconds(0.3)
WaitTicks(4)
while not self:BeenDestroyed() do
self:SetTurnRateByDist()
WaitSeconds(self.WaitTime)
WaitTicks(self.WaitTime)
end
end,

SetTurnRateByDist = function(self)
local dist = self:GetDistanceToTarget()
if dist > self.Distance then
self:SetTurnRate(75)
WaitSeconds(3)
WaitTicks(31)
self:SetTurnRate(8)
self.Distance = self:GetDistanceToTarget()
end
if dist > 50 then
if dist > 50 then
--Freeze the turn rate as to prevent steep angles at long distance targets
WaitSeconds(2)
WaitTicks(21)
self:SetTurnRate(10)
elseif dist > 30 and dist <= 50 then
self:SetTurnRate(12)
WaitSeconds(1.5)
WaitTicks(16)
self:SetTurnRate(12)
elseif dist > 10 and dist <= 25 then
WaitSeconds(0.3)
WaitTicks(4)
self:SetTurnRate(50)
elseif dist > 0 and dist <= 10 then
self:SetTurnRate(100)
KillThread(self.MoveThread)
elseif dist > 0 and dist <= 10 then
self:SetTurnRate(100)
KillThread(self.MoveThread)
end
end,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
--****************************************************************************
--**
--** File : /data/projectiles/SIFLaanseTacticalMissile02/SIFLaanseTacticalMissile02_script.lua
--** Author(s): Gordon Duclos, Aaron Lundquist
--**
--** Summary : Laanse Tactical Missile Projectile script, XSS0202
--**
--** Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************

-- File : /data/projectiles/SIFLaanseTacticalMissile02/SIFLaanseTacticalMissile02_script.lua
-- Author(s): Gordon Duclos, Aaron Lundquist
-- Summary : Laanse Tactical Missile Projectile script, XSS0202
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
--------------------------------------------------------------------------------------------------
local SLaanseTacticalMissile = import("/lua/seraphimprojectiles.lua").SLaanseTacticalMissile

SIFLaanseTacticalMissile02 = Class(SLaanseTacticalMissile) {

OnCreate = function(self)
SLaanseTacticalMissile.OnCreate(self)
self:SetCollisionShape('Sphere', 0, 0, 0, 2.0)
self:ForkThread( self.MovementThread )
self.Trash:Add(ForkThread( self.MovementThread,self ))
end,

MovementThread = function(self)
self.WaitTime = 0.1
MovementThread = function(self)
self.WaitTime = 2
self:SetTurnRate(8)
WaitSeconds(0.3)
WaitTicks(4)
while not self:BeenDestroyed() do
self:SetTurnRateByDist()
WaitSeconds(self.WaitTime)
WaitTicks(self.WaitTime)
end
end,

Expand All @@ -33,23 +28,23 @@ SIFLaanseTacticalMissile02 = Class(SLaanseTacticalMissile) {
--Get the nuke as close to 90 deg as possible
if dist > 50 then
--Freeze the turn rate as to prevent steep angles at long distance targets
WaitSeconds(2)
WaitTicks(21)
self:SetTurnRate(20)
elseif dist > 64 and dist <= 107 then
-- Increase check intervals
self:SetTurnRate(30)
WaitSeconds(1.5)
WaitTicks(16)
self:SetTurnRate(30)
elseif dist > 21 and dist <= 53 then
-- Further increase check intervals
WaitSeconds(0.3)
WaitTicks(4)
self:SetTurnRate(50)
elseif dist > 0 and dist <= 21 then
-- Further increase check intervals
self:SetTurnRate(100)
KillThread(self.MoveThread)
self:SetTurnRate(100)
KillThread(self.MoveThread)
end
end,
end,

GetDistanceToTarget = function(self)
local tpos = self:GetCurrentTargetPosition()
Expand Down
Loading

0 comments on commit 0c8232d

Please sign in to comment.