-
Notifications
You must be signed in to change notification settings - Fork 29
Complete refactorization and improvement to "Points System" #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Complete refactorization and improvement to "Points System" #228
Conversation
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!
|
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,
KemGus
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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)There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
sorry, my bad, here it is
| local weightS = (sampleCount > 0) and (sideArea / sampleCount) or 0 | ||
|
|
||
| for _, pt in ipairs(samples) do | ||
| local frontVal = losFiltered(pt - frontDir * 200, pt, comp) |
There was a problem hiding this comment.
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)|
Also, linter, I saw fixes included just replacing tabs with spaces, aren't we supposed to use tabs instead of spaces? |
… 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
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:
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!