Skip to content

AddonChecker: added base checking #1425

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions gamemodes/terrortown/gamemode/server/sv_addonchecker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ function addonChecker.Check()
print("TTT2 ADDON CHECKER")
print("=============================================================")
print("")
print("Scanning for known incompatible addons:")

for i = 1, #addonTable do
local addon = addonTable[i]
Expand Down Expand Up @@ -693,6 +694,42 @@ function addonChecker.Check()
print("")
end

print("=============================================================")
print("")
print("Scanning for weapons with incorrect weapon base:")

local equipmentWeapons = weapons.GetList()

for i = 1, #equipmentWeapons do
local equipment = equipmentWeapons[i]
local name = WEPS.GetClass(equipment)

if
name and not equipment.Duplicated and weapons.IsBasedOn(name, "weapon_tttbase")
-- ignore bases as they are not added to the shop anyways
or string.match(name, "base")
or string.match(name, "event")
-- ignore weapons that are not in the terrortown folder
or not string.match(equipment.Folder, "terrortown/")
then
continue
end

print(
"Warning: "
.. name
.. " is not based on 'weapon_tttbase', this may lead to issues when playing the game"
)
print("Location: " .. equipment.Folder)

if equipment.Author and equipment.Author ~= "" then
print("Author: " .. equipment.Author)
end

print("")
end

print("")
print("=============================================================")
print("This is the end of the addon checker output.")
print("")
Expand Down