Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local OrionLib = loadstring(game:HttpGet("https://raw.githubusercontent.com/shlexware/Orion/main/source"))()
- local svc = {
- RS = game:GetService("ReplicatedStorage"),
- RunService = game:GetService("RunService")
- }
- local cfg = {
- flowOn = false,
- flowNodeDelay = 0.04,
- flowLineDelay = 0.60
- }
- local Window = OrionLib:MakeWindow({
- Name = "NVCat'S_scripts",
- HidePremium = false,
- SaveConfig = true,
- ConfigFolder = "NVCat_Config"
- })
- local Tab = Window:MakeTab({
- Name = "Generator",
- Icon = "rbxassetid://4483362458",
- PremiumOnly = false
- })
- local function flowKey(n) return n.row.."-"..n.col end
- local function flowDirFlip(d)
- return ({up="down",down="up",left="right",right="left"})[d]
- end
- local function flowDir(r1,c1,r2,c2)
- if r2<r1 then return"up" elseif r2>r1 then return"down" elseif c2<c1 then return"left" elseif c2>c1 then return"right" end
- end
- local function flowNeighbour(r1,c1,r2,c2)
- if r2==r1-1 and c2==c1 then return"up" end
- if r2==r1+1 and c2==c1 then return"down" end
- if r2==r1 and c2==c1-1 then return"left" end
- if r2==r1 and c2==c1+1 then return"right" end
- return false
- end
- local function flowConnections(prev,curr,nxt)
- local t={}
- if prev and curr then
- local d=flowDir(curr.row,curr.col,prev.row,prev.col)
- if d then t[flowDirFlip(d)]=true end
- end
- if nxt and curr then
- local d=flowDir(curr.row,curr.col,nxt.row,nxt.col)
- if d then t[d]=true end
- end
- return t
- end
- local function flowOrder(path,endpoints)
- if not path or #path==0 then return path end
- local lookup={}
- for _,n in ipairs(path) do lookup[flowKey(n)]=n end
- local start
- for _,ep in ipairs(endpoints or{}) do
- for _,n in ipairs(path) do
- if n.row==ep.row and n.col==ep.col then start={row=ep.row,col=ep.col};break end
- end
- if start then break end
- end
- if not start then
- for _,n in ipairs(path) do
- local nb=0
- for _,d in ipairs({{-1,0},{1,0},{0,-1},{0,1}}) do
- if lookup[(n.row+d[1]).."-"..(n.col+d[2])] then nb+=1 end
- end
- if nb==1 then start={row=n.row,col=n.col};break end
- end
- end
- if not start then start={row=path[1].row,col=path[1].col} end
- local pool={}
- local ordered={}
- for _,n in ipairs(path) do pool[flowKey(n)]={row=n.row,col=n.col} end
- local cur=start
- table.insert(ordered,{row=cur.row,col=cur.col})
- pool[flowKey(cur)]=nil
- while next(pool) do
- local moved=false
- for k,node in pairs(pool) do
- if flowNeighbour(cur.row,cur.col,node.row,node.col) then
- table.insert(ordered,{row=node.row,col=node.col})
- pool[k]=nil
- cur=node
- moved=true
- break
- end
- end
- if not moved then break end
- end
- return ordered
- end
- local function flowSolve(puzzle)
- if not puzzle or not puzzle.Solution then return end
- local indices={}
- for i=1,#puzzle.Solution do indices[i]=i end
- for i=#indices,2,-1 do
- local j=math.random(1,i)
- indices[i],indices[j]=indices[j],indices[i]
- end
- for _,ci in ipairs(indices) do
- local ordered=flowOrder(puzzle.Solution[ci],puzzle.targetPairs[ci])
- puzzle.paths[ci]={}
- for i,node in ipairs(ordered) do
- table.insert(puzzle.paths[ci],{row=node.row,col=node.col})
- puzzle.gridConnections=puzzle.gridConnections or{}
- puzzle.gridConnections[flowKey(node)]=flowConnections(ordered[i-1],node,ordered[i+1])
- puzzle:updateGui()
- task.wait(cfg.flowNodeDelay)
- end
- task.wait(cfg.flowLineDelay)
- puzzle:checkForWin()
- end
- end
- task.spawn(function()
- local mod = svc.RS:FindFirstChild("Modules") and svc.RS.Modules:FindFirstChild("Misc") and svc.RS.Modules.Misc:FindFirstChild("FlowGameManager") and svc.RS.Modules.Misc.FlowGameManager:FindFirstChild("FlowGame")
- if mod then
- local FG=require(mod)
- local orig=FG.new
- FG.new=function(...)
- local p=orig(...)
- if cfg.flowOn then
- task.spawn(function() task.wait(0.3); flowSolve(p) end)
- end
- return p
- end
- end
- end)
- Tab:AddToggle({
- Name = "Auto Solve Enabled",
- Default = cfg.flowOn,
- Save = true,
- Callback = function(Value)
- cfg.flowOn = Value
- end
- })
- Tab:AddSlider({
- Name = "Node Speed",
- Min = 0.01,
- Max = 0.5,
- Default = cfg.flowNodeDelay,
- Increment = 0.01,
- ValueName = "s",
- Callback = function(Value)
- cfg.flowNodeDelay = Value
- end
- })
- Tab:AddSlider({
- Name = "Line Pause",
- Min = 0,
- Max = 1,
- Default = cfg.flowLineDelay,
- Increment = 0.1,
- ValueName = "s",
- Callback = function(Value)
- cfg.flowLineDelay = Value
- end
- })
- Tab:AddButton({
- Name = "Copy Discord",
- Callback = function()
- if setclipboard then
- setclipboard("https://discord.gg/Ud9vJzuCV")
- OrionLib:MakeNotification({
- Name = "Copied",
- Content = "Discord copied!",
- Time = 3
- })
- end
- end
- })
- OrionLib:Init()
Advertisement
Add Comment
Please, Sign In to add comment