Skip to content

Commit

Permalink
Add model previews for turret entities
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Mar 15, 2024
1 parent 60cbefc commit 1b3ef82
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lua/acf/entities/turrets/turrets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ do -- Turret drives
Model = "models/acf/core/t_trun.mdl",
Mass = 25, -- At default size, this is the mass of the turret ring. Will scale up/down with diameter difference

Preview = {
FOV = 105,
},

Size = {
Base = 12, -- The default size for the menu
Min = 4, -- To accomodate itty bitty RWS turrets
Expand Down Expand Up @@ -293,6 +297,10 @@ do -- Turret motors
Model = "models/acf/core/t_drive_e.mdl",
Sound = "acf_base/fx/turret_electric.wav",

Preview = {
FOV = 100,
},

Mass = 60, -- Base mass, will be further modified by settings
Speed = 720, -- Base speed, this will/not/change, and is used in calculating the final speed after teeth calculation
Efficiency = 0.9,
Expand Down Expand Up @@ -324,6 +332,10 @@ do -- Turret motors
Model = "models/acf/core/t_drive_h.mdl",
Sound = "acf_base/fx/turret_hydraulic.wav",

Preview = {
FOV = 100,
},

Mass = 80, -- Base mass, will be further modified by settings
Speed = 360, -- Base speed, this will/not/change, and is used in calculating the final speed after teeth calculation
Efficiency = 0.98,
Expand Down Expand Up @@ -374,6 +386,10 @@ do -- Turret gyroscopes
Description = "A component that will stabilize one turret drive.\nMust be parented to or share the parent with the linked turret drive.\nMust have a motor linked to the turret drive.",
Model = "models/bull/various/gyroscope.mdl",

Preview = {
FOV = 125,
},

Mass = 75,
IsDual = false,
})
Expand All @@ -383,6 +399,10 @@ do -- Turret gyroscopes
Description = "A component that will stabilize one vertical and horizontal turret drive.\nMust be parented to or share the parent with the horizontal turret drive.\nEach turret drive must have a motor linked.",
Model = "models/acf/core/t_gyro.mdl",

Preview = {
FOV = 90,
},

Mass = 150,
IsDual = true,
})
Expand Down Expand Up @@ -418,6 +438,10 @@ do -- Turret computers
Description = "A component that is capable of calculating the angle required to shoot a weapon to hit a spot within view.\nThis is capable of constantly calculating to track a target at a constant velocity, as long as Calculate is true.\nHas a 2s delay between uses.",
Model = "models/acf/core/t_computer.mdl",

Preview = {
FOV = 100,
},

Mass = 100,

ComputerInfo = {
Expand All @@ -437,6 +461,10 @@ do -- Turret computers
Description = "A component that is capable of calculating the angle required to shoot a weapon to hit a spot out of view.\nHas a 3s delay between uses.",
Model = "models/acf/core/t_computer.mdl",

Preview = {
FOV = 100,
},

Mass = 150,

ComputerInfo = {
Expand Down
4 changes: 4 additions & 0 deletions lua/acf/menu/items_cl/turret_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local function CreateMenu(Menu)
local Base = Menu:AddCollapsible("Turret Components")
local ComponentName = Base:AddTitle()
local ComponentDesc = Base:AddLabel()
local ComponentPreview = Base:AddModelPreview(_, true)

function ClassList:OnSelect(Index, _, Data)
if self.Selected == Data then return end
Expand All @@ -46,6 +47,9 @@ local function CreateMenu(Menu)
ComponentName:SetText(Data.Name)
ComponentDesc:SetText(Data.Description or "No description provided.")

ComponentPreview:UpdateModel(Data.Model)
ComponentPreview:UpdateSettings(Data.Preview)

Menu:ClearTemporal(Base)
Menu:StartTemporal(Base)

Expand Down

0 comments on commit 1b3ef82

Please sign in to comment.