Skip to content
32 changes: 31 additions & 1 deletion lua/acf/client/cl_acemenu_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,11 @@ function PANEL:Init( )
]]--==================================================

local extrasNode = HomeNode:AddNode("Extras", "icon16/bricks.png")
local apsNode = HomeNode:AddNode("APS", "icon16/shield.png")

for _, ExtrasData in pairs(FinalContainer["Extras"] or {}) do
local ItemNode = extrasNode:AddNode(ExtrasData.name or "No Name", ItemIcon2)
local ParentNode = ExtrasData.category == "APS" and apsNode or extrasNode
local ItemNode = ParentNode:AddNode(ExtrasData.name or "No Name", ItemIcon2)
ItemNode.mytable = ExtrasData

function ItemNode:DoClick()
Expand Down Expand Up @@ -473,6 +475,34 @@ function PANEL:QueueRoundCostPreview()

end

function ACE.APSMenuGUICreate(data)
local defaults = data.apsconfig or {1, 3, 5, 1, 90, 45}
local labels = {"Charges", "Kill range (m)", "Reload time (s)", "Radar size", "Yaw coverage", "Pitch coverage"}
local minimums = {1, 0.5, 0.1, 1, 1, 1}
local maximums = {8, 30, 60, 3, 180, 90}
local decimals = {0, 1, 1, 0, 0, 0}

acemenupanel:CPanelText("APSDescription", data.desc or "Configure this active protection system.")

for index, label in ipairs(labels) do
local slider = vgui.Create("DNumSlider")
slider:SetText(label)
slider:SetDark(true)
slider:SetMin(minimums[index])
slider:SetMax(maximums[index])
slider:SetDecimals(decimals[index])
slider:SetValue(defaults[index])
function slider:OnValueChanged(value)
RunConsoleCommand("acemenu_data" .. index, tostring(value))
end
acemenupanel.CustomDisplay:AddItem(slider)
RunConsoleCommand("acemenu_data" .. index, tostring(defaults[index]))
end
RunConsoleCommand("acemenu_data7", data.apspreset or "Custom Static")

acemenupanel:CPanelText("APSRadarSizes", "Radar size: 1 = small, 2 = medium, 3 = large.")
end

function PANEL:UpdateDisplay( Table )

RunConsoleCommand( "acemenu_id", Table.id or 0 )
Expand Down
5 changes: 4 additions & 1 deletion lua/acf/server/sv_contraptionlegality.lua
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,11 @@ function ACE.MarkArmorDirty(con, ent, reason)
}, { con }, ledgerKnown)
end

-- Keep the legacy wrapper pointed at the implementation even when the
-- compatibility loader aliases it back onto ACE.MarkArmorDirty.
local ACE_MarkArmorDirtyImplementation = ACE.MarkArmorDirty
function ACE_MarkArmorDirty(con, ent, reason)
return ACE.MarkArmorDirty(con, ent, reason)
return ACE_MarkArmorDirtyImplementation(con, ent, reason)
end

-- Reprice clipped armor after Proper Clipping replaces its physics object.
Expand Down
36 changes: 36 additions & 0 deletions lua/acf/shared/extras/extras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,39 @@ ACE.DefineExtras("GForceMeter", {
weight = 2,
acepoints = 0,
})

ACE.DefineExtras("APS_Static", {
name = "Static APS",
ent = "ace_aps_static",
category = "APS",
desc = "Configurable static APS with onboard directional anti-missile radar. Link ACF guns and compatible ammunition, then configure charges, range, reload, radar size, and coverage.",
model = "models/golem/Zaslin_APS.mdl",
weight = 25,
acepoints = 0,
apsconfig = {1, 3, 5, 1, 90, 45},
apspreset = "Static",
guicreate = function(_, data) ACE.APSMenuGUICreate(data) end,
})

ACE.DefineExtras("APS_Zaslin", {
name = "Zaslin APS",
ent = "ace_aps_static",
category = "APS",
desc = "Zaslin preset: small onboard directional anti-missile radar, linked ammunition, and a 15-second APS reload.",
model = "models/golem/Zaslin_APS.mdl",
weight = 25,
acepoints = 0,
apsconfig = {1, 3, 15, 1, 90, 45},
apspreset = "Zaslin",
guicreate = function(_, data) ACE.APSMenuGUICreate(data) end,
})

ACE.DefineExtras("APS_Gimbal", {
name = "APS (Gimbal)",
ent = "ace_aps_gimbal",
category = "APS",
desc = "A gimbal active protection system. Link missile radars and the configured number of ACF guns; yaw and pitch limits determine when each gun can fire.",
model = "models/props_lab/reciever01a.mdl",
weight = 25,
acepoints = 0,
})
11 changes: 11 additions & 0 deletions lua/autorun/battlepod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ local V = {
},
}
list.Set( "Vehicles", "ACE_pilotseat", V )

-- Keep old dupes using the former ACF vehicle key without adding a duplicate spawn-menu entry.
local Vehicles = list.GetForEdit( "Vehicles" )
local VehiclesMeta = getmetatable( Vehicles ) or {}
local VehiclesIndex = VehiclesMeta.__index
VehiclesMeta.__index = function( self, key )
if key == "acf_pilotseat" then return rawget( self, "ACE_pilotseat" ) end
if isfunction( VehiclesIndex ) then return VehiclesIndex( self, key ) end
if istable( VehiclesIndex ) then return VehiclesIndex[ key ] end
end
setmetatable( Vehicles, VehiclesMeta )
27 changes: 27 additions & 0 deletions lua/entities/ace_aps/cl_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
include("shared.lua")

function ENT:Draw()
self:DoNormalDraw(false, false)
Wire_Render(self)
end

hook.Add("PostDrawHalos", "ACE_APSNetworkHalos", function()
local trace = LocalPlayer():GetEyeTrace()
local entity = trace.Entity
if not IsValid(entity) then return end

local encoded = entity:GetNW2String("ACEAPSNetworkEntities", "")
if encoded == "" then return end

local highlighted = {}
for id in string.gmatch(encoded, "%d+") do
local target = Entity(tonumber(id))
if IsValid(target) then
highlighted[#highlighted + 1] = target
end
end

if #highlighted > 0 then
halo.Add(highlighted, Color(0, 255, 128), 2, 2, 1, true, true)
end
end)
Loading
Loading