From 49287591b5c29bc118f38ebb15c48ea90ab7b1c2 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Sun, 4 Oct 2026 07:50:29 -0300 Subject: [PATCH 01/11] Add files via upload better checks for entity view and step height mutator and convar bool usage so they don't override net.writebool() --- lua/pac3/core/shared/entity_mutators/size.lua | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lua/pac3/core/shared/entity_mutators/size.lua b/lua/pac3/core/shared/entity_mutators/size.lua index b3b3a39a5..0ed123af4 100644 --- a/lua/pac3/core/shared/entity_mutators/size.lua +++ b/lua/pac3/core/shared/entity_mutators/size.lua @@ -8,18 +8,19 @@ local allow_viewoffset = CreateConVar("pac_modifier_viewoffset", "0", CLIENT and function MUTATOR:WriteArguments(multiplier, other) net.WriteFloat(multiplier) - if other and (other.StandingHullHeight ~= nil and other.CrouchingHullHeight ~= nil and other.HullWidth ~= nil and other.StandingHullHeight ~= nil and other.StepSize ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil) then - net.WriteBool(true) - net.WriteFloat(other.StandingHullHeight) - net.WriteFloat(other.CrouchingHullHeight) - net.WriteFloat(other.HullWidth) - if other.OverrideStepAndView and (allow_step:GetBool() or allow_viewoffset:GetBool()) then + if other then + if (other.StandingHullHeight ~= nil and other.CrouchingHullHeight ~= nil and other.HullWidth ~= nil) then net.WriteBool(true) - net.WriteFloat(other.StepSize) - net.WriteFloat(other.StandingViewOffset) - net.WriteFloat(other.CrouchingViewOffset) - else - net.WriteBool(false) + net.WriteFloat(other.StandingHullHeight) + net.WriteFloat(other.CrouchingHullHeight) + net.WriteFloat(other.HullWidth) + end + if allow_step:GetBool() or allow_viewoffset:GetBool() then + if (other.StepSize ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil) then + net.WriteFloat(other.StepSize) + net.WriteFloat(other.StandingViewOffset) + net.WriteFloat(other.CrouchingViewOffset) + end end else net.WriteBool(false) @@ -48,9 +49,11 @@ function MUTATOR:ReadArguments() other.StandingHullHeight = net.ReadFloat() other.CrouchingHullHeight = net.ReadFloat() other.HullWidth = net.ReadFloat() - other.OverrideStepAndView = net.ReadBool() - if other.OverrideStepAndView then + other.OverrideStepAndView = allow_step:GetBool() or allow_viewoffset:GetBool() + if allow_step:GetBool() then other.StepSize = net.ReadFloat() + end + if allow_viewoffset:GetBool() then other.StandingViewOffset = net.ReadFloat() other.CrouchingViewOffset = net.ReadFloat() end @@ -137,10 +140,10 @@ function MUTATOR:Mutate(multiplier, other, hidden_state) end if allow_viewoffset:GetBool() then local soffset = other.StandingViewOffset + local coffset = other.CrouchingViewOffset if ent.SetViewOffset then ent:SetViewOffset(Vector(0,0,soffset)) end - local coffset = other.CrouchingViewOffset if ent.SetViewOffsetDucked then ent:SetViewOffsetDucked(Vector(0,0,coffset)) end @@ -148,7 +151,9 @@ function MUTATOR:Mutate(multiplier, other, hidden_state) end else + ent:ResetHull() + end end end From db9fab61c009e24bb9aa85e70dfae2f20fa76125 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:40:50 -0300 Subject: [PATCH 02/11] Update size.lua --- lua/pac3/core/shared/entity_mutators/size.lua | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/lua/pac3/core/shared/entity_mutators/size.lua b/lua/pac3/core/shared/entity_mutators/size.lua index 0ed123af4..854a0ce8d 100644 --- a/lua/pac3/core/shared/entity_mutators/size.lua +++ b/lua/pac3/core/shared/entity_mutators/size.lua @@ -9,18 +9,26 @@ local allow_viewoffset = CreateConVar("pac_modifier_viewoffset", "0", CLIENT and function MUTATOR:WriteArguments(multiplier, other) net.WriteFloat(multiplier) if other then - if (other.StandingHullHeight ~= nil and other.CrouchingHullHeight ~= nil and other.HullWidth ~= nil) then - net.WriteBool(true) - net.WriteFloat(other.StandingHullHeight) - net.WriteFloat(other.CrouchingHullHeight) - net.WriteFloat(other.HullWidth) - end - if allow_step:GetBool() or allow_viewoffset:GetBool() then - if (other.StepSize ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil) then + net.WriteBool(true) + net.WriteFloat(other.StandingHullHeight) + net.WriteFloat(other.CrouchingHullHeight) + net.WriteFloat(other.HullWidth) + if allow_step:GetBool() then + if other.OverrideStepSize ~= nil and other.StepSize ~= nil then + net.WriteBool(other.OverrideStepSize) net.WriteFloat(other.StepSize) + end + else + net.WriteBool(false) + end + if allow_viewoffset:GetBool() then + if other.OverrideView ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil then + net.WriteBool(other.OverrideView) net.WriteFloat(other.StandingViewOffset) net.WriteFloat(other.CrouchingViewOffset) end + else + net.WriteBool(false) end else net.WriteBool(false) @@ -49,10 +57,11 @@ function MUTATOR:ReadArguments() other.StandingHullHeight = net.ReadFloat() other.CrouchingHullHeight = net.ReadFloat() other.HullWidth = net.ReadFloat() - other.OverrideStepAndView = allow_step:GetBool() or allow_viewoffset:GetBool() + other.OverrideStepSize = net.ReadBool() if allow_step:GetBool() then other.StepSize = net.ReadFloat() end + other.OverrideView = net.ReadBool() if allow_viewoffset:GetBool() then other.StandingViewOffset = net.ReadFloat() other.CrouchingViewOffset = net.ReadFloat() @@ -82,7 +91,7 @@ end local functions = { "ViewOffset", "ViewOffsetDucked", - "StepSize", + "StepSize" } function MUTATOR:Mutate(multiplier, other, hidden_state) @@ -134,22 +143,26 @@ function MUTATOR:Mutate(multiplier, other, hidden_state) ent:SetHull(smin, smax) ent:SetHullDuck(cmin, cmax) - if other.OverrideStepAndView then - if ent.SetStepSize and allow_step:GetBool() then - ent:SetStepSize(math.max(other.StepSize,0)) + if other.OverrideStepSize then + local SSize = other.StepSize + if ent.SetStepSize then + ent:SetStepSize(math.max(SSize,0)) end - if allow_viewoffset:GetBool() then - local soffset = other.StandingViewOffset - local coffset = other.CrouchingViewOffset - if ent.SetViewOffset then - ent:SetViewOffset(Vector(0,0,soffset)) - end - if ent.SetViewOffsetDucked then - ent:SetViewOffsetDucked(Vector(0,0,coffset)) - end + end + if other.OverrideView then + local soffset = other.StandingViewOffset + local coffset = other.CrouchingViewOffset + if ent.SetViewOffset then + ent:SetViewOffset(Vector(0,0,soffset)) + end + if ent.SetViewOffsetDucked then + ent:SetViewOffsetDucked(Vector(0,0,coffset)) end end + print("cvars", allow_step:GetBool(), allow_viewoffset:GetBool()) + print("editor", other.OverrideStepSize, other.OverrideView) + else ent:ResetHull() @@ -158,4 +171,4 @@ function MUTATOR:Mutate(multiplier, other, hidden_state) end end -pac.emut.Register(MUTATOR) \ No newline at end of file +pac.emut.Register(MUTATOR) From 3c4a6b32aa218d792aa61688ccae92568840b56e Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:43:11 -0300 Subject: [PATCH 03/11] Update entity.lua --- lua/pac3/core/client/parts/model/entity.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lua/pac3/core/client/parts/model/entity.lua b/lua/pac3/core/client/parts/model/entity.lua index 3a3b5de19..116c0a423 100644 --- a/lua/pac3/core/client/parts/model/entity.lua +++ b/lua/pac3/core/client/parts/model/entity.lua @@ -22,13 +22,14 @@ BUILDER:StartStorableVars() :GetSet("NoDraw", false) :GetSet("DrawShadow", true) :GetSet("InverseKinematics", true) - :SetPropertyGroup("hull") :GetSet("StandingHullHeight", 72, {editor_panel = "hull"}) :GetSet("CrouchingHullHeight", 36, {editor_panel = "hull", crouch = true}) :GetSet("HullWidth", 32, {editor_panel = "hull"}) - :GetSet("OverrideStepAndView", false, {description = "When changing size, pac scales the step size and view offsets together. This overrides that."}) + :SetPropertyGroup("step size and view offset") + :GetSet("OverrideStepSize", false, {description = "When changing size, pac scales the step size. This overrides that."}) :GetSet("StepSize", 18, {description = "Height that you can step up or down without jumping. Slightly tricky and may create view transition issues."}) + :GetSet("OverrideView", false, {description = "When changing size, pac scales the view offsets. This overrides that."}) :GetSet("StandingViewOffset", 64, {description = "Eye height when standing"}) :GetSet("CrouchingViewOffset", 28, {description = "Eye height when crouching"}) :EndStorableVars() @@ -62,6 +63,14 @@ function PART:SetHullWidth(val) self.HullWidth = val self:ApplyMatrix() end +function PART:SetOverrideView(b) + self.OverrideView = b + self:ApplyMatrix() +end +function PART:SetOverrideStepSize(b) + self.OverrideStepSize = b + self:ApplyMatrix() +end function PART:SetStandingViewOffset(val) self.StandingViewOffset = val self:ApplyMatrix() @@ -74,10 +83,6 @@ function PART:SetStepSize(val) self.StepSize = val self:ApplyMatrix() end -function PART:SetOverrideStepAndView(b) - self.OverrideStepAndView = b - self:ApplyMatrix() -end function PART:GetNiceName() local str = pac.PrettifyName(("/" .. self:GetModel()):match(".+/(.-)%.")) or self:GetModel() @@ -277,4 +282,4 @@ function PART:OnThink() end end -BUILDER:Register() \ No newline at end of file +BUILDER:Register() From 13dc78a4eb6a9712374764a80b9a949ec5459144 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:43:29 -0300 Subject: [PATCH 04/11] Update model.lua --- lua/pac3/core/client/parts/model.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/pac3/core/client/parts/model.lua b/lua/pac3/core/client/parts/model.lua index c6fa9c76c..9aee7fe73 100644 --- a/lua/pac3/core/client/parts/model.lua +++ b/lua/pac3/core/client/parts/model.lua @@ -800,10 +800,11 @@ function PART:ApplyMatrix() StandingHullHeight = self.StandingHullHeight, CrouchingHullHeight = self.CrouchingHullHeight, HullWidth = self.HullWidth, + OverrideStepSize = self.OverrideStepSize, + OverrideView = self.OverrideView, StepSize = self.StepSize, StandingViewOffset = self.StandingViewOffset, - CrouchingViewOffset = self.CrouchingViewOffset, - OverrideStepAndView = self.OverrideStepAndView + CrouchingViewOffset = self.CrouchingViewOffset }) if self.Size == 1 and self.Scale == vec_one then From 0ac94d29d518b22bc775fe2520f45c691c5bc247 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:49:12 -0300 Subject: [PATCH 05/11] Update size.lua forgot you were still there, get out. --- lua/pac3/core/shared/entity_mutators/size.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/lua/pac3/core/shared/entity_mutators/size.lua b/lua/pac3/core/shared/entity_mutators/size.lua index 854a0ce8d..f5cc0d830 100644 --- a/lua/pac3/core/shared/entity_mutators/size.lua +++ b/lua/pac3/core/shared/entity_mutators/size.lua @@ -160,9 +160,6 @@ function MUTATOR:Mutate(multiplier, other, hidden_state) end end - print("cvars", allow_step:GetBool(), allow_viewoffset:GetBool()) - print("editor", other.OverrideStepSize, other.OverrideView) - else ent:ResetHull() From 59bb023f676c2280e1d3b8c6b65ebdd74642367d Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:58:08 -0300 Subject: [PATCH 06/11] Update size.lua bring these back in and fix standing hull being checked twice (what?) --- lua/pac3/core/shared/entity_mutators/size.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/pac3/core/shared/entity_mutators/size.lua b/lua/pac3/core/shared/entity_mutators/size.lua index f5cc0d830..527edc171 100644 --- a/lua/pac3/core/shared/entity_mutators/size.lua +++ b/lua/pac3/core/shared/entity_mutators/size.lua @@ -8,7 +8,7 @@ local allow_viewoffset = CreateConVar("pac_modifier_viewoffset", "0", CLIENT and function MUTATOR:WriteArguments(multiplier, other) net.WriteFloat(multiplier) - if other then + if other and (other.StandingHullHeight ~= nil and other.CrouchingHullHeight ~= nil and other.HullWidth ~= nil and other.OverrideView and other.OverrideStepSize ~= nil and other.StepSize ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil) then net.WriteBool(true) net.WriteFloat(other.StandingHullHeight) net.WriteFloat(other.CrouchingHullHeight) From f24b8af60f574931d9fa994f3fdbc56388eab845 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Mon, 5 Oct 2026 19:01:46 -0300 Subject: [PATCH 07/11] Update size.lua nvm, those checks ALSO messes up the boolean for resetting hole --- lua/pac3/core/shared/entity_mutators/size.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/pac3/core/shared/entity_mutators/size.lua b/lua/pac3/core/shared/entity_mutators/size.lua index 527edc171..f5cc0d830 100644 --- a/lua/pac3/core/shared/entity_mutators/size.lua +++ b/lua/pac3/core/shared/entity_mutators/size.lua @@ -8,7 +8,7 @@ local allow_viewoffset = CreateConVar("pac_modifier_viewoffset", "0", CLIENT and function MUTATOR:WriteArguments(multiplier, other) net.WriteFloat(multiplier) - if other and (other.StandingHullHeight ~= nil and other.CrouchingHullHeight ~= nil and other.HullWidth ~= nil and other.OverrideView and other.OverrideStepSize ~= nil and other.StepSize ~= nil and other.StandingViewOffset ~= nil and other.CrouchingViewOffset ~= nil) then + if other then net.WriteBool(true) net.WriteFloat(other.StandingHullHeight) net.WriteFloat(other.CrouchingHullHeight) From 8be1e1a7c5ee19422d3a24c8f3e18f5054736b1c Mon Sep 17 00:00:00 2001 From: pingu7867 Date: Sat, 10 Oct 2026 14:17:05 -0400 Subject: [PATCH 08/11] step/view backward compatibility removing the OverrideStepAndView property would undo any saved user choice that is because it won't get converted to the new split properties of step and view which are false by default --- lua/pac3/core/client/parts/model/entity.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/pac3/core/client/parts/model/entity.lua b/lua/pac3/core/client/parts/model/entity.lua index 116c0a423..ab7ffbbac 100644 --- a/lua/pac3/core/client/parts/model/entity.lua +++ b/lua/pac3/core/client/parts/model/entity.lua @@ -27,6 +27,7 @@ BUILDER:StartStorableVars() :GetSet("CrouchingHullHeight", 36, {editor_panel = "hull", crouch = true}) :GetSet("HullWidth", 32, {editor_panel = "hull"}) :SetPropertyGroup("step size and view offset") + :GetSet("OverrideStepAndView", false, {hidden = true}) --legacy property, now split in two :GetSet("OverrideStepSize", false, {description = "When changing size, pac scales the step size. This overrides that."}) :GetSet("StepSize", 18, {description = "Height that you can step up or down without jumping. Slightly tricky and may create view transition issues."}) :GetSet("OverrideView", false, {description = "When changing size, pac scales the view offsets. This overrides that."}) @@ -71,6 +72,15 @@ function PART:SetOverrideStepSize(b) self.OverrideStepSize = b self:ApplyMatrix() end + +--backward compatibility +function PART:SetOverrideStepAndView(b) + if b == true then + self:SetOverrideStepSize(true) + self:SetOverrideView(true) + end +end + function PART:SetStandingViewOffset(val) self.StandingViewOffset = val self:ApplyMatrix() From 80b3a417b0bc02b474d8be9abda67ddf075c06a6 Mon Sep 17 00:00:00 2001 From: "Mr. Nuke" <140557157+lionstrykes10911@users.noreply.github.com> Date: Sat, 10 Oct 2026 17:31:54 -0300 Subject: [PATCH 09/11] turn that light off when you leave. --- lua/pac3/core/client/parts/model/entity.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/pac3/core/client/parts/model/entity.lua b/lua/pac3/core/client/parts/model/entity.lua index ab7ffbbac..8a991f99c 100644 --- a/lua/pac3/core/client/parts/model/entity.lua +++ b/lua/pac3/core/client/parts/model/entity.lua @@ -78,6 +78,7 @@ function PART:SetOverrideStepAndView(b) if b == true then self:SetOverrideStepSize(true) self:SetOverrideView(true) + self:SetOverrideStepAndView(false) end end From 041d155a9d53a0f226618b94f7f59f35a5cbfde1 Mon Sep 17 00:00:00 2001 From: pingu7867 Date: Sat, 10 Oct 2026 19:13:28 -0400 Subject: [PATCH 10/11] partial optimization and correction reduce calls of ApplyMatrix don't use the setter inside itself even if it's mostly an empty function in the false case. the bool is already false by being pre-loaded from the class's DefaultVars when the part is created, before further initialization but we got a bigger problem. the split won't be absolutely backward compatible after all. after deliberating some alternatives to preserve proxy read/write functionality, I found no immediate solution that avoids overwriting the successor properties on initialize --- lua/pac3/core/client/parts/model/entity.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/pac3/core/client/parts/model/entity.lua b/lua/pac3/core/client/parts/model/entity.lua index 8a991f99c..4efd221a7 100644 --- a/lua/pac3/core/client/parts/model/entity.lua +++ b/lua/pac3/core/client/parts/model/entity.lua @@ -76,9 +76,9 @@ end --backward compatibility function PART:SetOverrideStepAndView(b) if b == true then - self:SetOverrideStepSize(true) - self:SetOverrideView(true) - self:SetOverrideStepAndView(false) + self.OverrideStepSize = b + self.OverrideView = b + self:ApplyMatrix() end end From 1e104235b010943a30f1f2c6fad3c5eba7d473a6 Mon Sep 17 00:00:00 2001 From: pingu7867 Date: Sun, 11 Oct 2026 13:07:39 -0400 Subject: [PATCH 11/11] add hull-like step/view visualization --- lua/pac3/core/client/parts/model/entity.lua | 8 +- .../editor/client/panels/extra_properties.lua | 97 +++++++++++++++---- 2 files changed, 84 insertions(+), 21 deletions(-) diff --git a/lua/pac3/core/client/parts/model/entity.lua b/lua/pac3/core/client/parts/model/entity.lua index 4efd221a7..d9b66c8b0 100644 --- a/lua/pac3/core/client/parts/model/entity.lua +++ b/lua/pac3/core/client/parts/model/entity.lua @@ -29,10 +29,10 @@ BUILDER:StartStorableVars() :SetPropertyGroup("step size and view offset") :GetSet("OverrideStepAndView", false, {hidden = true}) --legacy property, now split in two :GetSet("OverrideStepSize", false, {description = "When changing size, pac scales the step size. This overrides that."}) - :GetSet("StepSize", 18, {description = "Height that you can step up or down without jumping. Slightly tricky and may create view transition issues."}) + :GetSet("StepSize", 18, {description = "Height that you can step up or down without jumping. Slightly tricky and may create view transition issues.", editor_panel = "hull", step = true}) :GetSet("OverrideView", false, {description = "When changing size, pac scales the view offsets. This overrides that."}) - :GetSet("StandingViewOffset", 64, {description = "Eye height when standing"}) - :GetSet("CrouchingViewOffset", 28, {description = "Eye height when crouching"}) + :GetSet("StandingViewOffset", 64, {description = "Eye height when standing", editor_panel = "hull", view = true}) + :GetSet("CrouchingViewOffset", 28, {description = "Eye height when crouching", editor_panel = "hull", crouch = true, view = true}) :EndStorableVars() BUILDER:RemoveProperty("BoneMerge") @@ -293,4 +293,4 @@ function PART:OnThink() end end -BUILDER:Register() +BUILDER:Register() \ No newline at end of file diff --git a/lua/pac3/editor/client/panels/extra_properties.lua b/lua/pac3/editor/client/panels/extra_properties.lua index f332492df..60acd36aa 100644 --- a/lua/pac3/editor/client/panels/extra_properties.lua +++ b/lua/pac3/editor/client/panels/extra_properties.lua @@ -1348,40 +1348,103 @@ do -- hull PANEL.ClassName = "properties_hull" PANEL.Base = "pace_properties_number" + local hull_color = Color(255, 204, 51, 255) function PANEL:OnValueSet() local function stop() RunConsoleCommand("-duck") hook.Remove("PostDrawOpaqueRenderables", "pace_draw_hull") + hook.Remove("PostDrawOpaqueRenderables", "pace_draw_hull2") + hook.Remove("PostDrawOpaqueRenderables", "pace_draw_hull3") end local time = os.clock() + 3 - hook.Add("PostDrawOpaqueRenderables", "pace_draw_hull", function() + local udata = self.udata + if udata then + if udata.step then + if not self.first_time then self.first_time = true return end + hook.Add("PostDrawOpaqueRenderables", "pace_draw_hull3", function() - if not pace.current_part:IsValid() then stop() return end - if pace.current_part.ClassName ~= "entity2" then stop() return end + if not pace.current_part:IsValid() then stop() return end + if pace.current_part.ClassName ~= "entity2" then stop() return end - local ent = pace.current_part:GetOwner() - if not ent.GetHull then stop() return end - if not ent.GetHullDuck then stop() return end + local ent = pace.current_part:GetOwner() + if not ent.GetHull then stop() return end + if not ent.GetHullDuck then stop() return end - local min, max = ent:GetHull() + local min, max = ent:GetHull() - if self.udata and self.udata.crouch then - min, max = ent:GetHullDuck() - RunConsoleCommand("+duck") - end + local part = pace.current_part + local height = part.StepSize + min = Vector(-part.HullWidth/2,-part.HullWidth/2,0) + max = Vector(part.HullWidth/2,part.HullWidth/2,0) + render.DrawWireframeBox( ent:GetPos() + Vector(0,0,height), Angle(0), min, max, hull_color, true ) - min = min * ent:GetModelScale() - max = max * ent:GetModelScale() + if time < os.clock() then + stop() + end + end) + elseif udata.view then + if not self.first_time then self.first_time = true return end + hook.Add("PostDrawOpaqueRenderables", "pace_draw_hull2", function() - render.DrawWireframeBox( ent:GetPos(), Angle(0), min, max, Color(255, 204, 51, 255), true ) + if not pace.current_part:IsValid() then stop() return end + if pace.current_part.ClassName ~= "entity2" then stop() return end - if time < os.clock() then - stop() + local ent = pace.current_part:GetOwner() + if not ent.GetHull then stop() return end + if not ent.GetHullDuck then stop() return end + + local min, max = ent:GetHull() + + if udata.crouch then + min, max = ent:GetHullDuck() + RunConsoleCommand("+duck") + end + + min = min * ent:GetModelScale() + max = max * ent:GetModelScale() + + local part = pace.current_part + local height = part.StandingViewOffset + if udata.crouch then + height = part.CrouchingViewOffset + end + render.DrawWireframeSphere( ent:GetPos() + Vector(0, 0, height), 8, 8, 8, hull_color, true ) + + if time < os.clock() then + stop() + end + end) + else + hook.Add("PostDrawOpaqueRenderables", "pace_draw_hull", function() + + if not pace.current_part:IsValid() then stop() return end + if pace.current_part.ClassName ~= "entity2" then stop() return end + + local ent = pace.current_part:GetOwner() + if not ent.GetHull then stop() return end + if not ent.GetHullDuck then stop() return end + + local min, max = ent:GetHull() + + if udata.crouch then + min, max = ent:GetHullDuck() + RunConsoleCommand("+duck") + end + + min = min * ent:GetModelScale() + max = max * ent:GetModelScale() + + render.DrawWireframeBox( ent:GetPos(), Angle(0), min, max, hull_color, true ) + + if time < os.clock() then + stop() + end + end) end - end) + end end pace.RegisterPanel(PANEL)