Skip to content

Conversation

@Ally-for-Hire
Copy link
Contributor

This is a completely new take on the system more in-line with daktank. While I maintained engine cost, many other things have been changed. Major changes are:

  • Armor cost is now the actual effective armor for the front and side of the tank
  • New "Ammo" Cost takes the effective penetration and DPS output of all ammo on the vehicle, categorizes them into a "Ready Rack" and "Backup Rounds" with amount based on caliber, then makes them have cost based on effectiveness.
  • Fuel cost and base Firepower cost are now disregarded

I have a few reasons for this, the major one being that now the point system now accurately accounts for both realistic vehicles and customs! All realistic vehicles that I've tested are legal, with customs varying based on their actual stats, rather than just a mass test. This will be objectively an improvement for both TPG, and regular gameplay, as you don't have to just ignore points anymore!

I completely changed the mass based system to one based on the effective armor of vehicles, changed firepower cost to ammo types and amount accounting for what's actually usable and what's excess, removed references to fuel cost, many minor optimizations.
… This may be local MP/SP specific, but nonetheless, yay!
@Ally-for-Hire
Copy link
Contributor Author

i have to refactor this- it kind of grew out of the original scope and on re-read it's a little beyond upsetting :p

…d have more consistent scans, debug overlay changed a bit might change it back but im just glad the logic works atp holy. im still aware of a glitch that marks stuff as dirty if they parent details on spawn but for now im going to say this is in a good state
Fix dupe cache signatures and RPS init edge cases to keep armor points consistent across spawns
Clean up armor scan logic and contraption point bookkeeping for steadier results
Refresh readout labels and manufacturing cost display for clearer, friendlier UX
Add inline comments and formatting polish to keep the codebase approachable

This keeps the casual, tinkering‑friendly feel while making the system sturdier and easier to work with.
…hange (idk why this one happens it's only on one dupe), made cache clearing more general rather than just being armor,
Copy link
Collaborator

@KemGus KemGus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few things, that you might want to take a look at, other than that I don't see any issues really. Maybe honestly one issue i have is how long contraption legality file is, maybe split the system out (especially helpers to sh_ace_functions maybe?) or just an its own standalone file for that thing.

Also, I noticed that hooks don't have any comments, maybe could be worth explaining what it does for future generation


local ACE_CalcContraptionArmor -- ARMOR section
-- Ensure armor data is up to date and cached.
local function ACE_EnsureArmor(...) end -- ARMOR section
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a conflict between local function and global function definition? So at first it doesn't do anything I assume?

The hook at line ~1390 creates a closure that captures this empty local:

timer.Simple(0.05, function()
    ACE_EnsureArmor(con, ...)  -- calls the empty argument, not a function exactly
end)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like this:

--you define local function before everything.
local function ACE_EnsureArmor(...) end -- ARMOR section
--then you access empty function within registered hook
hook.Add("AdvDupe_FinishPasting", "ACE_ArmorInitOnDupePaste_Trimmed", function(...)
    timer.Simple(0.05, function()
        -- This closure captures the LOCAL empty function and not the global!
        ACE_EnsureArmor(con, con.GetACEBaseplate and con:GetACEBaseplate(), true)
    end)
end)
--And then you only define a function after it has been accessed, so I assume armor init may fail because of that (maybe explains "weird" issues you've been having)
function ACE_EnsureArmor(con, baseEnt, force)
    -- actual implementation
end

I am not sure if lua does that(sorry, haven't coded in a long time), but:

local ACE_EnsureArmor  -- init first

-- Later define it:
ACE_EnsureArmor = function(con, baseEnt, force)
    -- implementation
end

include("acf/client/cl_acfmenu_missileui.lua")

if not ACF then ACF = {} end
if not ACF.ChatMessageReceiver then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a duplicate code? I think we should keep it in cl_acfmenu_gui

end

-- Resolve ammo caliber in millimeters.
local function ACE_GetAmmoCaliberMm(bdata)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplication. The same function is defined in sv_contraptionlegality

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bro this IS sv_contraptionlegality

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local weightS = (sampleCount > 0) and (sideArea / sampleCount) or 0

for _, pt in ipairs(samples) do
local frontVal = losFiltered(pt - frontDir * 200, pt, comp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be a problem for large vehicles like ratte? I'd like to make sure that we cover for such issues.

I haven't tested whats the actual distance is, but maybe calculate contraption bounding box through CFW and then give a slightly longer trace than the bounding box to make sure?

so like:

local bounds = -- calculate max dimension of contraption
local traceDist = math.max(bounds * 1.5, 200)

@KemGus
Copy link
Collaborator

KemGus commented Jan 20, 2026

Also, linter, I saw fixes included just replacing tabs with spaces, aren't we supposed to use tabs instead of spaces?
@CheezusChrust

… logic into sv_pointshandling. contraptionlegality is now almost entirely just legality logic.
…ty marking bug fix, added point cost per round listing to readout.
…rice increases to most radars and price decrease for IRST because it's useless lol. more linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants