Skip to content

Commit

Permalink
Introduce code annotations (FAForever#5641)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRowey authored Nov 12, 2023
1 parent 3551bac commit a02ca89
Show file tree
Hide file tree
Showing 78 changed files with 377 additions and 264 deletions.
8 changes: 3 additions & 5 deletions projectiles/CAAAutocannon01/CAAAutocannon01_script.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
--
-- Cybran Anti Air Projectile
--
--- Cybran Anti Air Projectile
---@class CAAAutocannon01: CShellAAAutoCannonProjectile
CAAAutocannon01 = ClassProjectile(import("/lua/cybranprojectiles.lua").CShellAAAutoCannonProjectile) { }

TypeClass = CAAAutocannon01
TypeClass = CAAAutocannon01
6 changes: 2 additions & 4 deletions projectiles/CAAAutocannon02/CAAAutocannon02_script.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
--
-- Cybran Anti Air Projectile
--
---@class CAAAutocannon02: CShellAAAutoCannonProjectile
CAAAutocannon02 = ClassProjectile(import("/lua/cybranprojectiles.lua").CShellAAAutoCannonProjectile) { }

TypeClass = CAAAutocannon02
TypeClass = CAAAutocannon02
6 changes: 2 additions & 4 deletions projectiles/CAAAutocannon03/CAAAutocannon03_script.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
--
-- Cybran Anti Air Projectile
--
---@class CAAAutocannon03: CShellAAAutoCannonProjectile
CAAAutocannon03 = ClassProjectile(import("/lua/cybranprojectiles.lua").CShellAAAutoCannonProjectile) { }

TypeClass = CAAAutocannon03
TypeClass = CAAAutocannon03
4 changes: 2 additions & 2 deletions projectiles/CAABurstCloud01/CAABurstCloud01_script.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Cybran Anti Air Projectile

local CAAElectronBurstCloudProjectile = import("/lua/cybranprojectiles.lua").CAAElectronBurstCloudProjectile

--- Cybran Anti Air Projectile
---@class CAABurstCloud01: CAAElectronBurstCloudProjectile
CAABurstCloud01 = ClassProjectile(CAAElectronBurstCloudProjectile) {}
TypeClass = CAABurstCloud01
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- Cybran Anti Nuke

local CAADissidentProjectile = import("/lua/cybranprojectiles.lua").CAADissidentProjectile

--- Cybran Anti Nuke
---@class CAADissidentAntiNuke01: CAADissidentProjectile
CAADissidentAntiNuke01 = ClassProjectile(CAADissidentProjectile) {}
TypeClass = CAADissidentAntiNuke01
11 changes: 9 additions & 2 deletions projectiles/CAAMissileNanite01/CAAMissileNanite01_script.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
-- AA Missile for Cybrans

local CAAMissileNaniteProjectile = import("/lua/cybranprojectiles.lua").CAAMissileNaniteProjectile

-- AA Missile for Cybrans
---@class CAAMissileNanite01: CAAMissileNaniteProjectile
CAAMissileNanite01 = ClassProjectile(CAAMissileNaniteProjectile) {

---@param self CAAMissileNanite01
OnCreate = function(self)
CAAMissileNaniteProjectile.OnCreate(self)
self.Trash:Add(ForkThread(self.UpdateThread, self))
end,

---@param self CAAMissileNanite01
UpdateThread = function(self)
WaitTicks(16)
self:SetMaxSpeed(80)
Expand All @@ -15,6 +19,9 @@ CAAMissileNanite01 = ClassProjectile(CAAMissileNaniteProjectile) {
self:ChangeZigZagFrequency(2)
end,

---@param self CAAMissileNanite01
---@param TargetType string
---@param TargetEntity Prop|Unit
OnImpact = function(self, TargetType, TargetEntity)
CAAMissileNaniteProjectile.OnImpact(self, TargetType, TargetEntity)
end,
Expand Down
11 changes: 8 additions & 3 deletions projectiles/CAAMissileNanite02/CAAMissileNanite02_script.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
--
-- AA Missile for Cybrans
--
local CAAMissileNaniteProjectile = import("/lua/cybranprojectiles.lua").CAAMissileNaniteProjectile

-- AA Missile for Cybrans
---@class CAAMissileNanite02: CAAMissileNaniteProjectile
CAAMissileNanite02 = ClassProjectile(CAAMissileNaniteProjectile) {

---@param self CAAMissileNanite02
OnCreate = function(self)
CAAMissileNaniteProjectile.OnCreate(self)
self.Trash:Add(ForkThread(self.UpdateThread,self))
end,

---@param self CAAMissileNanite02
UpdateThread = function(self)
WaitTicks(16)
self:SetMaxSpeed(80)
Expand All @@ -17,6 +19,9 @@ CAAMissileNanite02 = ClassProjectile(CAAMissileNaniteProjectile) {
self:ChangeZigZagFrequency(2)
end,

---@param self CAAMissileNanite02
---@param TargetType string
---@param TargetEntity Prop|Unit
OnImpact = function(self, TargetType, TargetEntity)
CAAMissileNaniteProjectile.OnImpact(self, TargetType, TargetEntity)
end,
Expand Down
11 changes: 8 additions & 3 deletions projectiles/CAAMissileNanite03/CAAMissileNanite03_script.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
--
-- AA Missile for Cybrans
--
local CAAMissileNaniteProjectile = import("/lua/cybranprojectiles.lua").CAAMissileNaniteProjectile03

-- AA Missile for Cybrans
---@class CAAMissileNanite03: CAAMissileNaniteProjectile03
CAAMissileNanite03 = ClassProjectile(CAAMissileNaniteProjectile) {

---@param self CAAMissileNanite03
OnCreate = function(self)
CAAMissileNaniteProjectile.OnCreate(self)
self.Trash:Add(ForkThread(self.UpdateThread, self))
end,

---@param self CAAMissileNanite03
UpdateThread = function(self)
WaitTicks(16)
self:SetMaxSpeed(80)
Expand All @@ -17,6 +19,9 @@ CAAMissileNanite03 = ClassProjectile(CAAMissileNaniteProjectile) {
self:ChangeZigZagFrequency(2)
end,

---@param self CAAMissileNanite03
---@param TargetType string
---@param TargetEntity Prop|Unit
OnImpact = function(self, TargetType, TargetEntity)
CAAMissileNaniteProjectile.OnImpact(self, TargetType, TargetEntity)
end,
Expand Down
11 changes: 8 additions & 3 deletions projectiles/CAANanoDart01/CAANanoDart01_script.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
-- Cybran Anti Air Projectile
CAANanoDartProjectile03 = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile03
local CAANanoDartProjectile03 = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile03

--- Cybran Anti Air Projectile
---@class CAANanoDart01: CAANanoDartProjectile03
CAANanoDart01 = ClassProjectile(CAANanoDartProjectile03) {
OnCreate = function(self)

---@param self CAANanoDart01
OnCreate = function(self)
CAANanoDartProjectile03.OnCreate(self)
self.Trash:Add(ForkThread(self.UpdateThread,self))
end,

---@param self CAANanoDart01
UpdateThread = function(self)
WaitTicks(4)
self:SetMaxSpeed(2)
Expand Down
12 changes: 5 additions & 7 deletions projectiles/CAANanoDart02/CAANanoDart02_script.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
--
-- Cybran Anti Air Projectile
--

CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile
local CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile

--- Cybran Anti Air Projectile
---@class CAANanoDart02: CAANanoDartProjectile
CAANanoDart02 = ClassProjectile(CAANanoDartProjectile) {

---@param self CAANanoDart02
OnCreate = function(self)
CAANanoDartProjectile.OnCreate(self)
for k, v in self.FxTrails do
CreateEmitterOnEntity(self,self.Army,v )
end
end,
}

TypeClass = CAANanoDart02
TypeClass = CAANanoDart02
19 changes: 8 additions & 11 deletions projectiles/CAANanoDart03/CAANanoDart03_script.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
--
-- Cybran Anti Air Projectile
--

CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile
local CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile

--- Cybran Anti Air Projectile
---@class CAANanoDart01: CAANanoDartProjectile
CAANanoDart01 = ClassProjectile(CAANanoDartProjectile) {

OnCreate = function(self)
---@param self CAANanoDart01
OnCreate = function(self)
CAANanoDartProjectile.OnCreate(self)
self.Trash:Add(ForkThread(self.UpdateThread, self))
end,

end,

---@param self CAANanoDart01
UpdateThread = function(self)
WaitTicks(3)
self:SetMaxSpeed(10)
Expand All @@ -22,8 +21,6 @@ CAANanoDart01 = ClassProjectile(CAANanoDartProjectile) {
self:SetAcceleration(20 + Random() * 5)
WaitTicks(4)
self:SetTurnRate(360)

end,
}

TypeClass = CAANanoDart01
TypeClass = CAANanoDart01
8 changes: 6 additions & 2 deletions projectiles/CAANanoDart04/CAANanoDart04_script.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@

-----------------------------------------------------------------------------
-- File : /data/projectiles/CAANanoDart04/CAANanoDart04_script.lua
-- Author(s): Greg Kohne
-- Summary : Cybran Anti Air Projectile, on unit DRA0202
-- Copyright © 2007 Gas Powered Games, Inc. All rights reserved.
-----------------------------------------------------------------------------
import("/lua/utilities.lua")
CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile02
local CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile02

--- Cybran Anti Air Projectile
---@class CAANanoDart04: CAANanoDartProjectile02
CAANanoDart04 = ClassProjectile(CAANanoDartProjectile) {

---@param self CAANanoDart04
OnCreate = function(self)
CAANanoDartProjectile.OnCreate(self)
--Set the orientation of this thing to facing the target from the beginning.
Expand All @@ -20,6 +23,7 @@ CAANanoDart04 = ClassProjectile(CAANanoDartProjectile) {
self.Trash:Add(ForkThread(self.UpdateThread,self))
end,

---@param self CAANanoDart04
UpdateThread = function(self)
self:SetMaxSpeed(50) --Immediately go to max speed.
WaitTicks(3) --Wait for a small amount of time
Expand Down
4 changes: 3 additions & 1 deletion projectiles/CAANanoDart05/CAANanoDart05_script.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
local CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile03

-- Cybran Anti Air Projectile
CAANanoDartProjectile = import("/lua/cybranprojectiles.lua").CAANanoDartProjectile03
---@class CAANanoDart02: CAANanoDartProjectile03
CAANanoDart02 = ClassProjectile(CAANanoDartProjectile) {}
TypeClass = CAANanoDart02
3 changes: 3 additions & 0 deletions projectiles/CANKrilTorpedo01/CANKrilTorpedo01_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
---------------------------------------------------------------------------------
local CKrilTorpedo = import("/lua/cybranprojectiles.lua").CKrilTorpedo

--- Kril Torpedo Projectile script, XRB2308
---@class CANKrilTorpedo01 : CKrilTorpedo
CANKrilTorpedo01 = ClassProjectile(CKrilTorpedo) {
FxEnterWater= { '/effects/emitters/water_splash_ripples_ring_01_emit.bp',
'/effects/emitters/water_splash_plume_01_emit.bp',},
TrailDelay = 2,

---@param self CANKrilTorpedo01
OnCreate = function(self)
CKrilTorpedo.OnCreate(self, true)
self:SetCollisionShape('Sphere', 0, 0, 0, 1.0)
Expand Down
9 changes: 5 additions & 4 deletions projectiles/CANTorpedoMeson01/CANTorpedoMeson01_script.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Cybran Non-guided Torpedo, Made to be fired from above the water

local CTorpedoShipProjectile = import("/lua/cybranprojectiles.lua").CTorpedoShipProjectile

-- Cybran Non-guided Torpedo, Made to be fired from above the water
---@class CANTorpedoMeson01 : CTorpedoShipProjectile
CANTorpedoMeson01 = ClassProjectile(CTorpedoShipProjectile) {
FxSplashScale = 1,

Expand All @@ -11,9 +11,9 @@ CANTorpedoMeson01 = ClassProjectile(CTorpedoShipProjectile) {
'/effects/emitters/destruction_water_splash_plume_01_emit.bp',
},

---@param self CANTorpedoMeson01
OnEnterWater = function(self)
CTorpedoShipProjectile.OnEnterWater(self)

self:TrackTarget(true)
self:StayUnderwater(true)
self:SetBallisticAcceleration(0)
Expand All @@ -23,7 +23,8 @@ CANTorpedoMeson01 = ClassProjectile(CTorpedoShipProjectile) {
self.Trash:Add(ForkThread(self.SpinUpThread))
end,

SpinUpThread = function(self)
---@param self CANTorpedoMeson01
SpinUpThread = function(self)
WaitTicks(21)
self:TrackTarget(false)
self:SetTurnRate(0)
Expand Down
5 changes: 2 additions & 3 deletions projectiles/CANTorpedoMeson02/CANTorpedoMeson02_script.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
--
-- Cybran Non-guided Torpedo, Made to be fired from above the water
--
local CTorpedoSubProjectile = import("/lua/cybranprojectiles.lua").CTorpedoSubProjectile

--- Cybran Non-guided Torpedo, Made to be fired from above the water
---@class CANTorpedoMeson02 : CTorpedoSubProjectile
CANTorpedoMeson02 = ClassProjectile(CTorpedoSubProjectile) {
FxSplashScale = 1,
}
Expand Down
10 changes: 6 additions & 4 deletions projectiles/CANTorpedoNanite01/CANTorpedoNanite01_script.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
--
-- Sub-Based Torpedo Script
--
local CTorpedoSubProjectile = import("/lua/cybranprojectiles.lua").CTorpedoSubProjectile

-- Sub-Based Torpedo Script
---@class CANTorpedoNanite01 : CTorpedoSubProjectile
CANTorpedoNanite01 = ClassProjectile(CTorpedoSubProjectile) {

---@param self CANTorpedoNanite01
---@param inWater boolean
OnCreate = function(self, inWater)
CTorpedoSubProjectile.OnCreate(self, inWater)
if inWater then
Expand All @@ -15,7 +16,8 @@ CANTorpedoNanite01 = ClassProjectile(CTorpedoSubProjectile) {
self:SetTurnRate(0)
end
end,


---@param self CANTorpedoNanite01
OnEnterWater = function(self)
CTorpedoSubProjectile.OnEnterWater(self)
self:SetBallisticAcceleration(0)
Expand Down
7 changes: 7 additions & 0 deletions projectiles/CANTorpedoNanite02/CANTorpedoNanite02_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
--****************************************************************************
local CTorpedoShipProjectile = import("/lua/cybranprojectiles.lua").CTorpedoShipProjectile

---@class CANTorpedoNanite02 : CTorpedoShipProjectile
CANTorpedoNanite02 = ClassProjectile(CTorpedoShipProjectile) {
TrailDelay = 0,

---@param self CANTorpedoNanite02
---@param inWater boolean
OnCreate = function(self, inWater)
CTorpedoShipProjectile.OnCreate(self, inWater)
self.Trash:Add(ForkThread( self.MovementThread,self ))
end,

---@param self CANTorpedoNanite02
MovementThread = function(self)
while not self:BeenDestroyed() and (self:GetDistanceToTarget() > 8) do
WaitTicks(3)
Expand All @@ -24,13 +29,15 @@ CANTorpedoNanite02 = ClassProjectile(CTorpedoShipProjectile) {
end
end,

---@param self CANTorpedoNanite02
GetDistanceToTarget = function(self)
local tpos = self:GetCurrentTargetPosition()
local mpos = self:GetPosition()
local dist = VDist2(mpos[1], mpos[3], tpos[1], tpos[3])
return dist
end,

---@param self CANTorpedoNanite02
OnEnterWater = function(self)
CTorpedoShipProjectile.OnEnterWater(self)
self:CreateImpactEffects(self.Army, self.FxEnterWater, self.FxSplashScale )
Expand Down
19 changes: 8 additions & 11 deletions projectiles/CANTorpedoNanite03/CANTorpedoNanite03_script.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
--****************************************************************************
--**
--** File : /data/projectiles/CANTorpedoNanite02/CANTorpedoNanite02_script.lua
--** Author(s): John Comes, David Tomandl, Jessica St. Croix, Gordon Duclos
--**
--** Summary : Cybran Anti-Navy Nanite Torpedo Script
-- Nanite Torpedo releases tiny nanites that do DoT
--**
--** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
-------------------------------------------------------------------------------------------------------
-- File : /data/projectiles/CANTorpedoNanite02/CANTorpedoNanite02_script.lua
-- Author(s): John Comes, David Tomandl, Jessica St. Croix, Gordon Duclos
-- Summary : Cybran Anti-Navy Nanite Torpedo Script Nanite Torpedo releases tiny nanites that do DoT
-- Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
-------------------------------------------------------------------------------------------------------
local CTorpedoShipProjectile = import("/lua/cybranprojectiles.lua").CTorpedoShipProjectile

--- Cybran Anti-Navy Nanite Torpedo Script Nanite Torpedo releases tiny nanites that do DoT
---@class CANTorpedoNanite03 : CTorpedoShipProjectile
CANTorpedoNanite03 = ClassProjectile(CTorpedoShipProjectile) {
CANTorpedoNanite03 = ClassProjectile(CTorpedoShipProjectile) {

---@param self CANTorpedoNanite03
OnEnterWater = function(self)
Expand Down
Loading

0 comments on commit a02ca89

Please sign in to comment.