Skip to content

Commit

Permalink
Reload mechanics change
Browse files Browse the repository at this point in the history
Automatics now have a static cyclic rate defined per gun. No longer is the reload time or cyclic rate affected by the ammo being loaded.
Manually loaded weapons (Cannons, Howies, Mortars) reload based on the weight of the projectile being loaded.

Removed AttemptFire and combined with CanFire check
Added ACF.BaseReload -- Minimum reload time/Time it takes to move around a weightless object
Added ACF.MassToTime -- Conversion/multiplier of projectile mass to time to move a projectile
  • Loading branch information
Stooberton committed Mar 4, 2020
1 parent 15c556e commit e478438
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 198 deletions.
2 changes: 2 additions & 0 deletions lua/acf/base/acf_globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ do -- ACF global vars
ACF.MenuFunc = ACF.MenuFunc or {}
ACF.AmmoBlacklist = ACF.AmmoBlacklist or {}
ACF.Repositories = ACF.Repositories or {}
ACF.BaseReload = 1 -- Minimum reload time. Time it takes to move around a weightless projectile
ACF.MassToTime = 0.2 -- Conversion of projectile mass to time be moved around
ACF.DragDiv = 80 --Drag fudge factor
ACF.Scale = 1 --Scale factor for ACF in the game world
ACF.IllegalDisableTime = 30 -- Time in seconds for an entity to be disabled when it fails ACF_IsLegal
Expand Down
1 change: 1 addition & 0 deletions lua/acf/client/cl_ballistics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local function BulletFlight(Bullet)
Bullet.Effect:ApplyMovement(Bullet)
end

--debugoverlay.Line(Bullet.SimPosLast, Bullet.SimPos, 15, Color(255, 255, 0))
Bullet.LastThink = CurTime()
end

Expand Down
1 change: 1 addition & 0 deletions lua/acf/server/ballistics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ local function Trace(TraceData, Filter)
TraceData.filter = Filter
end

debugoverlay.Line(TraceData.start, T.HitPos, 15, Color(0, 255, 0))
return T
end

Expand Down
22 changes: 13 additions & 9 deletions lua/acf/shared/guns/autocannon.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--define the class
ACF_defineGunClass("AC", {
spread = 0.12,
spread = 0.25,
name = "Autocannon",
desc = "Autocannons have a rather high weight and bulk for the ammo they fire, but they can fire it extremely fast.",
muzzleflash = "auto_muzzleflash_noscale",
Expand All @@ -18,11 +18,12 @@ ACF_defineGun("20mmAC", {
model = "models/autocannon/autocannon_20mm.mdl",
caliber = 2.0,
gunclass = "AC",
weight = 225,
weight = 500,
year = 1930,
rofmod = 0.7,
magsize = 100,
magreload = 3,
magreload = 15,
Cyclic = 250,
round = {
maxlength = 32,
propweight = 0.13
Expand All @@ -35,11 +36,12 @@ ACF_defineGun("30mmAC", {
model = "models/autocannon/autocannon_30mm.mdl",
gunclass = "AC",
caliber = 3.0,
weight = 960,
weight = 1000,
year = 1935,
rofmod = 0.5,
magsize = 75,
magreload = 3,
magreload = 20,
Cyclic = 225,
round = {
maxlength = 39,
propweight = 0.350
Expand All @@ -56,7 +58,8 @@ ACF_defineGun("40mmAC", {
year = 1940,
rofmod = 0.48,
magsize = 30,
magreload = 3,
magreload = 25,
Cyclic = 200,
round = {
maxlength = 45,
propweight = 0.9
Expand All @@ -69,11 +72,12 @@ ACF_defineGun("50mmAC", {
model = "models/autocannon/autocannon_50mm.mdl",
gunclass = "AC",
caliber = 5.0,
weight = 2130,
weight = 2000,
year = 1965,
rofmod = 0.4,
magsize = 20,
magreload = 3,
magsize = 25,
Cyclic = 175,
magreload = 30,
round = {
maxlength = 52,
propweight = 1.2
Expand Down
4 changes: 4 additions & 0 deletions lua/acf/shared/guns/autoloader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ACF_defineGun("75mmAL", {
rofmod = 1,
magsize = 8,
magreload = 15,
Cyclic = 30,
round = {
maxlength = 78,
propweight = 3.8
Expand All @@ -40,6 +41,7 @@ ACF_defineGun("100mmAL", {
rofmod = 0.85,
magsize = 6,
magreload = 21,
Cyclic = 18,
round = {
maxlength = 93,
propweight = 9.5
Expand All @@ -57,6 +59,7 @@ ACF_defineGun("120mmAL", {
rofmod = 0.757,
magsize = 5,
magreload = 27,
Cyclic = 11,
round = {
maxlength = 110,
propweight = 18
Expand All @@ -74,6 +77,7 @@ ACF_defineGun("140mmAL", {
rofmod = 0.743,
magsize = 5,
magreload = 35,
Cyclic = 8,
round = {
maxlength = 127,
propweight = 28
Expand Down
3 changes: 2 additions & 1 deletion lua/acf/shared/guns/grenadelauncher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ ACF_defineGun("40mmGL", { --id
gunclass = "GL",
caliber = 4.0,
weight = 55,
magsize = 6,
magsize = 30,
magreload = 7.5,
year = 1970,
Cyclic = 200,
round = {
maxlength = 7.5,
propweight = 0.01
Expand Down
6 changes: 5 additions & 1 deletion lua/acf/shared/guns/heavymachinegun.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--define the class
ACF_defineGunClass("HMG", {
spread = 0.4,
spread = 1.3,
name = "Heavy Machinegun",
desc = "Designed as autocannons for aircraft, HMGs are rapid firing, lightweight, and compact but sacrifice accuracy, magazine size, and reload times. They excel at strafing and dogfighting.\nBecause of their long reload times and high rate of fire, it is best to aim BEFORE pushing the almighty fire switch.",
muzzleflash = "mg_muzzleflash_noscale",
Expand All @@ -27,6 +27,7 @@ ACF_defineGun("13mmHMG", {
rofmod = 3.3,
magsize = 35,
magreload = 6,
Cyclic = 550,
round = {
maxlength = 22,
propweight = 0.09
Expand All @@ -44,6 +45,7 @@ ACF_defineGun("20mmHMG", {
rofmod = 1.9, --at 1.5, 675rpm; at 2.0, 480rpm
magsize = 30,
magreload = 6,
Cyclic = 525,
round = {
maxlength = 30,
propweight = 0.12
Expand All @@ -61,6 +63,7 @@ ACF_defineGun("30mmHMG", {
rofmod = 1.1, --at 1.05, 495rpm;
magsize = 25,
magreload = 6,
Cyclic = 500,
round = {
maxlength = 37,
propweight = 0.35
Expand All @@ -78,6 +81,7 @@ ACF_defineGun("40mmHMG", {
rofmod = 0.95, --at 0.75, 455rpm
magsize = 20,
magreload = 8,
Cyclic = 475,
round = {
maxlength = 42,
propweight = 0.9
Expand Down
26 changes: 5 additions & 21 deletions lua/acf/shared/guns/machinegun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ ACF_defineGun("7.62mmMG", {
desc = "The 7.62mm is effective against infantry, but its usefulness against armor is laughable at best.",
model = "models/machinegun/machinegun_762mm.mdl",
gunclass = "MG",
canparent = true,
caliber = 0.762,
weight = 15,
year = 1930,
rofmod = 1.59,
magsize = 250,
magreload = 6,
magreload = 6, -- Time to reload in seconds
Cyclic = 700, -- Rounds per minute
round = {
maxlength = 13,
propweight = 0.04
Expand All @@ -35,13 +35,13 @@ ACF_defineGun("12.7mmMG", {
desc = "The 12.7mm MG is still light, finding its way into a lot of mountings, including on top of tanks.",
model = "models/machinegun/machinegun_127mm.mdl",
gunclass = "MG",
canparent = true,
caliber = 1.27,
weight = 30,
year = 1910,
rofmod = 1, --0.766
magsize = 150,
magreload = 6,
Cyclic = 600,
round = {
maxlength = 15.8,
propweight = 0.03
Expand All @@ -53,31 +53,15 @@ ACF_defineGun("14.5mmMG", {
desc = "The 14.5mm MG trades its smaller stablemates' rate of fire for more armor penetration and damage.",
model = "models/machinegun/machinegun_145mm.mdl",
gunclass = "MG",
canparent = true,
caliber = 1.45,
weight = 45,
year = 1932,
rofmod = 1, --0.722
magsize = 90,
magreload = 5,
Cyclic = 500,
round = {
maxlength = 19.5,
propweight = 0.04
}
})
--ACF_defineGun("20mmMG", {
--name = "20mm Machinegun",
--desc = "The 20mm MG is practically a cannon in its own right; the weight and recoil made it difficult to mount on light land vehicles, though it was adapted for use on both aircraft and ships.",
--model = "models/machinegun/machinegun_20mm.mdl",
--gunclass = "MG",
--caliber = 2.0,
--weight = 95,
--year = 1935,
--rofmod = 0.3,
--magsize = 50,
--magreload = 4,
--round = {
--maxlength = 22,
--propweight = 0.09
--}
--} )
})
50 changes: 9 additions & 41 deletions lua/acf/shared/guns/rotaryautocannon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ACF_defineGunClass("RAC", {
color = {135, 135, 135}
} )

--[[ What purpose does this serve? These don't even exist.
ACF_defineGun("14.5mmRAC", { --id
name = "14.5mm Rotary Autocannon",
desc = "A lightweight rotary autocannon, used primarily against infantry and light vehicles. It has a lower firerate than its larger brethren, but a significantly quicker cooldown period as well.",
Expand All @@ -27,6 +28,7 @@ ACF_defineGun("14.5mmRAC", { --id
propweight = 0.06
}
} )
]]--

ACF_defineGun("20mmRAC", {
name = "20mm Rotary Autocannon",
Expand All @@ -36,9 +38,10 @@ ACF_defineGun("20mmRAC", {
caliber = 2.0,
weight = 760,
year = 1965,
magsize = 40,
magreload = 7,
magsize = 200,
magreload = 25,
rofmod = 2.1,
Cyclic = 4000,
round = {
maxlength = 30,
propweight = 0.12
Expand All @@ -53,47 +56,12 @@ ACF_defineGun("30mmRAC", {
caliber = 3.0,
weight = 1500,
year = 1975,
magsize = 40,
magreload = 8,
magsize = 100,
magreload = 35,
rofmod = 1,
Cyclic = 3000,
round = {
maxlength = 40,
propweight = 0.350
}
} )


ACF_defineGun("20mmHRAC", {
name = "20mm Heavy Rotary Autocannon",
desc = "A reinforced, heavy-duty 20mm rotary autocannon, able to fire heavier rounds with a larger magazine. Phalanx.",
model = "models/rotarycannon/kw/20mmrac.mdl",
gunclass = "RAC",
caliber = 2.0,
weight = 1200,
year = 1981,
magsize = 60,
magreload = 4,
rofmod = 2.5,
round = {
maxlength = 36,
propweight = 0.12
}
} )

ACF_defineGun("30mmHRAC", {
name = "30mm Heavy Rotary Autocannon",
desc = "A reinforced, heavy duty 30mm rotary autocannon, able to fire heavier rounds with a larger magazine. Keeper of goals.",
model = "models/rotarycannon/kw/30mmrac.mdl",
gunclass = "RAC",
caliber = 3.0,
weight = 2850,
year = 1985,
magsize = 50,
magreload = 6,
rofmod = 1.2,
round = {
maxlength = 45,
propweight = 0.350
}
} )

} )

0 comments on commit e478438

Please sign in to comment.