From 5e0adf10a827d91beb17027e84474a3f9244d114 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:59:20 -0500 Subject: [PATCH] Redo fuel tank appearance As suggested by ghosteh This also adds an optional material parameter to the model panel's UpdateModel() since you otherwise can't draw the material on the tank --- lua/acf/entities/fuel_tanks/box.lua | 3 ++- lua/acf/menu/items_cl/engines.lua | 5 ++++- lua/entities/acf_fueltank/init.lua | 4 ++++ lua/vgui/acf_panel.lua | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lua/acf/entities/fuel_tanks/box.lua b/lua/acf/entities/fuel_tanks/box.lua index ef89f21f0..1a7a4b391 100644 --- a/lua/acf/entities/fuel_tanks/box.lua +++ b/lua/acf/entities/fuel_tanks/box.lua @@ -42,7 +42,8 @@ FuelTanks.Register("FTS_B", { Name = "Fuel Box", Description = "Scalable fuel box; required for engines to work.", IsScalable = true, - Model = "models/fueltank/fueltank_4x4x4.mdl", + Model = "models/holograms/hq_rcube.mdl", + Material = "models/props_canal/metalcrate001d", Shape = "Box", NameType = "Tank", IsExplosive = true, diff --git a/lua/acf/menu/items_cl/engines.lua b/lua/acf/menu/items_cl/engines.lua index d89714ac2..a80536be9 100644 --- a/lua/acf/menu/items_cl/engines.lua +++ b/lua/acf/menu/items_cl/engines.lua @@ -202,7 +202,10 @@ local function CreateMenu(Menu) ACF.SetClientData("FuelTank", Data.ID) - FuelPreview:UpdateModel(Data.Model or ClassData.Model) + local Model = Data.Model or ClassData.Model + local Material = Data.Material or ClassData.Material + + FuelPreview:UpdateModel(Model, Material) FuelPreview:UpdateSettings(Data.Preview or ClassData.Preview) FuelType:UpdateFuelText() diff --git a/lua/entities/acf_fueltank/init.lua b/lua/entities/acf_fueltank/init.lua index 625c84a7e..d1e503e88 100644 --- a/lua/entities/acf_fueltank/init.lua +++ b/lua/entities/acf_fueltank/init.lua @@ -188,6 +188,7 @@ do -- Spawn and Update functions local FuelType = FuelTypes.Get(Data.FuelType) local Limit = Class.LimitConVar.Name local Model = Class.Model or FuelTank and FuelTank.Model + local Material = Class.Material or FuelTank and FuelTank.Model if not Player:CheckLimit(Limit) then return end @@ -201,6 +202,9 @@ do -- Spawn and Update functions Tank:SetPlayer(Player) Tank:SetScaledModel(Model) + if Material then + Tank:SetMaterial(Material) + end Tank:SetAngles(Angle) Tank:SetPos(Pos) Tank:Spawn() diff --git a/lua/vgui/acf_panel.lua b/lua/vgui/acf_panel.lua index 8f95baaad..56fcc5396 100644 --- a/lua/vgui/acf_panel.lua +++ b/lua/vgui/acf_panel.lua @@ -320,7 +320,7 @@ function PANEL:AddModelPreview(Model, Rotate) self.NotDrawn = not Bool end - function Panel:UpdateModel(Path) + function Panel:UpdateModel(Path, Material) if not isstring(Path) then return self:DrawEntity(false) end @@ -364,6 +364,12 @@ function PANEL:AddModelPreview(Model, Rotate) self:DrawEntity(true) self:SetModel(Path) self:SetCamPos(Center + Vector(-self.CamDistance, 0, 0)) + + if Material then + local Entity = self:GetEntity() + + Entity:SetMaterial(Material) + end end function Panel:UpdateSettings(Data)