From accb6218ee6ca5e7d23bc789229be403d5a68421 Mon Sep 17 00:00:00 2001 From: CloneTrooper1019 Date: Sun, 5 Jan 2020 23:45:48 -0600 Subject: [PATCH] Buncha minor fixes and tweaks. --- Bevels/Program.cs | 34 +++++- Client/HumanoidLabels/init.client.lua | 10 +- Client/Sky/init.client.lua | 1 - Server/Scripts/CaptureTheFlag.server.lua | 105 ++++++++++++------ .../PaintballGun/BrickCleanup/init.meta.json | 6 + .../PaintballGun/BrickCleanup/init.server.lua | 2 + Tools/PaintballGun/Paintball/init.server.lua | 24 ++-- .../PaintballGun/PaintballShooter.server.lua | 28 +++-- Tools/Trowel/TrowelBrick/init.meta.json | 6 + Tools/Trowel/TrowelBrick/init.server.lua | 5 + Tools/Trowel/WallMaker.server.lua | 13 ++- 11 files changed, 166 insertions(+), 68 deletions(-) create mode 100644 Tools/PaintballGun/BrickCleanup/init.meta.json create mode 100644 Tools/PaintballGun/BrickCleanup/init.server.lua create mode 100644 Tools/Trowel/TrowelBrick/init.meta.json create mode 100644 Tools/Trowel/TrowelBrick/init.server.lua diff --git a/Bevels/Program.cs b/Bevels/Program.cs index 267740b..714ae16 100644 --- a/Bevels/Program.cs +++ b/Bevels/Program.cs @@ -183,7 +183,7 @@ namespace BevelGenerator return result; } - static void ProcessFileArg(string filePath) + static void ProcessModelFile(string filePath) { RobloxFile file = RobloxFile.Open(filePath); var exportBin = file.FindFirstChild("ExportBin"); @@ -194,7 +194,7 @@ namespace BevelGenerator return; var unions = exportBin.GetChildrenOfType(); - + for (int i = 0; i < unions.Length; i++) { UnionOperation union = unions[i]; @@ -239,6 +239,36 @@ namespace BevelGenerator Console.ReadKey(); Console.Clear(); } + + static void ProcessObjFile(FileInfo info) + { + string objPath = info.FullName; + Mesh mesh = Mesh.FromObjFile(objPath); + + string meshPath = objPath.Replace(info.Extension, ".mesh"); + FileStream file = File.OpenWrite(meshPath); + + using (file) + { + file.SetLength(0); + mesh.Save(file); + } + + Debugger.Break(); + } + + static void ProcessFileArg(string filePath) + { + FileInfo info = new FileInfo(filePath); + + if (info.Extension == ".obj") + { + ProcessObjFile(info); + return; + } + + ProcessModelFile(filePath); + } [STAThread] static void Main(string[] args) diff --git a/Client/HumanoidLabels/init.client.lua b/Client/HumanoidLabels/init.client.lua index 998ed1b..9c9323f 100644 --- a/Client/HumanoidLabels/init.client.lua +++ b/Client/HumanoidLabels/init.client.lua @@ -1,4 +1,4 @@ -local humanoids = setmetatable({}, { __mode = 'k' }) +local humanoids = {} local player = game.Players.LocalPlayer local pgui = player:WaitForChild("PlayerGui") @@ -35,8 +35,11 @@ local function setupHumanoid(h) if char then while not char:FindFirstChild("Head") do - if h.Parent ~= char then break end - char.ChildAdded:wait() + if h.Parent ~= char then + break + end + + char.ChildAdded:Wait() end local head = char:FindFirstChild("Head") @@ -98,6 +101,7 @@ local function setupHumanoid(h) end end end + onAncestryChanged() h.AncestryChanged:Connect(onAncestryChanged) end diff --git a/Client/Sky/init.client.lua b/Client/Sky/init.client.lua index 73bfd51..ee5348d 100644 --- a/Client/Sky/init.client.lua +++ b/Client/Sky/init.client.lua @@ -148,7 +148,6 @@ local function updateSky() lastTime = seconds end - skyAdorn.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.new(Vector3.new(), sunDir) skyAdorn.Parent = (nightFrame.BackgroundTransparency < 1 and camera or nil) else diff --git a/Server/Scripts/CaptureTheFlag.server.lua b/Server/Scripts/CaptureTheFlag.server.lua index c4351a4..9ba5344 100644 --- a/Server/Scripts/CaptureTheFlag.server.lua +++ b/Server/Scripts/CaptureTheFlag.server.lua @@ -14,12 +14,16 @@ local function restoreFlag(flag) local flagStand = owner and owner.Part0 if owner and flagStand then + print("deleting grip") + for _,joint in pairs(flag:GetJoints()) do if joint.Name == "RightGrip" then joint:Destroy() end end + print("restoring name") + if flag.Name == "Handle" then local tool = flag.Parent if tool:IsA("Tool") then @@ -28,16 +32,25 @@ local function restoreFlag(flag) end end - flag.CFrame = flagStand.CFrame + print("restoring flag") + + flag.Anchored = true + flag.CanCollide = true flag.Parent = flagStand.Parent - wait() + flag.CFrame = flagStand.CFrame + * CFrame.new(0, flagStand.Size.Y / 2, 0) + * CFrame.new(0, flag.Size.Y / 2, 0) flag.Velocity = Vector3.new() flag.RotVelocity = Vector3.new() - - owner.Part1 = flag + + wait() + + owner.Enabled = true flag.Anchored = false + + print("done!") end end @@ -101,7 +114,7 @@ local function mountFlagAsTool(flag, humanoid) CollectionService:AddTag(tool, "Flag") tool.Parent = workspace - owner.Part1 = nil + owner.Enabled = false flag.Name = "Handle" flag.Parent = tool @@ -117,6 +130,7 @@ local function onFlagAdded(flag) -- Mount TeamColor local teamColor = flag:FindFirstChild("TeamColor") + local flagBackup if not teamColor then teamColor = Instance.new("BrickColorValue") @@ -136,8 +150,7 @@ local function onFlagAdded(flag) end if flagStand then - owner = Instance.new("Weld") - owner.C0 = flagStand.CFrame:ToObjectSpace(flag.CFrame) + owner = Instance.new("WeldConstraint") owner.Name = "FlagStand" owner.Part0 = flagStand owner.Parent = flag @@ -151,27 +164,7 @@ local function onFlagAdded(flag) owner.Part1 = flag CollectionService:AddTag(owner, "GorillaGlue") end - - spawn(function () - -- Try to keep the flag from falling out of the world. - local deathPlane = workspace.FallenPartsDestroyHeight - - while flag:IsDescendantOf(workspace) do - if flag.Position.Y < deathPlane + 200 then - local tool = flag.Parent - - if tool:IsA("Tool") then - tool.Parent = workspace - wait() - end - - restoreFlag(flag) - end - - wait() - end - end) - + local function onTouched(hit) local char = hit.Parent if char then @@ -184,8 +177,10 @@ local function onFlagAdded(flag) end if player.TeamColor == teamColor.Value then - if owner.Part1 ~= flag then + if owner and owner.Part1 ~= flag then restoreFlag(flag) + elseif owner == nil then + flag = nil end else mountFlagAsTool(flag, humanoid) @@ -194,7 +189,55 @@ local function onFlagAdded(flag) end end - flag.Touched:Connect(onTouched) + spawn(function () + local deathPlane = workspace.FallenPartsDestroyHeight + + while wait() do + -- Try to keep the flag from falling out of the world. + if not flagBackup then + flagBackup = flag:Clone() + end + + local resetClock = 400 + flag.Touched:Connect(onTouched) + + while flag:IsDescendantOf(workspace) do + if flag.Position.Y < deathPlane + 200 then + local tool = flag.Parent + + if tool:IsA("Tool") then + tool.Parent = workspace + wait() + end + + restoreFlag(flag) + end + + if (flag and owner) and not owner.Enabled and not flag.Parent:IsA("Tool") then + resetClock = resetClock - 1 + + if resetClock <= 0 then + restoreFlag(flag) + resetClock = 400 + end + else + resetClock = 400 + end + + wait() + end + + flag:Destroy() + + flag = flagBackup:Clone() + flag.Parent = workspace + + owner = flag.FlagStand + restoreFlag(flag) + + wait() + end + end) end for _,flag in pairs(CollectionService:GetTagged(FlagInstance)) do @@ -258,8 +301,8 @@ local function onFlagStandAdded(flagStand) restoreFlag(handle) tool:Destroy() - wait(1) + debounce = false end end diff --git a/Tools/PaintballGun/BrickCleanup/init.meta.json b/Tools/PaintballGun/BrickCleanup/init.meta.json new file mode 100644 index 0000000..21cf1e8 --- /dev/null +++ b/Tools/PaintballGun/BrickCleanup/init.meta.json @@ -0,0 +1,6 @@ +{ + "properties": + { + "Disabled": true + } +} \ No newline at end of file diff --git a/Tools/PaintballGun/BrickCleanup/init.server.lua b/Tools/PaintballGun/BrickCleanup/init.server.lua new file mode 100644 index 0000000..e11b8de --- /dev/null +++ b/Tools/PaintballGun/BrickCleanup/init.server.lua @@ -0,0 +1,2 @@ +wait(24) +script.Parent:Destroy() \ No newline at end of file diff --git a/Tools/PaintballGun/Paintball/init.server.lua b/Tools/PaintballGun/Paintball/init.server.lua index 4317030..04bb3c8 100644 --- a/Tools/PaintballGun/Paintball/init.server.lua +++ b/Tools/PaintballGun/Paintball/init.server.lua @@ -1,7 +1,5 @@ -local Debris = game:GetService("Debris") - -ball = script.Parent -damage = 20 +local ball = script.Parent +local damage = 20 function onTouched(hit) if not (hit.CanCollide and hit.Parent) then @@ -10,7 +8,7 @@ function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") - if hit:getMass() < 1.2 * 200 then + if hit:GetMass() < 1.2 * 200 then hit.BrickColor = ball.BrickColor end @@ -21,14 +19,16 @@ function onTouched(hit) s.formFactor = 2 -- plate s.Size = Vector3.new(1,.4,1) s.BrickColor = ball.BrickColor - - local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1)) + + local cleanup = ball.BrickCleanup:Clone() + cleanup.Disabled = false + cleanup.Parent = s + + local v = Vector3.new(math.random(-1, 1), math.random(0, 1), math.random(-1, 1)) s.Velocity = 15 * v s.CFrame = CFrame.new(ball.Position + v, v) - Debris:AddItem(s, 24) - - s.Parent = game.Workspace + s.Parent = workspace end @@ -77,7 +77,7 @@ function untagHumanoid(humanoid) end end -connection = ball.Touched:connect(onTouched) +connection = ball.Touched:Connect(onTouched) wait(8) -ball.Parent = nil +ball:Destroy() diff --git a/Tools/PaintballGun/PaintballShooter.server.lua b/Tools/PaintballGun/PaintballShooter.server.lua index 0d056d8..feec544 100644 --- a/Tools/PaintballGun/PaintballShooter.server.lua +++ b/Tools/PaintballGun/PaintballShooter.server.lua @@ -1,4 +1,4 @@ -local Debris = game:GetService("Debris") +local Players = game:GetService("Players") local Tool = script.Parent local fireSound = Instance.new("Sound") @@ -13,15 +13,15 @@ local function fire(v) fireSound:Play() local vCharacter = Tool.Parent - local vPlayer = game.Players:playerFromCharacter(vCharacter) + local vPlayer = Players:GetPlayerFromCharacter(vCharacter) local missile = Instance.new("Part") local spawnPos = vCharacter.PrimaryPart.Position - spawnPos = spawnPos + (v * 8) + spawnPos = spawnPos + (v * 8) missile.Position = spawnPos - missile.Size = Vector3.new(1,1,1) + missile.Size = Vector3.new(1, 1, 1) missile.Velocity = v * 100 missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)]) missile.Shape = 0 @@ -36,10 +36,13 @@ local function fire(v) force.force = Vector3.new(0,45,0) force.Parent = missile - local new_script = Tool.Paintball:clone() + local new_script = Tool.Paintball:Clone() new_script.Disabled = false new_script.Parent = missile + local brickCleanup = Tool.BrickCleanup:Clone() + brickCleanup.Parent = missile + local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vPlayer creator_tag.Name = "creator" @@ -47,23 +50,20 @@ local function fire(v) missile.Parent = game.Workspace missile:SetNetworkOwner(vPlayer) - - Debris:AddItem(missile, 24) end - - Tool.Enabled = true -function onActivated() +function onActivated() if not Tool.Enabled then return end Tool.Enabled = false - local character = Tool.Parent; - local humanoid = character.Humanoid + local character = Tool.Parent + local humanoid = character and character:FindFirstChildOfClass("Humanoid") + if humanoid == nil then print("Humanoid not found") return @@ -73,11 +73,9 @@ function onActivated() local lookAt = (targetPos - character.Head.Position).unit fire(lookAt) - wait(.5) Tool.Enabled = true end - -script.Parent.Activated:connect(onActivated) +Tool.Activated:connect(onActivated) \ No newline at end of file diff --git a/Tools/Trowel/TrowelBrick/init.meta.json b/Tools/Trowel/TrowelBrick/init.meta.json new file mode 100644 index 0000000..21cf1e8 --- /dev/null +++ b/Tools/Trowel/TrowelBrick/init.meta.json @@ -0,0 +1,6 @@ +{ + "properties": + { + "Disabled": true + } +} \ No newline at end of file diff --git a/Tools/Trowel/TrowelBrick/init.server.lua b/Tools/Trowel/TrowelBrick/init.server.lua new file mode 100644 index 0000000..c8b259e --- /dev/null +++ b/Tools/Trowel/TrowelBrick/init.server.lua @@ -0,0 +1,5 @@ +local brick = script.Parent +brick:MakeJoints() + +wait(24) +brick:Destroy() \ No newline at end of file diff --git a/Tools/Trowel/WallMaker.server.lua b/Tools/Trowel/WallMaker.server.lua index 06df124..7e60e0a 100644 --- a/Tools/Trowel/WallMaker.server.lua +++ b/Tools/Trowel/WallMaker.server.lua @@ -13,9 +13,15 @@ local function placeBrick(cf, pos, color) local brick = Instance.new("Part") brick.BrickColor = color brick.CFrame = cf * CFrame.new(pos + brick.Size / 2) + + local brickScript = Tool.TrowelBrick:Clone() + brickScript.Disabled = false + brickScript.Parent = brick + + -- place the brick brick.Parent = workspace - Debris:AddItem(brick, 24) + -- return brick info return brick, pos + brick.Size end @@ -46,8 +52,7 @@ local function buildWall(cf) return bricks end - -function snap(v) +local function snap(v) if math.abs(v.X) > math.abs(v.Z) then if v.X > 0 then return Vector3.new(1, 0, 0) @@ -65,7 +70,7 @@ end Tool.Enabled = true -function onActivated() +local function onActivated() if not Tool.Enabled then return end