diff --git a/src/client/Character/Client/Camera/Bobbing.lua b/src/client/Character/Client/Camera/Bobbing.lua index a76398e..f688f69 100644 --- a/src/client/Character/Client/Camera/Bobbing.lua +++ b/src/client/Character/Client/Camera/Bobbing.lua @@ -44,10 +44,15 @@ function Animations.Idle(t: tick, dt: deltatime) end function Animations.Walk(t: tick, dt: deltatime) + -- return ANG( + -- math.rad(-10*math.cos(t)/2), + -- 0, + -- math.rad(5*math.cos(t)/2) + -- ) return ANG( - math.rad(-10*math.cos(t)/2), 0, - math.rad(5*math.cos(t)/2) + 0, + 0 ) end diff --git a/src/server/Studio/EditorEntities.lua b/src/server/Studio/EditorEntities.lua new file mode 100644 index 0000000..76b367d --- /dev/null +++ b/src/server/Studio/EditorEntities.lua @@ -0,0 +1,55 @@ +--All debugging objects such as light source indicating objects will be turned invisible + +local StudioEntities = { + IndexedEntities = {} +} + +local function HidePart(Part: BasePart, enabled: boolean) + Part.Transparency = enabled and 1 or .9 + Part.CanCollide = enabled + Part.CastShadow = false +end + +local function HideBarrierCollision(Part: BasePart, enabled: boolean) + Part.Transparency = enabled and 1 or .9 + Part.CastShadow = false + Part.CanCollide = true +end + +local EditorEntities = { + ["LightSource"] = HidePart, + ["PulleyRopeContact"] = HidePart, + ["BarrierCollision"] = HideBarrierCollision +} + +type IndexedEntities = {Instance} + +function StudioEntities.indexAll(enabled: boolean): IndexedEntities + if #StudioEntities.IndexedEntities == 0 then + --Run when the server starts + local WorkspaceEnt = workspace:GetDescendants() + + for i = 1, #WorkspaceEnt do + local Item: Instance = WorkspaceEnt[i] + local Case: Instance = EditorEntities[Item.Name] + if Case then + table.insert(StudioEntities.IndexedEntities, Item) + Case(Item, enabled) + end + + --Do micro optimizations here + if Item:IsA("BasePart") then + Item.CanTouch = false + end + end + else + for i = 1, #StudioEntities.IndexedEntities do + local Entity: Instance = EditorEntities[i] + EditorEntities[Entity.Name](Entity, enabled) + end + end + + return StudioEntities.IndexedEntities +end + +return StudioEntities \ No newline at end of file diff --git a/src/server/Studio/Lighting.lua b/src/server/Studio/Lighting.lua new file mode 100644 index 0000000..4d2cf70 --- /dev/null +++ b/src/server/Studio/Lighting.lua @@ -0,0 +1,16 @@ +local Lighting = game:GetService("Lighting") + +local PropsTree = { + +} + +return function() + for Light_Prop, Light_Value in PropsTree do + local changed, err = pcall(function() + Lighting[Light_Prop] = Light_Value + end) + if not changed then + warn("Server Lighting:", err, debug.traceback()) + end + end +end \ No newline at end of file diff --git a/src/server/Studio/init.server.lua b/src/server/Studio/init.server.lua new file mode 100644 index 0000000..e9298ce --- /dev/null +++ b/src/server/Studio/init.server.lua @@ -0,0 +1,17 @@ +local HideEditorEntities = require(script:WaitForChild("EditorEntities")) +local Lighting = require(script:WaitForChild("Lighting")) + +local RS = game:GetService("RunService") +local Storage = game:GetService("ReplicatedStorage") + +local ServerStorage = Storage:WaitForChild("Server") + +local Bind = Instance.new("BindableFunction") +Bind.Name = "StudioIndexedEntities" +Bind.Parent = ServerStorage + +HideEditorEntities.indexAll(not RS:IsStudio()) + +Bind.OnInvoke = function() + return HideEditorEntities.IndexedEntities +end \ No newline at end of file diff --git a/src/server/StudioEntities.server.lua b/src/server/StudioEntities.server.lua deleted file mode 100644 index 8f95ecb..0000000 --- a/src/server/StudioEntities.server.lua +++ /dev/null @@ -1,36 +0,0 @@ ---All debugging objects such as light source indicating objects will be turned invisible - -local EntityDebug = game:GetService("RunService"):IsStudio() --- local EntityDebug = false - -local WorkspaceEnt = workspace:GetDescendants() - -local function HidePart(Part: BasePart) - Part.Transparency = 1 - Part.CanCollide = false - Part.CastShadow = false -end - -local function HideBarrierCollision(Part: BasePart) - Part.Transparency = 1 - Part.CanCollide = true - Part.CastShadow = false -end - -local SwitchEntities = { - ["LightSource"] = HidePart, - ["PulleyRopeContact"] = HidePart, - ["BarrierCollision"] = HideBarrierCollision -} - -if not EntityDebug then - for i = 1, #WorkspaceEnt do - local Item = WorkspaceEnt[i] - local Case = SwitchEntities[Item.Name] - if Case then - Case(Item) - else - -- SwitchEntities.default() - end - end -end \ No newline at end of file