Skip to content

Commit

Permalink
docs: fixup and add some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Histalek committed Nov 27, 2024
1 parent 0b10806 commit 0bbe2e3
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 20 deletions.
4 changes: 2 additions & 2 deletions DESIGNGUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ The icons are always white on a transparent background, no other colors or backg

## Role Icons

Different to the shop icons the role icons do need mipmapping to allow for clean rescaling (TODO: more mipmapping filter information). Since the icons can be rendered quite large, they should be saved in a resolution of 512x512px. They are always white on transparent background without a shadow and a padding of x pixels.
Different to the shop icons the role icons do need mipmapping to allow for clean rescaling (TODO more mipmapping filter information). Since the icons can be rendered quite large, they should be saved in a resolution of 512x512px. They are always white on transparent background without a shadow and a padding of x pixels.

## Workshop

TODO: Link example files of workshop designs
TODO Link example files of workshop designs
2 changes: 1 addition & 1 deletion gamemodes/terrortown/gamemode/client/cl_equip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ local function PreqLabels(parent, x, y)
end
end

-- TODO add global limited
-- TODO: add global limited
tbl.bought = vgui.Create("DLabel", parent)
--tbl.bought:SetTooltip(GetTranslation("equip_help_stock"))
tbl.bought:CopyPos(tbl.credits)
Expand Down
2 changes: 1 addition & 1 deletion gamemodes/terrortown/gamemode/client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ net.Receive("TTT_RoleList", ReceiveRoleList)
function GM:ClearClientState()
self:HUDClear()

-- todo: stuff like this should be in their respective files inside the hooks
-- TODO: stuff like this should be in their respective files inside the hooks
-- maybe even the prepare round hook? this mess has to go

local client = LocalPlayer()
Expand Down
1 change: 1 addition & 0 deletions gamemodes/terrortown/gamemode/client/cl_player_ext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ end
net.Receive("TTT_Equipment", UpdateEquipment)

-- Deletes old avatars and caches new ones
-- TODO: I don't like that this is called "Cache" but really it refreshes ...
local function CacheAllPlayerAvatars(ply)
local plys = IsPlayer(ply) and { ply } or player.GetAll()

Expand Down
6 changes: 6 additions & 0 deletions gamemodes/terrortown/gamemode/client/cl_search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ net.Receive("TTT2SendConfirmMsg", function()
end

-- checking for bots
-- TODO: This is not how this works
-- see the note about bots here: https://wiki.facepunch.com/gmod/Player:SteamID64#description
-- GMOD uses Universe=1 Type=4 Instance=1 and an incrementing ID
-- we could theoretically check for this, but just setting an empty string
-- for every bot seems easier
-- ref: https://developer.valvesoftware.com/wiki/SteamID
if sid64 == "" then
sid64 = nil
end
Expand Down
4 changes: 2 additions & 2 deletions gamemodes/terrortown/gamemode/server/sv_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ function PrintResultMessage(result)
end
end

LANG.Msg("win_" .. result) -- TODO translation
ServerLog("Result: " .. result .. " wins.\n") -- TODO translation
LANG.Msg("win_" .. result) -- TODO: translation
ServerLog("Result: " .. result .. " wins.\n") -- TODO: translation

return
end
Expand Down
8 changes: 4 additions & 4 deletions gamemodes/terrortown/gamemode/server/sv_networking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function SendRoleListMessage(subrole, team, sids, ply_or_rf)
if
p:GetSubRoleData().disableSync
and rs == ROUND_ACTIVE
-- TODO this has to be reworked
-- TODO: this has to be reworked
and not p:RoleKnown()
---
-- @realm server
Expand Down Expand Up @@ -196,7 +196,7 @@ function SendConfirmedTeam(team, ply_or_rf)
end

local _func = function(p)
return p:RoleKnown() -- TODO rework
return p:RoleKnown() -- TODO: rework
end

SendTeamList(team, ply_or_rf, _func)
Expand Down Expand Up @@ -236,7 +236,7 @@ function SendFullStateUpdate()

if
not roleDataSyncTo.unknownTeam and teamSyncFrom == teamSyncTo
or plySyncFrom:RoleKnown() -- TODO rework
or plySyncFrom:RoleKnown() -- TODO: rework
or table.HasValue(roleDataSyncFrom.visibleForTeam, teamSyncTo)
or table.HasValue(roleDataSyncTo.networkRoles, roleDataSyncFrom)
or roleDataSyncFrom.isPublicRole
Expand Down Expand Up @@ -336,7 +336,7 @@ local function ttt_request_rolelist(plySyncTo)

if
not roleDataSyncTo.unknownTeam and plySyncFrom:GetTeam() == team
or plySyncFrom:RoleKnown() -- TODO rework
or plySyncFrom:RoleKnown() -- TODO: rework
or table.HasValue(roleDataSyncFrom.visibleForTeam, plySyncTo:GetTeam())
or table.HasValue(roleDataSyncTo.networkRoles, roleDataSyncFrom)
or roleDataSyncFrom.isPublicRole
Expand Down
2 changes: 1 addition & 1 deletion gamemodes/terrortown/gamemode/server/sv_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ function GM:PlayerDisconnected(ply)
ply:Kill()
end

-- TODO ?
-- TODO: ?
-- Prevent the disconnected player from being in the resends
ply:SetRole(ROLE_NONE)
end
Expand Down
2 changes: 1 addition & 1 deletion gamemodes/terrortown/gamemode/server/sv_player_ext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ function plymeta:AnimPerformGesture(act)
net.Broadcast()
end

-- TODO REMOVE THIS
-- TODO: REMOVE THIS (???)

hook.Add("TTTBeginRound", "TTT2GivePendingItems", function()
for ply, tbl in pairs(pendingItems) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ local function GetMSBColorForPlayer(ply)
end

function HUDELEMENT:Draw()
-- just update every 0.1 seconds; TODO maybe add a client ConVar
-- TODO: maybe add a client ConVar
-- just update every 0.1 seconds
if self.lastUpdate + 0.1 < CurTime() then
local plys = util.GetFilteredPlayers(function(ply)
return ply:WasActiveInRound()
Expand Down
6 changes: 4 additions & 2 deletions gamemodes/terrortown/gamemode/shared/sh_equip_items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ if SERVER then
for k = 1, #cachedTbl do
local equip = cachedTbl[k]

-- TODO: This is duplicated code from `sh_shop.lua` `shop.CanBuyEquipment()`
-- and additionally is missing checks for the various item limitations
if equip.notBuyable then
continue
end
Expand Down Expand Up @@ -1186,7 +1188,7 @@ if SERVER then

if fallback ~= roleData.name then
return
end -- TODO why? remove and replace SHOP_UNSET with index of the current role
end -- TODO: why? remove and replace SHOP_UNSET with index of the current role

---
-- @realm server
Expand Down Expand Up @@ -1380,7 +1382,7 @@ else -- CLIENT
Equipment = Equipment or {}

if not Equipment[subrole] then
GetEquipmentForRole(nil, subrole, true) -- TODO test
GetEquipmentForRole(nil, subrole, true) -- TODO: test
end

for _, equip in pairs(tbl) do
Expand Down
25 changes: 23 additions & 2 deletions gamemodes/terrortown/gamemode/shared/sh_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ REVIVAL_BITS = 2
-- @see roles.GetList
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function GetRoles()
return roles.GetList()
end
Expand All @@ -150,6 +151,7 @@ end
-- @see roles.GetList
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function SortRolesTable(tbl)
roles.SortTable(tbl)
end
Expand All @@ -161,6 +163,7 @@ end
-- @see roles.GetByIndex
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function GetRoleByIndex(index)
return roles.GetByIndex(index)
end
Expand All @@ -172,6 +175,7 @@ end
-- @see roles.GetByName
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function GetRoleByName(name)
return roles.GetByName(name)
end
Expand All @@ -183,6 +187,7 @@ end
-- @see roles.GetByAbbr
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function GetRoleByAbbr(abbr)
return roles.GetByAbbr(abbr)
end
Expand All @@ -194,6 +199,7 @@ end
-- @realm shared
-- @see ROLE:GetStartingCredits
-- @deprecated
-- TODO: Log Deprecation message
function GetStartingCredits(abbr)
local roleData = roles.GetByAbbr(abbr)

Expand All @@ -207,6 +213,7 @@ end
-- @realm shared
-- @see ROLE:IsShoppingRole
-- @deprecated
-- TODO: Log Deprecation message
function IsShoppingRole(subrole)
local roleData = roles.GetByIndex(subrole)

Expand All @@ -219,6 +226,7 @@ end
-- @realm shared
-- @see roles.GetShopRoles
-- @deprecated
-- TODO: Log Deprecation message
function GetShopRoles()
return roles.GetShopRoles()
end
Expand All @@ -230,6 +238,7 @@ end
-- @realm shared
-- @see ROLE:IsBaseRole
-- @deprecated
-- TODO: Log Deprecation message
function IsBaseRole(roleData)
return roleData:IsBaseRole()
end
Expand All @@ -241,6 +250,7 @@ end
-- @realm shared
-- @see ROLE:GetBaseRole
-- @deprecated
-- TODO: Log Deprecation message
function GetBaseRole(subrole)
return roles.GetByIndex(subrole):GetBaseRole()
end
Expand All @@ -254,6 +264,7 @@ if SERVER then
-- @realm server
-- @see ROLE:IsSelectable
-- @deprecated
-- TODO: Log Deprecation message
function IsRoleSelectable(roleData, avoidHook)
return roleData:IsSelectable(avoidHook)
end
Expand All @@ -266,6 +277,7 @@ end
-- @realm shared
-- @see ROLE:GetSubRoles
-- @deprecated
-- TODO: Log Deprecation message
function GetSubRoles(subrole)
local roleData = roles.GetByIndex(subrole)

Expand All @@ -279,6 +291,7 @@ end
-- @realm shared
-- @see roles.GetDefaultTeamRole
-- @deprecated
-- TODO: Log Deprecation message
function GetDefaultTeamRole(team)
return roles.GetDefaultTeamRole(team)
end
Expand All @@ -290,6 +303,7 @@ end
-- @realm shared
-- @see roles.GetDefaultTeamRoles
-- @deprecated
-- TODO: Log Deprecation message
function GetDefaultTeamRoles(team)
return roles.GetDefaultTeamRoles(team)
end
Expand All @@ -301,6 +315,7 @@ end
-- @realm shared
-- @see roles.GetTeamMembers
-- @deprecated
-- TODO: Log Deprecation message
function GetTeamMembers(team)
return roles.GetTeamMembers(team)
end
Expand All @@ -311,6 +326,7 @@ end
-- @realm shared
-- @see roles.GetWinTeams
-- @deprecated
-- TODO: Log Deprecation message
function GetWinTeams()
return roles.GetWinTeams()
end
Expand All @@ -321,6 +337,7 @@ end
-- @realm shared
-- @see roles.GetAvailableTeams
-- @deprecated
-- TODO: Log Deprecation message
function GetAvailableTeams()
return roles.GetAvailableTeams()
end
Expand All @@ -331,6 +348,7 @@ end
-- @realm shared
-- @see roles.GetSortedRoles
-- @deprecated
-- TODO: Log Deprecation message
function GetSortedRoles()
return roles.GetSortedRoles()
end
Expand Down Expand Up @@ -367,6 +385,7 @@ end
-- @return table list of @{Player}
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function GetTraitors()
local trs = {}
local plys = player.GetAll()
Expand All @@ -388,11 +407,12 @@ end
-- @return number
-- @realm shared
-- @deprecated
-- TODO: Log Deprecation message
function CountTraitors()
return #GetTraitors()
end

-- TODO move to client file
-- TODO: move to client file
if CLIENT then
local SafeTranslate

Expand Down Expand Up @@ -513,13 +533,14 @@ OPEN_NOTOGGLE = 4 -- movelinear
MUTE_NONE = 0
MUTE_TERROR = 1
MUTE_ALL = 2
MUTE_SPEC = 1002 -- TODO why not 3?
MUTE_SPEC = 1002 -- TODO: why not 3?

-- Drop On Death override types
DROP_ON_DEATH_TYPE_DEFAULT = 0
DROP_ON_DEATH_TYPE_FORCE = 1
DROP_ON_DEATH_TYPE_DENY = 2

-- TODO: Move to colors/global library/extension/class
COLOR_SPEC = Color(155, 155, 15)

COLOR_WHITE = Color(255, 255, 255, 255)
Expand Down
10 changes: 7 additions & 3 deletions lua/autorun/gs_crazyphysics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ end
-- Entity Crash Catcher v2
-- This script detects entities that are moving too fast, leading to a potential server crash
-- Original by code_gs, Ambro, DarthTealc, TheEMP, and LuaTenshi; v2 by code_gs
-- GitHub: https://github.com/Kefta/Entity-Crash-Catcher
-- GitHub: https://github.com/Kefta/gs_crazyphysics
-- Facepunch: http://facepunch.com/showthread.php?t=1347114
-- Webarchive (Jul 2016):
-- https://web.archive.org/web/20160715215105/https://facepunch.com/showthread.php?t=1347114

-- Use in conjunction with these convars:
RunConsoleCommand("sv_crazyphysics_defuse", "1")
RunConsoleCommand("sv_crazyphysics_remove", "1")
--RunConsoleCommand("sv_crazyphysics_warning", "1") -- Enable if you want to be warned about bodies being removed

-- TODO: Investigate possible improvements and move File to a better place?

------------------- Script -------------------
local function DebugMessage(
bRemove,
Expand Down Expand Up @@ -210,7 +214,7 @@ local function SetAbsVelocity(pEntity, vAbsVelocity)
-- First subtract out the parent's abs velocity to get a relative
-- velocity measured in world space
-- Transform relative velocity into parent space
-- FIXME
-- FIXME:
--pEntity:SetSaveValue("m_vecVelocity", (vAbsVelocity - pMoveParent:_GetAbsVelocity()):IRotate(pMoveParent:EntityToWorldTransform()))
pEntity:SetSaveValue("velocity", vAbsVelocity)
else
Expand Down Expand Up @@ -282,7 +286,7 @@ local function IdentifyCorpse(pCorpse)
end

if cv_ttt_announce_body_found:GetBool() then
if GetGlobalBool("ttt2_confirm_team") then -- TODO adjust the new messages
if GetGlobalBool("ttt2_confirm_team") then -- TODO: adjust the new messages
LANG.Msg("body_found", {
finder = "The Server",
victim = CORPSE.GetPlayerNick(pCorpse, nil) or pPlayer:GetName(),
Expand Down
2 changes: 2 additions & 0 deletions lua/ttt2/libraries/none.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
-- @author tkindanight
-- @module none

-- TODO: Rename to `global`? Maybe move (some) global vars here?

if SERVER then
AddCSLuaFile()
end
Expand Down

0 comments on commit 0bbe2e3

Please sign in to comment.