mirror of
https://github.com/CapsAdmin/pac3.git
synced 2025-03-04 03:03:01 -05:00
Add more localization and remove unused (#1258)
* Add more localization and remove unused * Remove unessary locals and add more
This commit is contained in:
parent
1b5be005f7
commit
374dfa8214
@ -1,20 +1,16 @@
|
||||
local render_OverrideAlphaWriteEnable = render.OverrideAlphaWriteEnable
|
||||
local render_OverrideColorWriteEnable = render.OverrideColorWriteEnable
|
||||
local render_OverrideBlendFunc = render.OverrideBlendFunc
|
||||
local ProtectedCall = ProtectedCall
|
||||
local cam_IgnoreZ = cam.IgnoreZ
|
||||
local pac = pac
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local table = table
|
||||
local Vector = Vector
|
||||
local Angle = Angle
|
||||
local Color = Color
|
||||
local NULL = NULL
|
||||
local SysTime = SysTime
|
||||
local TEXFILTER_POINT = TEXFILTER.POINT
|
||||
local render_PopFilterMag = render.PopFilterMag
|
||||
local render_PopFilterMin = render.PopFilterMin
|
||||
local render_PushFilterMin = render.PushFilterMin
|
||||
local render_PushFilterMag = render.PushFilterMag
|
||||
local LocalToWorld = LocalToWorld
|
||||
local cam_IgnoreZ = cam.IgnoreZ
|
||||
local render_OverrideBlendFunc = render.OverrideBlendFunc
|
||||
|
||||
local BUILDER, PART = pac.PartTemplate("base_movable")
|
||||
|
||||
@ -85,25 +81,25 @@ do
|
||||
)
|
||||
|
||||
if self.blend_override[5] then
|
||||
render.OverrideAlphaWriteEnable(true, self.blend_override[5] == "write_alpha")
|
||||
render_OverrideAlphaWriteEnable(true, self.blend_override[5] == "write_alpha")
|
||||
end
|
||||
|
||||
if self.blend_override[6] then
|
||||
render.OverrideColorWriteEnable(true, self.blend_override[6] == "write_color")
|
||||
render_OverrideColorWriteEnable(true, self.blend_override[6] == "write_color")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PART:StopBlend()
|
||||
if self.blend_override then
|
||||
render.OverrideBlendFunc(false)
|
||||
render_OverrideBlendFunc(false)
|
||||
|
||||
if self.blend_override[5] then
|
||||
render.OverrideAlphaWriteEnable(false)
|
||||
render_OverrideAlphaWriteEnable(false)
|
||||
end
|
||||
|
||||
if self.blend_override[6] then
|
||||
render.OverrideColorWriteEnable(false)
|
||||
render_OverrideColorWriteEnable(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -200,7 +196,7 @@ function PART:Draw(draw_type)
|
||||
|
||||
self:StopBlend()
|
||||
|
||||
if self.IgnoreZ then cam.IgnoreZ(false) end
|
||||
if self.IgnoreZ then cam_IgnoreZ(false) end
|
||||
|
||||
if not self.HandleModifiersManually then self:ModifiersPostEvent('OnDraw', draw_type) end
|
||||
end
|
||||
|
@ -1,18 +1,24 @@
|
||||
local string_format = string.format
|
||||
local tostring = tostring
|
||||
local pace = pace
|
||||
local assert = assert
|
||||
local debug_traceback = debug.traceback
|
||||
local math_random = math.random
|
||||
local xpcall = xpcall
|
||||
local pac = pac
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local table = table
|
||||
local Color = Color
|
||||
local NULL = NULL
|
||||
local IsValid = IsValid
|
||||
local ErrorNoHalt = ErrorNoHalt
|
||||
local table_insert = table.insert
|
||||
|
||||
local BUILDER, PART = pac.PartTemplate()
|
||||
|
||||
PART.ClassName = "base"
|
||||
|
||||
function PART:__tostring()
|
||||
return string.format("part[%s][%s][%i]", self.ClassName, self:GetName(), self.Id)
|
||||
return string_format("part[%s][%s][%i]", self.ClassName, self:GetName(), self.Id)
|
||||
end
|
||||
|
||||
BUILDER
|
||||
@ -375,7 +381,7 @@ do -- scene graph
|
||||
|
||||
if not part:HasChild(self) then
|
||||
self.ChildrenMap[part] = part
|
||||
table.insert(self.Children, part)
|
||||
table_insert(self.Children, part)
|
||||
end
|
||||
|
||||
self:InvalidateChildrenList()
|
||||
@ -671,7 +677,7 @@ do -- hidden / events
|
||||
local found = {}
|
||||
|
||||
for part in pairs(self.active_events) do
|
||||
table.insert(found, tostring(part) .. " is event hiding")
|
||||
table_insert(found, tostring(part) .. " is event hiding")
|
||||
end
|
||||
|
||||
if found[1] then
|
||||
@ -797,7 +803,7 @@ do -- serializing
|
||||
goto CONTINUE
|
||||
end
|
||||
|
||||
table.insert(out, {
|
||||
table_insert(out, {
|
||||
key = key,
|
||||
set = function(v) self["Set" .. key](self, v) end,
|
||||
get = function() return self["Get" .. key](self) end,
|
||||
@ -813,7 +819,7 @@ do -- serializing
|
||||
if props then
|
||||
for _, info in pairs(props) do
|
||||
if not self.PropertyWhitelist or self.PropertyWhitelist[info.key] then
|
||||
table.insert(out, info)
|
||||
table_insert(out, info)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -826,7 +832,7 @@ do -- serializing
|
||||
for _, prop in ipairs(out) do
|
||||
if key == prop.key then
|
||||
if not done[key] then
|
||||
table.insert(sorted, prop)
|
||||
table_insert(sorted, prop)
|
||||
done[key] = true
|
||||
break
|
||||
end
|
||||
@ -839,7 +845,7 @@ do -- serializing
|
||||
for _, prop in ipairs(out) do
|
||||
if key == prop.key then
|
||||
if not done[key] then
|
||||
table.insert(sorted, prop)
|
||||
table_insert(sorted, prop)
|
||||
done[key] = true
|
||||
break
|
||||
end
|
||||
@ -853,7 +859,7 @@ do -- serializing
|
||||
for _, prop in ipairs(out) do
|
||||
if key == prop.key then
|
||||
if not done[key] then
|
||||
table.insert(sorted, prop)
|
||||
table_insert(sorted, prop)
|
||||
done[key] = true
|
||||
break
|
||||
end
|
||||
@ -864,7 +870,7 @@ do -- serializing
|
||||
|
||||
for _, prop in ipairs(out) do
|
||||
if not done[prop.key] then
|
||||
table.insert(sorted, prop)
|
||||
table_insert(sorted, prop)
|
||||
end
|
||||
end
|
||||
|
||||
@ -873,7 +879,7 @@ do -- serializing
|
||||
end
|
||||
|
||||
local function on_error(msg)
|
||||
ErrorNoHalt(debug.traceback(msg))
|
||||
ErrorNoHalt(debug_traceback(msg))
|
||||
end
|
||||
|
||||
do
|
||||
@ -886,7 +892,7 @@ do -- serializing
|
||||
|
||||
if self["Set" .. key] then
|
||||
if key == "Material" then
|
||||
table.insert(self.delayed_variables, {key = key, val = value})
|
||||
table_insert(self.delayed_variables, {key = key, val = value})
|
||||
end
|
||||
self["Set" .. key](self, value)
|
||||
elseif key ~= "ClassName" then
|
||||
@ -904,7 +910,7 @@ do -- serializing
|
||||
|
||||
local function make_copy(tbl, pepper)
|
||||
if pepper == true then
|
||||
pepper = tostring(math.random()) .. tostring(math.random())
|
||||
pepper = tostring(math_random()) .. tostring(math_random())
|
||||
end
|
||||
|
||||
for key, val in pairs(tbl.self) do
|
||||
@ -965,7 +971,7 @@ do -- serializing
|
||||
if not self.is_valid or self.is_deattached then
|
||||
|
||||
else
|
||||
table.insert(tbl.children, part:ToTable())
|
||||
table_insert(tbl.children, part:ToTable())
|
||||
end
|
||||
end
|
||||
|
||||
@ -995,7 +1001,7 @@ do -- serializing
|
||||
if not self.is_valid or self.is_deattached then
|
||||
|
||||
else
|
||||
table.insert(tbl.children, part:ToSaveTable())
|
||||
table_insert(tbl.children, part:ToSaveTable())
|
||||
end
|
||||
end
|
||||
|
||||
@ -1013,7 +1019,7 @@ do -- serializing
|
||||
|
||||
if self["Set" .. key] then
|
||||
if key == "Material" then
|
||||
table.insert(self.delayed_variables, {key = key, val = value})
|
||||
table_insert(self.delayed_variables, {key = key, val = value})
|
||||
end
|
||||
self["Set" .. key](self, value)
|
||||
elseif key ~= "ClassName" then
|
||||
@ -1057,7 +1063,7 @@ do -- serializing
|
||||
if not self.is_valid or self.is_deattached then
|
||||
|
||||
else
|
||||
table.insert(tbl.children, part:ToUndoTable())
|
||||
table_insert(tbl.children, part:ToUndoTable())
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
local pairs = pairs
|
||||
local IsValid = IsValid
|
||||
local unpack = unpack
|
||||
local LocalToWorld = LocalToWorld
|
||||
local math_sin = math.sin
|
||||
local RealTime = RealTime
|
||||
local Entity = Entity
|
||||
local ipairs = ipairs
|
||||
local NULL = NULL
|
||||
local LerpVector = LerpVector
|
||||
local LerpAngle = LerpAngle
|
||||
@ -389,7 +397,7 @@ do -- bone manipulation for boneanimlib
|
||||
|
||||
local i = ent.pac_bones_select_target
|
||||
if i and count >= i then
|
||||
ManipulateBoneScale(ent, i, ent:GetManipulateBoneScale(i) * (1 + math.sin(RealTime() * 4) * 0.1))
|
||||
ManipulateBoneScale(ent, i, ent:GetManipulateBoneScale(i) * (1 + math_sin(RealTime() * 4) * 0.1))
|
||||
ent.pac_bones_select_target = nil
|
||||
end
|
||||
|
||||
@ -404,7 +412,7 @@ do -- bone manipulation for boneanimlib
|
||||
|
||||
if time < pac.RealTime then
|
||||
ent:SetFlexWeight(id, 0)
|
||||
else
|
||||
else
|
||||
if ent:GetFlexWeight(id) == 0 then
|
||||
ent.pac_touching_flexes[id] = nil
|
||||
end
|
||||
|
@ -1,3 +1,14 @@
|
||||
local ipairs = ipairs
|
||||
local table_insert = table.insert
|
||||
local isnumber = isnumber
|
||||
local tonumber = tonumber
|
||||
local isstring = isstring
|
||||
local tostring = tostring
|
||||
local table_Merge = table.Merge
|
||||
local istable = istable
|
||||
local pac = pac
|
||||
local setmetatable = setmetatable
|
||||
|
||||
pac.PartTemplates = pac.PartTemplates or {}
|
||||
pac.VariableOrder = {}
|
||||
pac.GroupOrder = pac.GroupOrder or {}
|
||||
@ -52,7 +63,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(tbl, key)
|
||||
table_insert(tbl, key)
|
||||
end
|
||||
|
||||
function META:SetPropertyGroup(name)
|
||||
@ -105,7 +116,7 @@ do
|
||||
tbl[key] = def
|
||||
|
||||
if udata then
|
||||
table.Merge(self:PropData(key), udata)
|
||||
table_Merge(self:PropData(key), udata)
|
||||
end
|
||||
|
||||
if self.store then
|
||||
|
@ -1,3 +1,6 @@
|
||||
local pairs = pairs
|
||||
local IsEntity = IsEntity
|
||||
local next = next
|
||||
|
||||
pac.AddHook("RenderScene", "eyeangles_eyepos", function(pos, ang)
|
||||
pac.EyePos = pos
|
||||
|
@ -1,5 +1,4 @@
|
||||
local Angle = Angle
|
||||
local LocalPlayer = LocalPlayer
|
||||
local RealTime = RealTime
|
||||
local NULL = NULL
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
local FrameNumber = FrameNumber
|
||||
local SysTime = SysTime
|
||||
local pairs = pairs
|
||||
local Color = Color
|
||||
|
@ -9,6 +9,8 @@ local NULL = NULL
|
||||
local pairs = pairs
|
||||
local force_rendering = false
|
||||
local forced_rendering = false
|
||||
local IsEntity = IsEntity
|
||||
local next = next
|
||||
|
||||
local entMeta = FindMetaTable('Entity')
|
||||
local plyMeta = FindMetaTable('Player')
|
||||
@ -263,7 +265,7 @@ pac.AddHook("Think", "events", function()
|
||||
local rag = ply:GetRagdollEntity()
|
||||
if not IsValid(rag) then
|
||||
pac.HideEntityParts(ply)
|
||||
continue
|
||||
continue
|
||||
end
|
||||
|
||||
-- so it only runs once
|
||||
@ -629,7 +631,6 @@ do -- drawing
|
||||
local FrameNumber = FrameNumber
|
||||
local RealTime = RealTime
|
||||
local GetConVar = GetConVar
|
||||
local NULL = NULL
|
||||
local EF_BONEMERGE = EF_BONEMERGE
|
||||
local RENDERMODE_TRANSALPHA = RENDERMODE_TRANSALPHA
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
local LocalPlayer = LocalPlayer
|
||||
local FrameTime = FrameTime
|
||||
local CurTime = CurTime
|
||||
local NULL = NULL
|
||||
local Vector = Vector
|
||||
local util = util
|
||||
local SysTime = SysTime
|
||||
|
||||
local BUILDER, PART = pac.PartTemplate("base")
|
||||
|
||||
|
@ -17,6 +17,8 @@ local vector_origin = vector_origin
|
||||
local render = render
|
||||
local cam = cam
|
||||
local surface = surface
|
||||
local render_MaterialOverrideByIndex = render.MaterialOverrideByIndex
|
||||
local render_SuppressEngineLighting = render.SuppressEngineLighting
|
||||
|
||||
local BUILDER, PART = pac.PartTemplate("base_drawable")
|
||||
|
||||
@ -319,9 +321,9 @@ function PART:BindMaterials(ent)
|
||||
local mat = materials[i]
|
||||
|
||||
if mat then
|
||||
render.MaterialOverrideByIndex(i-1, mat)
|
||||
render_MaterialOverrideByIndex(i-1, mat)
|
||||
else
|
||||
render.MaterialOverrideByIndex(i-1, nil)
|
||||
render_MaterialOverrideByIndex(i-1, nil)
|
||||
end
|
||||
end
|
||||
elseif self.material_override then
|
||||
@ -336,9 +338,9 @@ function PART:BindMaterials(ent)
|
||||
local mat = stack[1]
|
||||
|
||||
if mat then
|
||||
render.MaterialOverrideByIndex(i-1, mat:GetRawMaterial())
|
||||
render_MaterialOverrideByIndex(i-1, mat:GetRawMaterial())
|
||||
else
|
||||
render.MaterialOverrideByIndex(i-1, nil)
|
||||
render_MaterialOverrideByIndex(i-1, nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -372,7 +374,7 @@ function PART:PreEntityDraw(ent, pos, ang)
|
||||
end
|
||||
|
||||
if self.NoLighting then
|
||||
render.SuppressEngineLighting(true)
|
||||
render_SuppressEngineLighting(true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -396,7 +398,7 @@ function PART:PostEntityDraw(ent, pos, ang)
|
||||
self:ModifiersPostEvent("OnDraw")
|
||||
|
||||
if self.NoLighting then
|
||||
render.SuppressEngineLighting(false)
|
||||
render_SuppressEngineLighting(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -710,7 +712,7 @@ function PART:SetModel(path)
|
||||
|
||||
local owner = self:GetOwner()
|
||||
if not owner:IsValid() then return end
|
||||
|
||||
|
||||
self.old_model = path
|
||||
self:ProcessModelChange()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user