Skip to content

Commit

Permalink
rework init
Browse files Browse the repository at this point in the history
  • Loading branch information
KemGus committed Sep 25, 2023
1 parent d0a8239 commit 53ab4e7
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 31 deletions.
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/atrifle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("ATR", {
muzzleflash = "30mm_muzzleflash_noscale",
rofmod = 10,
year = 1917,
sound = "acf_extra/tankfx/gnomefather/7mm1.wav",
sound = "ace_weapons/multi_sound/7_62mm_multi.mp3",

} )

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/autocannon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("AC", {
muzzleflash = "30mm_muzzleflash_noscale",
rofmod = 0.35,
year = 1930,
sound = "weapons/acf_gun/ac_fire4.wav",
sound = "ace_weapons/multi_sound/30mm_multi.mp3",
noloader = true,
} )

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/autoloader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("AL", {
muzzleflash = "120mm_muzzleflash_noscale",
rofmod = 0.64,
year = 1946,
sound = "weapons/acf_gun/autoloader.wav",
sound = "ace_weapons/multi_sound/100mm_multi.mp3",
autosound = "acf_extra/tankfx/reload.wav",
noloader = true,
} )
Expand Down
13 changes: 11 additions & 2 deletions lua/acf/shared/guns/cannon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ ACF_defineGunClass("C", {
desc = ACFTranslation.GunClasses[4],
muzzleflash = "120mm_muzzleflash_noscale",
rofmod = 1.5,
sound = "weapons/acf_gun/cannon_new.wav",
maxrof = 19, -- maximum rounds per minute
sound = "ace_weapons/multi_sound/100mm_multi.mp3",

} )

Expand All @@ -21,6 +22,7 @@ ACF_defineGun("37mmC", { --id
weight = 95,
year = 1919,
rofmod = 1.4,
maxrof = 42, -- maximum rounds per minute
round = {
maxlength = 48,
propweight = 1.125
Expand All @@ -36,6 +38,7 @@ ACF_defineGun("50mmC", {
caliber = 5.0,
weight = 380,
year = 1935,
maxrof = 35, -- maximum rounds per minute
round = {
maxlength = 63,
propweight = 2.1
Expand All @@ -51,6 +54,7 @@ ACF_defineGun("75mmC", {
caliber = 7.5,
weight = 660,
year = 1942,
maxrof = 25, -- maximum rounds per minute
round = {
maxlength = 78,
propweight = 3.8
Expand All @@ -59,13 +63,14 @@ ACF_defineGun("75mmC", {

ACF_defineGun("85mmC", {
name = "85mm Cannon",
desc = "You can stop asking, we've got it now.",
desc = "Slightly better than 75, however may introduce problems to tanks, whose armor could stop 75mm. T-34-85 gun.",
model = "models/tankgun/tankgun_85mm.mdl",
sound = "ace_weapons/multi_sound/75mm_multi.mp3",
gunclass = "C",
caliber = 8.5,
weight = 1030,
year = 1944,
maxrof = 23, -- maximum rounds per minute
round = {
maxlength = 85.5,
propweight = 6.65
Expand All @@ -81,6 +86,7 @@ ACF_defineGun("100mmC", {
caliber = 10.0,
weight = 1400,
year = 1944,
maxrof = 19, -- maximum rounds per minute
round = {
maxlength = 93,
propweight = 9.5
Expand All @@ -96,6 +102,7 @@ ACF_defineGun("120mmC", {
caliber = 12.0,
weight = 2100,
year = 1955,
maxrof = 12, -- maximum rounds per minute
round = {
maxlength = 110,
propweight = 18
Expand All @@ -111,6 +118,7 @@ ACF_defineGun("140mmC", {
caliber = 14.0,
weight = 3900,
year = 1990,
maxrof = 8.5, -- maximum rounds per minute
round = {
maxlength = 127,
propweight = 28
Expand All @@ -126,6 +134,7 @@ ACF_defineGun("170mmC", {
caliber = 17.0,
weight = 7800,
year = 1990,
maxrof = 4, -- maximum rounds per minute
round = {
maxlength = 154,
propweight = 34
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/grenadelauncher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("GL", {
muzzleflash = "40mm_muzzleflash_noscale",
rofmod = 1,
year = 1970,
sound = "weapons/acf_gun/grenadelauncher.wav",
sound = "ace_weapons/multi_sound/12_7mm_multi.mp3",
nolights = true,
noloader = true,

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/heavymachinegun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("HMG", {
muzzleflash = "50cal_muzzleflash_noscale",
rofmod = 0.17,
year = 1935,
sound = "weapons/ACF_Gun/mg_fire3.wav",
sound = "ace_weapons/multi_sound/30mm_hmg_multi.mp3",
noloader = true,

longbarrel = {
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/machinegun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("MG", {
muzzleflash = "50cal_muzzleflash_noscale",
rofmod = 0.9,
year = 1910,
sound = "weapons/ACF_Gun/mg_fire4.wav",
sound = "ace_weapons/multi_sound/7_62mm_multi.mp3",
noloader = true,

} )
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/mortar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("MO", {
muzzleflash = "40mm_muzzleflash_noscale",
rofmod = 2,
year = 1915,
sound = "weapons/ACF_Gun/mortar_new.wav",
sound = "ace_weapons/multi_sound/40mm_multi.mp3",

} )

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/semiauto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("SA", {
muzzleflash = "30mm_muzzleflash_noscale",
rofmod = 0.5,
year = 1935,
sound = "acf_extra/tankfx/gnomefather/25mm1.wav",
sound = "ace_weapons/multi_sound/20mm_multi.mp3",
noloader = true,

} )
Expand Down
3 changes: 2 additions & 1 deletion lua/acf/shared/guns/shortcannon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ ACF_defineGunClass("SC", {
desc = ACFTranslation.GunClasses[13],
muzzleflash = "120mm_muzzleflash_noscale",
rofmod = 1.3,
maxrof = 25, -- maximum rounds per minute
year = 1915,
sound = "weapons/acf_gun/cannon_new.wav",
sound = "ace_weapons/multi_sound/100mm_multi.mp3",

} )

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/smokelauncher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACF_defineGunClass("SL", {
muzzleflash = "40mm_muzzleflash_noscale",
rofmod = 45,
year = 1941,
sound = "weapons/acf_gun/smoke_launch.wav",
sound = "ace_weapons/multi_sound/smoke_multi.mp3",
nolights = true
} )

Expand Down
2 changes: 1 addition & 1 deletion lua/acf/shared/guns/smoothcannon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ACF_defineGunClass("SBC", {
desc = ACFTranslation.GunClasses[15],
muzzleflash = "120mm_muzzleflash_noscale",
rofmod = 1.7,
sound = "acf_extra/ace/weapons/cannon/125mm_1.wav",
sound = "ace_weapons/multi_sound/120mm_multi.mp3",
year = 1960,

} )
Expand Down
46 changes: 43 additions & 3 deletions lua/entities/ace_crewseat_loader/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,62 @@ function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS);
self:SetUseType(SIMPLE_USE);
self:SetSolid(SOLID_VPHYSICS);
self:GetPhysicsObject():SetMass(80) --70 kilo people plus 3 kg seat + Equipment

self.Master = {}
self.ACF = {}
self.ACF.Health = 1
self.ACF.MaxHealth = 1
self.Stamina = 100 --initial stamina for crewseat
self.LinkedGun = nil
end

function ENT:DecreaseStamina()
local linkedGun = self.LinkedGun
--print("A")

function ENT:Think()
self:GetPhysicsObject():SetMass(65) --62 kilo people plus 3 kg seat, hooray
if IsValid(linkedGun) then
local bulletWeight = 0
local distanceToCrate = 0

if linkedGun.BulletData then
local ProjMass = linkedGun.BulletData.ProjMass
local PropMass = linkedGun.BulletData.PropMass
bulletWeight = ProjMass + PropMass -- in kgs
end

if IsValid(linkedGun.AmmoLink) then
local CurAmmo = linkedGun.CurAmmo -- current key in the table
distanceToCrate = linkedGun:GetPos():Distance(linkedGun.AmmoLink[CurAmmo]:GetPos()) -- in units
end

local distance_multiplier = 0.05
local staminaMultipliers = bulletWeight + distanceToCrate * distance_multiplier --* distanceToCrate
local staminaCost = 10 + staminaMultipliers -- take x points out of self.Stamina
self.Stamina = math.Round(self.Stamina - staminaCost) -- Update the instance variable
self.Stamina = math.max(self.Stamina, 20) -- so the gun doesn't take forever to reload, keep the second variable above 0
--print(self.Stamina)
end
end

function ENT:IncreaseStamina()

local staminaHeal = 0.5 -- adjust me
self.Stamina = self.Stamina + staminaHeal -- Update the instance variable

self.Stamina = math.Clamp(self.Stamina, 0, 100)

return self.Stamina
end

function ENT:Think()
if self.ACF.Health < self.ACF.MaxHealth * 0.989 then
ACF_HEKill( self, VectorRand() , 0)
ACF_HEKill(self, VectorRand(), 0)
self:EmitSound("npc/combine_soldier/die" .. tostring(math.random(1, 3)) .. ".wav")
end

self:IncreaseStamina()
print(self.Stamina)
end


Expand Down
Loading

0 comments on commit 53ab4e7

Please sign in to comment.