Guest User

operable

a guest
Dec 23rd, 2017
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.47 KB | None | 0 0
  1. local operable = {}
  2.  
  3. operable.start = function()
  4.     for i, v in pairs(_G.operables:GetChildren()) do
  5.         for i, k in pairs(v:GetChildren()) do
  6.             local statusFolder = k.Status
  7.             local operableType = statusFolder.Type.Value
  8.             if operableType == "stash" then
  9.                 operable.stash(k)
  10.             end
  11.         end
  12.     end
  13.     for i, v in pairs(_G.mouseFilter.OperableRegions:GetChildren()) do
  14.         coroutine.wrap(operable[v.Status.Function.Value])(v)
  15.     end
  16. end
  17.  
  18. operable.playerCounter = function(model)
  19.     while wait(2) do
  20.         local playerCount = 0
  21.         for i, v in pairs(_G.characters:GetChildren()) do
  22.             if v.Status.Role.Value == "Class-D" then
  23.                 playerCount = playerCount + 1
  24.             end
  25.         end
  26.         local gui = model.Monitor.Screen.SurfaceGui.Frame.Frame.Card
  27.     end
  28. end
  29.  
  30. operable.stash = function(model)
  31.     local itemRestriction = model.Status.ItemRestriction.Value
  32.     model.Container.Touched:connect(function(hitObject)
  33.         local itemModel = _G.item.getModel(hitObject)
  34.         if itemModel then
  35.             local statusFolder = itemModel.Status
  36.             local itemStats = _G.stats.items[itemModel.Name]
  37.             if itemStats and not statusFolder.JustSpawned.Value and (itemRestriction == "all" or itemRestriction == itemStats.type or itemRestriction == itemModel.Name) then
  38.                 statusFolder.JustSpawned.Value = true
  39.                 _G.item.drag(nil, false, itemModel)
  40.                 itemModel.Parent = _G.mouseFilter
  41.                 statusFolder.Name = itemModel.Name
  42.                 statusFolder.Parent = model.Status.Items
  43.                 coroutine.wrap(_G.client.sendToAllClients)("animateStashItem", itemModel, model)
  44.                 wait(.3)
  45.                 itemModel:Destroy()
  46.             end
  47.         end
  48.     end)
  49. end
  50.  
  51. operable.interact = function(player, request, operableType, model, ...)
  52.     if operable[operableType] then
  53.         operable[operableType](player, request, model, ...)
  54.     end
  55. end
  56.  
  57. operable.anchor = function(player, request, model, itemModel)
  58.     if model.Status.Available.Value then
  59.         model.Status.Available.Value = false
  60.         for i, v in pairs(itemModel:GetChildren()) do
  61.             if v:IsA("Part") or v:IsA("UnionOperation") then
  62.                 v.Anchored = true
  63.                 v.CanCollide = false
  64.             end
  65.         end
  66.         model.Status.ItemModel.Value = itemModel
  67.         _G.client.sendToAllClients("animateAnchorItem", itemModel, model)
  68.         local anchorFunction = operable.misc[model.Status.Function.Value]
  69.         model.Status.ItemModel.Value.ChildRemoved:connect(function()
  70.             print("h")
  71.             model.Status.Available.Value = true
  72.             model.Status.ItemModel.Value = nil
  73.             if anchorFunction then
  74.                 anchorFunction(false, model)
  75.             end
  76.         end)
  77.         delay(.2, function()
  78.             itemModel:SetPrimaryPartCFrame(model.Container.CFrame)
  79.             if anchorFunction then
  80.                 anchorFunction(true, model)
  81.             end
  82.         end)
  83.         wait(.5)
  84.         itemModel.Parent = _G.items
  85.     end
  86. end
  87.  
  88. operable.misc = {}
  89.  
  90. operable.misc.keycardReader = function(request, model)
  91.     local gui = model.Computer.Screen.SurfaceGui.Windows.Screen
  92.     if request then
  93.         local itemModel = model.Status.ItemModel.Value
  94.         local itemStats = _G.stats.items[itemModel.Name]
  95.         model.Indicator.BrickColor = BrickColor.new("Bright green")
  96.         model.Indicator.Granted:Play()
  97.         gui.ID_Data.Display.Level.Text.Text = "L-" .. itemStats.clearanceLevel
  98.         gui.ID_Data.Display.NameO.Text.Text = itemModel.Status.Content.ownerName.Value
  99.         gui.ID_Data.Display.Role.Text.Text = itemModel.Status.Content.ownerRole.Value
  100.         gui.ID_Data.Display.Rank.Text.Text = itemModel.Status.Content.ownerRank.Value
  101.         gui.ID_Data.Visible = true
  102.     else
  103.         model.Indicator.BrickColor = BrickColor.new("Bright red")
  104.         gui.ID_Data.Visible = false
  105.     end
  106. end
  107.  
  108. operable.search = function(player, request, model)
  109.     if model.Status.Available.Value then
  110.         model.Status.Available.Value = false
  111.         for i, v in pairs(model.Status.Items:GetChildren() ) do
  112.             local content = {}
  113.             for i, k in pairs(v.Content:GetChildren()) do
  114.                 content[k.Name] = k.Value
  115.             end
  116.             print(v.Name)
  117.             _G.item.spawn(nil, v.Name, model.Container.Position + Vector3.new(0, 1, 0), model.Container.Position + Vector3.new(3, 3, 0), content)
  118.             v:Destroy()
  119.             wait(.1)
  120.         end
  121.         model.Status.Available.Value = true
  122.     end
  123. end
  124.  
  125. operable.lock = function(player, request, model)
  126.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  127.         model.Status.Available.Value = false
  128.         local operableStats = _G.stats.operables.lock
  129.         local targetModel = model.Status.Target.Value
  130.         model.Status.Enabled.Value = request
  131.         model.Status.Target.Value.Status.Locked.Value = request
  132.         wait(.6)
  133.         if request then
  134.             for i, v in pairs(model.Triggers:GetChildren()) do
  135.                 local screenObject = v:FindFirstChild("Screen")
  136.                 if screenObject then
  137.                     v.Screen.Unlocked:Stop()
  138.                     v.Screen.BrickColor = BrickColor.new("Bright red")
  139.                 end
  140.             end
  141.         else
  142.             for i, v in pairs(model.Triggers:GetChildren()) do
  143.                 local screenObject = v:FindFirstChild("Screen")
  144.                 if screenObject then
  145.                     v.Screen.Unlocked:Play()
  146.                     v.Screen.BrickColor = BrickColor.new("Deep orange")
  147.                 end
  148.             end
  149.             local unlockedTime = model.Status.UnlockedTime.Value
  150.             if unlockedTime > -1 then
  151.                 wait(unlockedTime)
  152.                 model.Status.Available.Value = true
  153.                 operable.lock(player, true, model)
  154.             end
  155.         end
  156.         model.Status.Available.Value = true
  157.     end
  158. end
  159.  
  160. operable.normal = function(player, request, model)
  161.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  162.         model.Status.Available.Value = false
  163.         local operableStats = _G.stats.operables.normal
  164.         coroutine.wrap(_G.client.sendToAllClients)("animateNormalDoor", request, model)
  165.         wait(.1)
  166.         if request then
  167.             model.Triggers.Trigger.Handle.Open:Play()
  168.             model.Triggers.Trigger:SetPrimaryPartCFrame(model.Triggers.Trigger:GetPrimaryPartCFrame() * operableStats.enabledOffsetCFrame)
  169.             wait(operableStats.openTime - .1)
  170.         else
  171.             model.Triggers.Trigger:SetPrimaryPartCFrame(model.Triggers.Trigger:GetPrimaryPartCFrame() * operableStats.disabledOffsetCFrame)
  172.             wait(operableStats.closeTime - .1)
  173.             model.Triggers.Trigger.Handle.Close:Play()
  174.         end
  175.         model.Status.Enabled.Value = request
  176.         model.Status.Available.Value = true
  177.     end
  178. end
  179.  
  180. operable.cage = function(player, request, model)
  181.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  182.         model.Status.Available.Value = false
  183.         local operableStats = _G.stats.operables.cage
  184.         for i, v in pairs(model.Triggers:GetChildren()) do
  185.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  186.         end
  187.         wait(1)
  188.         coroutine.wrap(_G.client.sendToAllClients)("animateCageDoor", request, model)
  189.         wait(.1)
  190.         model.Door.Main.Start:Play()
  191.         if request then
  192.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.enabledOffsetCFrame)
  193.             wait(operableStats.openTime - .1)
  194.         else
  195.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.disabledOffsetCFrame)
  196.             wait(operableStats.closeTime - .1)
  197.         end
  198.         model.Door.Main.End:Play()
  199.         for i, v in pairs(model.Triggers:GetChildren()) do
  200.             if request then
  201.                 v.Screen.BrickColor = BrickColor.new("Bright red")
  202.             else
  203.                 v.Screen.BrickColor = BrickColor.new("Bright green")
  204.             end
  205.         end
  206.         model.Status.Enabled.Value = request
  207.         model.Status.Available.Value = true
  208.     end
  209. end
  210.  
  211. operable.bars = function(player, request, model)
  212.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  213.         model.Status.Available.Value = false
  214.         local operableStats = _G.stats.operables.bars
  215.         for i, v in pairs(model.Triggers:GetChildren()) do
  216.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  217.         end
  218.         coroutine.wrap(_G.client.sendToAllClients)("animateBarsDoor", request, model)
  219.         wait(.1)
  220.         for i, v in pairs(model.Door:GetChildren()) do
  221.             v.Start:Play()
  222.         end
  223.         if request then
  224.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.enabledOffsetCFrame)
  225.             wait(operableStats.openTime - .1)
  226.         else
  227.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.disabledOffsetCFrame)
  228.             wait(operableStats.closeTime - .1)
  229.         end
  230.         for i, v in pairs(model.Triggers:GetChildren()) do
  231.             if request then
  232.                 v.Screen.BrickColor = BrickColor.new("Bright red")
  233.             else
  234.                 v.Screen.BrickColor = BrickColor.new("Bright green")
  235.             end
  236.         end
  237.         model.Status.Enabled.Value = request
  238.         model.Status.Available.Value = true
  239.     end
  240. end
  241.  
  242. operable.double = function(player, request, model)
  243.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  244.         model.Status.Available.Value = false
  245.         local operableStats = _G.stats.operables.double
  246.         for i, v in pairs(model.Triggers:GetChildren()) do
  247.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  248.         end
  249.         wait(1)
  250.         if request then
  251.             coroutine.wrap(_G.client.sendToAllClients)("animateDoubleDoor", true, model)
  252.             wait(.1)
  253.             model.Frame.Open:Play()
  254.             model.Doors.Door1.CFrame = model.Doors.Door1.CFrame * operableStats.enabledOffsetCFrame
  255.             model.Doors.Door2.CFrame = model.Doors.Door2.CFrame * operableStats.enabledOffsetCFrame
  256.             wait(operableStats.openTime - 1.1)
  257.             model.Status.Enabled.Value = true
  258.             if model.Status.Sleep.Value then
  259.                 wait(operableStats.sleepTime)
  260.                 model.Status.Available.Value = true
  261.                 operable.double(player, false, model)
  262.             else
  263.                 for i, v in pairs(model.Triggers:GetChildren()) do
  264.                     v.Screen.BrickColor = BrickColor.new("Bright red")
  265.                 end
  266.             end
  267.         else
  268.             coroutine.wrap(_G.client.sendToAllClients)("animateDoubleDoor", false, model)
  269.             wait(.1)
  270.             model.Frame.Close:Play()
  271.             model.Doors.Door1.CFrame = model.Doors.Door1.CFrame * operableStats.disabledOffsetCFrame
  272.             model.Doors.Door2.CFrame = model.Doors.Door2.CFrame * operableStats.disabledOffsetCFrame
  273.             wait(operableStats.closeTime)
  274.             for i, v in pairs(model.Triggers:GetChildren()) do
  275.                 v.Screen.BrickColor = BrickColor.new("Bright green")
  276.             end
  277.             model.Status.Enabled.Value = false
  278.         end
  279.         model.Status.Available.Value = true
  280.     end
  281. end
  282.  
  283. operable.single = function(player, request, model)
  284.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  285.         model.Status.Available.Value = false
  286.         local operableStats = _G.stats.operables.single
  287.         for i, v in pairs(model.Triggers:GetChildren()) do
  288.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  289.         end
  290.         wait(1)
  291.         coroutine.wrap(_G.client.sendToAllClients)("animateSingleDoor", request, model)
  292.         wait(.1)
  293.         if request then
  294.             model.Frame.Open:Play()
  295.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.enabledOffsetCFrame)
  296.             wait(operableStats.openTime - .1)
  297.         else
  298.             model.Frame.Close:Play()
  299.             model.Door:SetPrimaryPartCFrame(model.Door:GetPrimaryPartCFrame() * operableStats.disabledOffsetCFrame)
  300.             wait(operableStats.closeTime - .1)
  301.         end
  302.         for i, v in pairs(model.Triggers:GetChildren()) do
  303.             if request then
  304.                 v.Screen.BrickColor = BrickColor.new("Bright red")
  305.             else
  306.                 v.Screen.BrickColor = BrickColor.new("Bright green")
  307.             end
  308.         end
  309.         model.Status.Enabled.Value = request
  310.         model.Status.Available.Value = true
  311.     end
  312. end
  313.  
  314. operable.hatch = function(player, request, model)
  315.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  316.         model.Status.Available.Value = false
  317.         local operableStats = _G.stats.operables.hatch
  318.         coroutine.wrap(_G.client.sendToAllClients)("animateHatch", request, model)
  319.         wait(.1)
  320.         if request then
  321.             model.Triggers.Trigger.Main.Open:Play()
  322.             model.Triggers.Trigger:SetPrimaryPartCFrame(model.Triggers.Trigger:GetPrimaryPartCFrame() * operableStats.enabledOffsetCFrame)
  323.             wait(operableStats.openTime - .1)
  324.         else
  325.             model.Triggers.Trigger:SetPrimaryPartCFrame(model.Triggers.Trigger:GetPrimaryPartCFrame() * operableStats.disabledOffsetCFrame)
  326.             wait(operableStats.closeTime - .1)
  327.             model.Triggers.Trigger.Main.Close:Play()
  328.         end
  329.         model.Status.Enabled.Value = request
  330.         model.Status.Available.Value = true
  331.     end
  332. end
  333.  
  334. operable.lights = function(player, request, model)
  335.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  336.         model.Status.Available.Value = false
  337.         for i, v in pairs(model.Triggers:GetChildren()) do
  338.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  339.         end
  340.         for i, v in pairs(model.Lights:GetChildren()) do
  341.             if v:FindFirstChild("Status") and v.Status.Type.Value == "light" then
  342.                 operable.light(player, request, v)
  343.                 wait(.1)
  344.             end
  345.         end
  346.         for i, v in pairs(model.Triggers:GetChildren()) do
  347.             if request then
  348.                 v.Screen.BrickColor = BrickColor.new("Bright red")
  349.             else
  350.                 v.Screen.BrickColor = BrickColor.new("Bright green")
  351.             end
  352.         end
  353.         model.Status.Enabled.Value = request
  354.         model.Status.Available.Value = true
  355.     end
  356. end
  357.  
  358. operable.light = function(player, request, model)
  359.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  360.         model.Status.Available.Value = false
  361.         local lightType = model.Status.LightType.Value
  362.         if lightType == "suspended" then
  363.             if request then
  364.                 model.Bulb.Material = Enum.Material.Neon
  365.             else
  366.                 model.Bulb.Material = Enum.Material.SmoothPlastic
  367.             end
  368.             model.Bulb.Light.Enabled = request
  369.             model.Bulb.SpotLight.Enabled = request
  370.         elseif lightType == "inlaid" then
  371.             if request then
  372.                 model.Material = Enum.Material.Neon
  373.             else
  374.                 model.Material = Enum.Material.SmoothPlastic
  375.             end
  376.             model.Tick:Play()
  377.             model.SpotLight.Enabled = request
  378.         end
  379.         model.Status.Enabled.Value = request
  380.         model.Status.Available.Value = true
  381.     end
  382. end
  383.  
  384. operable.scan = function(player, request, model)
  385.     if model.Status.Available.Value and model.Status.Enabled.Value ~= request then
  386.         model.Status.Available.Value = false
  387.         local scannerType = model.Status.ScannerType.Value
  388.         local operableStats = _G.stats.operables[scannerType]
  389.         if scannerType == "penitentiary" then
  390.            
  391.         end
  392.         for i, v in pairs(model.Triggers:GetChildren()) do
  393.             v.Screen.BrickColor = BrickColor.new("Deep orange")
  394.         end
  395.         model.Status.Enabled.Value = true
  396.         local gui = model.Monitor.Screen.SurfaceGui.Frame.Frame.Main.Main
  397.         local scannedPlayers = {}
  398.         coroutine.wrap(_G.client.sendToAllClients)("animateScanner", model)
  399.         wait(operableStats.scanTime)
  400.         for i, v in pairs(_G.players:GetPlayers()) do
  401.             if _G.misc.isPartWithinRegion3(v.Character.HumanoidRootPart, model.Status.Region.Value) then
  402.                 table.insert(scannedPlayers, v)
  403.             end
  404.         end
  405.         for i, v in pairs(model.Triggers:GetChildren()) do
  406.             v.Screen.BrickColor = BrickColor.new("Bright red")
  407.         end
  408.         gui.Count.Count.Text = #scannedPlayers
  409.         model.Status.Enabled.Value = false
  410.         model.Status.Available.Value = true
  411.         wait(10)
  412.         if model.Status.Available.Value then
  413.             gui.Count.Count.Text = "--"
  414.         end
  415.     end
  416. end
  417.  
  418. return operable
Advertisement
Add Comment
Please, Sign In to add comment