Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sound-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Dec 1, 2023
2 parents ab6f798 + 4e92462 commit 60e883c
Show file tree
Hide file tree
Showing 20 changed files with 737 additions and 707 deletions.
4 changes: 4 additions & 0 deletions lua/acf/core/classes/fuel_tanks/registration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ end
function FuelTanks.RegisterItem(ID, ClassID, Data)
local Class = Classes.AddGroupItem(ID, ClassID, Entries, Data)

if Class.Name == nil then
Class.Name = "Fuel Box"
end

if Class.IsExplosive == nil then
Class.IsExplosive = true
end
Expand Down
3 changes: 3 additions & 0 deletions lua/acf/core/globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ do -- ACF global vars
ACF.RequireFuel = true -- Whether or not fuel usage should be required for engines
ACF.FuelRate = 27.8 -- Multiplier for fuel usage, 1.0 is approx real world
ACF.FuelFactor = 1 -- Multiplier for ACF.FuelRate
ACF.FuelMinSize = 6 -- Defines the shortest possible length of fuel tanks for all their axises, in gmu
ACF.FuelMaxSize = 96 -- Defines the highest possible length of fuel tanks for all their axises, in gmu
ACF.FuelArmor = 5 -- How many millimeters of armor fuel tanks have
ACF.TankVolumeMul = 1 -- Multiplier for fuel tank capacity, 1.0 is approx real world
ACF.LiIonED = 0.458 -- li-ion energy density: kw hours / liter
ACF.RefillDistance = 300 -- Distance in which ammo crate starts refilling.
Expand Down
335 changes: 335 additions & 0 deletions lua/acf/entities/fuel_tanks/box.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
local FuelTanks = ACF.Classes.FuelTanks

-- Preserving flavor text from older fuel tank sizes
local FuelDescSentences = {
"Seriously consider walking.",
"Will keep a kart running all day.",
"Dinghy.",
"Outboard motor.",
"Clown car.",
"Fuel pancake.",
"Lawn tractors.",
"Small tractor tank.",
"Fuel. Will keep you going for awhile.",
"Gas stations? We don't need no stinking gas stations!",
"Beep beep.",
"Mini Cooper.",
"Good bit of go-juice.",
"Land boat.",
"Conformal fuel tank; fits narrow spaces.",
"Compact car.",
"Sedan.",
"Truck.",
"With great capacity, comes great responsibili--VROOOOM",
"Popular with arsonists.",
"Fire juice.",
"Trees are gay anyway.",
"Arson material.",
"What's a gas station?",
"\'MURRICA FUCKYEAH!",
"Got gas?",
"Drive across the desert without a fuck to give.",
"May contain Mesozoic ghosts.",
"Conformal fuel tank; does what all its friends do.",
"Certified 100% dinosaur juice.",
"Will last you a while.",
"Sloshy sloshy!",
"What's global warming?",
"Tank Tank.",
}

FuelTanks.Register("FTS_B", {
Name = "Fuel Box",
Description = "Scalable fuel box; required for engines to work.",
IsScalable = true,
Model = "models/fueltank/fueltank_4x4x4.mdl",
Shape = "Box",
NameType = "Tank",
IsExplosive = true,
Unlinkable = false,
Preview = {
FOV = 120,
},
CalcVolume = function(Size, Wall)
local InteriorVolume = (Size.x - Wall) * (Size.y - Wall) * (Size.z - Wall) -- Math degree

local Area = (2 * Size.x * Size.y) + (2 * Size.y * Size.z) + (2 * Size.x * Size.z)
local Volume = InteriorVolume - (Area * Wall)

return Volume, Area
end,
CalcOverlaySize = function(Entity)
local X, Y, Z = Entity:GetSize():Unpack()
X = math.Round(X, 2)
Y = math.Round(Y, 2)
Z = math.Round(Z, 2)

return "Size: " .. X .. "x" .. Y .. "x" .. Z .. "\n\n"
end,
MenuSettings = function(SizeX, SizeY, SizeZ, FuelList)
SizeX:SetVisible(true)
SizeY:SetVisible(true)
SizeZ:SetVisible(true)
FuelList:SetVisible(false)

SizeX:SetText("Tank Length")
SizeZ:SetText("Tank Height")
end,
FuelDescText = function()
return FuelDescSentences[math.random(33)]
end
})

do
FuelTanks.RegisterItem("Box", "FTS_B", {
Name = "Fuel Box",
Description = "", -- Blank to allow for dynamic descriptions better
})
end

-- NOTE: The X and Y values for older containers are swapped on purpose to match old model shapes

do -- Size 1 container compatibility
FuelTanks.AddAlias("FTS_B", "FTS_1")

FuelTanks.RegisterItem("Tank_1x1x1", "FTS_B", {
Size = Vector(10, 10, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x1x2", "FTS_B", {
Size = Vector(10, 10, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x1x4", "FTS_B", {
Size = Vector(10, 10, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x2x1", "FTS_B", {
Size = Vector(20, 10, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x2x2", "FTS_B", {
Size = Vector(20, 10, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x2x4", "FTS_B", {
Size = Vector(20, 10, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x4x1", "FTS_B", {
Size = Vector(40, 10, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x4x2", "FTS_B", {
Size = Vector(40, 10, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x4x4", "FTS_B", {
Size = Vector(40, 10, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x6x1", "FTS_B", {
Size = Vector(60, 10, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x6x2", "FTS_B", {
Size = Vector(60, 10, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x6x4", "FTS_B", {
Size = Vector(60, 10, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x8x1", "FTS_B", {
Size = Vector(80, 10, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x8x2", "FTS_B", {
Size = Vector(80, 10, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_1x8x4", "FTS_B", {
Size = Vector(80, 10, 40),
Shape = "Box"
})
end

do -- Size 2 container compatibility
FuelTanks.AddAlias("FTS_B", "FTS_2")

FuelTanks.RegisterItem("Tank_2x2x1", "FTS_B", {
Size = Vector(20, 20, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x2x2", "FTS_B", {
Size = Vector(20, 20, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x2x4", "FTS_B", {
Size = Vector(20, 20, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x4x1", "FTS_B", {
Size = Vector(40, 20, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x4x2", "FTS_B", {
Size = Vector(40, 20, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x4x4", "FTS_B", {
Size = Vector(40, 20, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x6x1", "FTS_B", {
Size = Vector(60, 20, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x6x2", "FTS_B", {
Size = Vector(60, 20, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x6x4", "FTS_B", {
Size = Vector(60, 20, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x8x1", "FTS_B", {
Size = Vector(80, 20, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x8x2", "FTS_B", {
Size = Vector(80, 20, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_2x8x4", "FTS_B", {
Size = Vector(80, 20, 40),
Shape = "Box"
})
end

do -- Size 4 container compatibility
FuelTanks.AddAlias("FTS_B", "FTS_4")

FuelTanks.RegisterItem("Tank_4x4x1", "FTS_B", {
Size = Vector(40, 40, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x4x2", "FTS_B", {
Size = Vector(40, 40, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x4x4", "FTS_B", {
Size = Vector(40, 40, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x6x1", "FTS_B", {
Size = Vector(60, 40, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x6x2", "FTS_B", {
Size = Vector(60, 40, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x6x4", "FTS_B", {
Size = Vector(60, 40, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x8x1", "FTS_B", {
Size = Vector(80, 40, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x8x2", "FTS_B", {
Size = Vector(80, 40, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_4x8x4", "FTS_B", {
Size = Vector(80, 40, 40),
Shape = "Box"
})
end

do -- Size 6 container compatibility
FuelTanks.AddAlias("FTS_B", "FTS_6")

FuelTanks.RegisterItem("Tank_6x6x1", "FTS_B", {
Size = Vector(60, 60, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_6x6x2", "FTS_B", {
Size = Vector(60, 60, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_6x6x4", "FTS_B", {
Size = Vector(60, 60, 40),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_6x8x1", "FTS_B", {
Size = Vector(80, 60, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_6x8x2", "FTS_B", {
Size = Vector(80, 60, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_6x8x4", "FTS_B", {
Size = Vector(80, 60, 40),
Shape = "Box"
})
end

do -- Size 8 container compatibility
FuelTanks.AddAlias("FTS_B", "FTS_8")

FuelTanks.RegisterItem("Tank_8x8x1", "FTS_B", {
Size = Vector(80, 80, 10),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_8x8x2", "FTS_B", {
Size = Vector(80, 80, 20),
Shape = "Box"
})

FuelTanks.RegisterItem("Tank_8x8x4", "FTS_B", {
Size = Vector(80, 80, 40),
Shape = "Box"
})
end
Loading

0 comments on commit 60e883c

Please sign in to comment.