content
stringlengths
5
1.05M
require('nn') local FilterGrid, parent = torch.class('nn.FilterGrid', 'nn.Module') function FilterGrid:__init(N, dim_size, nInputDim) self.grid = torch.range(1, dim_size):resize(1, dim_size):repeatTensor(N, 1) self.nInputDim = nInputDim parent.__init(self) end function FilterGrid:updateOutput(input) if self.nInputDim and input:dim()> self.nInputDim then local grid_size = self.grid:size():totable() self.output:resize(input:size(1), table.unpack(grid_size)) local grid = self.grid:view(1, table.unpack(grid_size)) self.output:copy(grid:expand(self.output:size())) else self.output:resize(self.grid:size()) self.output:copy(self.grid) end return self.output end function FilterGrid:cuda() self.output = self.grid:cuda() end function FilterGrid:updateGradInput(input, gradOutput) self.gradInput:resizeAs(input):zero() return self.gradInput end
--keys and controls because controls are weird xd --[5:12:53 PM] jarredbcv: ww --[5:12:55 PM] jarredbcv: awssd --[5:12:57 PM] jarredbcv: assd --[5:13:00 PM] jarredbcv: wasd --[5:13:02 PM] jarredbcv: and --[5:13:07 PM] jarredbcv: f --to equip the hammer press Q --Enjoy! --Chromium lp=game.Players.LocalPlayer pl=lp.Character mouse=lp:GetMouse() mo=Instance.new("Model",pl) pi=math.pi Key={} sec=5 cleanup=sec*10 a=false deb=false hitdeb=false isblocking=false swing=1 equi=false bg = Instance.new("BodyGyro") bg.P = 20e+003 bg.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge rad=math.rad ca=CFrame.Angles cf=CFrame.new Part = function(x,y,z,color,tr,cc,an,parent) local p = Instance.new('Part',parent or Weapon) p.formFactor = 'Custom' p.Size = Vector3.new(x,y,z) p.BrickColor = BrickColor.new(color) p.CanCollide = cc p.Transparency = tr p.Anchored = an p.TopSurface,p.BottomSurface = 0,0 p.Locked=true p:BreakJoints() return p end so = function(id,par,lo,pi,tm) s = Instance.new("Sound",par) s.Looped=lo s.Pitch=pi s.SoundId = "http://roblox.com/asset/?id="..id s:play() s.Volume=.1 game.Debris:AddItem(s,tm) end so2 = function(id,par,lo,pi,tm) s = Instance.new("Sound",par) s.Looped=lo s.Pitch=pi s.SoundId = id s:play() s.Volume=.1 game.Debris:AddItem(s,tm) end wPart = function(x,y,z,color,tr,cc,an,parent) local wp = Instance.new('WedgePart',parent or Weapon) wp.formFactor = 'Custom' wp.Size = Vector3.new(x,y,z) wp.BrickColor = BrickColor.new(color) wp.CanCollide = cc wp.Transparency = tr wp.Locked=true wp.Anchored = an wp.TopSurface,wp.BottomSurface = 0,0 wp:BreakJoints() return wp end Weld = function(p0,p1,x,y,z,rx,ry,rz,par) local w = Instance.new('Motor',par or p0)w.Part0 = p0 w.Part1 = p1 w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz) return w end Mesh = function(par,num,x,y,z) local msh = _ if num == 1 then msh = Instance.new("CylinderMesh",par) elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3 elseif num == 3 then msh = Instance.new("BlockMesh",par) elseif num == 4 then msh = Instance.new("SpecialMesh",par) msh.MeshType = "Torso" elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par) msh.MeshId = num end msh.Scale = Vector3.new(x,y,z) return msh end Tween = function(Weld, Stop, Step,a) ypcall(function()local func = function() local Start = Weld.C1 local X1, Y1, Z1 = Start:toEulerAnglesXYZ() local Stop = Stop local X2, Y2, Z2 = Stop:toEulerAnglesXYZ() Spawn(function()for i = 0, 1, Step or .1 do wait() Weld.C1 = cf( (Start.p.X * (1 - i)) + (Stop.p.X * i),(Start.p.Y * (1 - i)) + (Stop.p.Y * i),(Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * ca((X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),(Z1 * (1 - i)) + (Z2 * i) ) end Weld.C1 = Stop end) end if a then coroutine.wrap(func)() else func() end end)end function ani(val) if val==true then lp = Part(.1,.1,.1,'',1,false,false,mo) rp = Part(.1,.1,.1,'',1,false,false,mo) hp = Part(.1,.1,.1,'',1,false,false,mo) lw = Weld(lp,pl.Torso,-1.5,.5,0,0,0,0,mo) rw = Weld(rp,pl.Torso,1.5,.5,0,0,0,0,mo) hw = Weld(hp,pl.Torso,0,2,0,0,0,0,mo) Weld(pl['Right Arm'],rp,0,-.5,0,0,0,0,mo) Weld(pl['Left Arm'],lp,0,-.5,0,0,0,0,mo) Weld(pl.Head,hp,0,-.5,0,0,0,0,mo) else rp:Destroy()lp:Destroy()hp:Destroy() end end function gradient(prnt,col,rng,brt,tm) local f=Instance.new('PointLight',prnt) f.Color=col f.Range=rng f.Brightness=brt Spawn(function() while wait(tm) do if f.Brightness <= 0 then f:Destroy() break end f.Brightness=f.Brightness-0.05 end end) end function trail(pos,tim,col) Spawn(function() for i=1,tim do local oldpos=pos.CFrame.p wait() local newpos=pos.CFrame.p local mag = (oldpos-newpos).magnitude local a= Part(1,1,1,col,0,false,true,mo) local m= Mesh(a,1,1,mag,1) local hiter=a.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent.Name ~= pl.Name and hitdeb==false then hitdeb=true hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health-10 so('46153268',hit.Parent,false,math.random(50,100)/100,1) wait(.1) hitdeb=false end end) gradient(a,a.BrickColor.Color,7,.5,0) a.CFrame=cf(oldpos,newpos)*cf(0,0,-mag/2)*ca(pi/2,0,0) Spawn(function() for i=1,10 do wait() m.Scale=m.Scale-Vector3.new(.1,0,.1) end wait(.5) hiter:disconnect() a:Destroy() end) end end) end function mgblock(pa,cfr,tm,col1,col2,sz,wa) local cols={col1,col2} Spawn(function() for i=1,tm do wait(wa) local a= Part(1,1,1,cols[math.random(1,2)],0,false,true,mo) v1,v2,v3=sz.x,sz.y,sz.z local m= Mesh(a,3,v1,v2,v3) a.CFrame=pa.CFrame*cfr*ca(math.random(),math.random(),math.random()) gradient(a,BrickColor.new('Royal purple').Color,10,1,0) Spawn(function() while wait() do if a.Transparency >= 1 then a:Destroy() break end m.Scale=m.Scale-Vector3.new(.1,0.1,0.1) a.CFrame=a.CFrame+Vector3.new(0,0.1,0) a.Transparency=a.Transparency+0.05 end end) end end) end function explosion(col1,col2,cfr,sz,rng,dmg) local a= Part(1,1,1,col1,.5,false,true,mo) local a2= Part(1,1,1,col2,.5,false,true,mo) local a3= Part(1,1,1,col2,.5,false,true,mo) v1,v2,v3=sz.x,sz.y,sz.z local m= Mesh(a,'http://www.roblox.com/asset/?id=1185246',v1,v2,v3) local m2= Mesh(a2,3,v1/3,v2/3,v3/3) local m3= Mesh(a3,3,v1/3,v2/3,v3/3) a.CFrame=cfr a2.CFrame=cfr*ca(math.random(),math.random(),math.random()) a3.CFrame=cfr*ca(math.random(),math.random(),math.random()) gradient(a,BrickColor.new('Royal purple').Color,20,1,0.05) so('2697431',a,false,.2,1) for i,v in pairs(workspace:children()) do if v:IsA("Model") and v:findFirstChild("Humanoid") then if v:findFirstChild("Head") and v:findFirstChild("Torso") then if (v:findFirstChild("Torso").Position - a.Position).magnitude < rng and v.Name ~= pl.Name then v.Humanoid.Health=v.Humanoid.Health-dmg mgblock(v.Torso,cf(0,0,0),30,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) end end end end Spawn(function() while wait() do if a.Transparency >= 1 then a:Destroy() a2:Destroy() a3:Destroy() break end m.Scale=m.Scale+Vector3.new(.1,0.1,0.1) m2.Scale=m2.Scale+Vector3.new(.1,0.1,0.1) m3.Scale=m3.Scale+Vector3.new(.1,0.1,0.1) a.Transparency=a.Transparency+0.05 a2.Transparency=a2.Transparency+0.05 a3.Transparency=a3.Transparency+0.05 end end) end function hit(vl,parent,dmg) if vl==true then dodmg=parent.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent.Name ~= pl.Name and hitdeb==false then hitdeb=true hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health-dmg so('46153268',hit.Parent,false,math.random(50,100)/100,1) wait(.1) hitdeb=false end end) else dodmg:disconnect() end end function bam() print'Shadow Bombs [Rave]' deb=true Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(150)),.1) Tween(rw,cf(1.5,.5,0)*ca(rad(120),0,rad(40)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2+rad(30),pi/2+rad(50),0),.1) wait(.35) so('28144425',pl.Torso,false,.265,1) mgblock(pl['Left Arm'],cf(0,-1,0),5,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) wait(.4) Tween(rw,cf(1.5,.5,0)*ca(rad(50),0,-rad(20)),.3) Tween(mwl,cf(0,-1,0)*ca(-pi/2-rad(50),pi/2,0),.3) Tween(lw,cf(-1.5,.5,0)*ca(rad(30),0,rad(20)),.3) wait(.15) so('63719813',pl.Torso,false,.525,1) local goto=pl.Torso.CFrame for i=1,10 do wait(.05) explosion('Really black','Royal purple',goto*cf(0,0,-i-i*2),Vector3.new(10,10,10),5,7) end Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) deb=false end function lunge() print'Shadow lunge [Rave]' deb=true so('10209645',pl.Torso,false,1,1) Tween(rw,cf(1.5,.5,0)*ca(rad(50),0,-rad(60)),.1) Tween(mwl,cf(0,-1,0)*ca(-pi/2-rad(50),pi/2,0),.1) Tween(lw,cf(-1.5,.5,0)*ca(rad(50),0,rad(60)),.1) wait(.35) so('62339698',pl.Torso,false,.3,1) Spawn(function() for i=1,7 do wait() local efx= Part(1,1,1,'Really black',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=20329976',3,1,3) efx.CFrame=pl.Torso.CFrame*ca(pi/2,0,0) Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(.3,.1,.3) end efx:Destroy() end) end end) gradient(pl.Torso,BrickColor.new('Royal purple').Color,10,2,0) trail(pl.Torso,16,'Royal purple') mgblock(pl.Torso,cf(0,0,0),3,'Really black','Royal purple',Vector3.new(3,3,3),.1) local v = Instance.new("BodyVelocity",pl.Torso) v.maxForce = Vector3.new(1,1,1)*9e9 v.P = 2000 v.velocity = pl.Torso.CFrame.lookVector*60 Tween(rw,cf(1.5,.5,-1)*ca(rad(50),0,-rad(60)),.2) Tween(lw,cf(-1.5,.5,-1)*ca(rad(50),0,rad(60)),.2) wait(.25) v:Destroy() Tween(rw,cf(1.5,.5,0)*ca(rad(50),0,-rad(60)),.2) Tween(lw,cf(-1.5,.5,0)*ca(rad(50),0,rad(60)),.2) wait(.25) Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) deb=false end function bain() print'Shadow warp [Bain]' deb=true bloop=false Tween(lw,cf(-1.5,.5,0)*ca(rad(80),0,-rad(30)),.3) Tween(rw,cf(1.5,.5,0)*ca(rad(20),rad(30),rad(30)),.3) wait(.1) mgblock(pl['Left Arm'],cf(0,-1,0),5,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) wait(.5) for i,v in pairs(workspace:children()) do if v:IsA("Model") and v:findFirstChild("Humanoid") then if v:findFirstChild("Head") and v:findFirstChild("Torso") then if (v:findFirstChild("Torso").Position - pl.Torso.Position).magnitude < 6 and v.Name ~= pl.Name then bp=Instance.new('BodyPosition',v.Torso) bp.maxForce=Vector3.new(1e1000,1e1000,1e1000) Spawn(function() while wait() do if bloop==true then break end mgblock(v.Torso,cf(0,0,0),1,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) bp.position=pl.Torso.CFrame.p end end) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(90)),.3) Tween(rw,cf(1.5,.5,0)*ca(0,0,rad(90)),.3) wait(.2) trail(pl['Right Arm'],30,'Royal purple') trail(pl['Left Arm'],30,'Royal purple') Spawn(function() for i=1,20 do wait() local efx= Part(1,1,1,'Really black',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=20329976',3,1,3) efx.CFrame=pl.Torso.CFrame Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(1,.2,1) end efx:Destroy() end) end end) local vs = Instance.new("BodyVelocity",pl.Torso) vs.maxForce = Vector3.new(1,1,1)*9e9 vs.P = 2000 vs.velocity = Vector3.new(0,150,0) local rv = Instance.new("BodyAngularVelocity",pl.Torso) rv.maxTorque = Vector3.new(1,1,1)*9e9 rv.P = 5000 rv.angularvelocity = Vector3.new(0,200,0) so('69935389',pl.Torso,false,.7,1) wait(1) pl.Torso.Anchored=true wait(.3) Tween(lw,cf(-1.5,.5,0)*ca(rad(90),0,rad(30)),.1) Tween(rw,cf(1.5,.5,0)*ca(rad(90),0,-rad(30)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2+rad(90),pi/2,0),.1) wait(.4) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(90)),.3) Tween(rw,cf(1.5,.5,0)*ca(0,0,rad(90)),.3) explosion('Really black','Royal purple',pl.Torso.CFrame,Vector3.new(30,30,30),30,30) wait(.2) bloop=true v.Humanoid.Sit=true vs:Destroy() rv:Destroy() pl.Torso.Anchored=false bp:Destroy() Spawn(function() wait(1.5) v.Humanoid.Jump=true end) end end end end Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) deb=false end function bain2() print'Shadow mite [Bain]' deb=true doo=false bloop=false Tween(lw,cf(-1.5,.5,0)*ca(rad(80),0,-rad(30)),.3) Tween(rw,cf(1.5,.5,0)*ca(rad(20),rad(30),rad(30)),.3) wait(.1) mgblock(pl['Left Arm'],cf(0,-1,0),5,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) wait(.5) for i,v in pairs(workspace:children()) do if v:IsA("Model") and v:findFirstChild("Humanoid") then if v:findFirstChild("Head") and v:findFirstChild("Torso") then if (v:findFirstChild("Torso").Position - pl.Torso.Position).magnitude < 6 and v.Name ~= pl.Name then bp=Instance.new('BodyPosition',v.Torso) bp.maxForce=Vector3.new(1e1000,1e1000,1e1000) pl.Torso.Anchored=true so2('rbxasset://sounds\\swordlunge.wav',pl.Torso,false,.5,1) gotopos=pl.Torso.CFrame*CFrame.new(0,0,-20).p Spawn(function() while wait() do if bloop==true then break end if doo==true then bp.position=pl.Torso.CFrame.p mgblock(v.Torso,cf(0,0,0),1,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) else mgblock(v.Torso,cf(0,0,0),1,'Really black','Royal purple',Vector3.new(1.5,1.5,1.5),.1) bp.position=gotopos end end end) wait(.5) Tween(rw,cf(1,.5,0)*ca(rad(100),0,-rad(40)),.1) Tween(lw,cf(-1,.5,0)*ca(rad(100),0,rad(40)),.1) Tween(mwl,cf(0,-1,-1.25)*ca(-pi/2-rad(10),pi/2-rad(30),0),.1) wait(.35) hit(true,hitb,20) gradient(hitb,BrickColor.new('Royal purple').Color,10,1,0.05) Spawn(function() for i=1,5 do wait(0.05) local efx= Part(1,1,1,'Black',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=51177741',1,1,1) efx.CFrame=hitb.CFrame*ca(0,-pi/2,0) Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(.1,.1,.1) end efx:Destroy() end) end end) mgblock(hitb,cf(0,0,0),10,'Really black','Royal purple',Vector3.new(1,1,1),0) so('10209645',pl.Torso,false,.6,1) so('63719813',pl.Torso,false,.525,1) trail(hitb,7,'Royal purple') Tween(rw,cf(1,.5,0)*ca(rad(20),0,-rad(40)),.2) Tween(lw,cf(-1,.5,0)*ca(rad(20),0,rad(40)),.2) wait(.25) hit(false) local efx= Part(1,1,1,'Black',.5,false,false,mo) efx.CFrame=pl.Torso.CFrame local m= Mesh(efx,'http://www.roblox.com/asset/?id=58430372',3,3,3) gradient(efx,BrickColor.new('Royal purple').Color,10,2,0) trail(efx,16,'Royal purple') mgblock(efx,cf(0,0,0),3,'Really black','Royal purple',Vector3.new(3,3,3),.1) local psuh = Instance.new("BodyVelocity",efx) psuh.maxForce = Vector3.new(1,1,1)*9e9 psuh.P = 2000 psuh.velocity = pl.Torso.CFrame.lookVector*60 wait(.25) efx:Destroy() explosion('Really black','Royal purple',v.Torso.CFrame,Vector3.new(15,15,15),20,30) wait(.15) doo=true pl.Torso.Anchored=false mgblock(pl.Torso,cf(0,0,0),30,'Really black','Royal purple',Vector3.new(10,10,10),0) local vs = Instance.new("BodyVelocity",pl.Torso) vs.maxForce = Vector3.new(1,1,1)*9e9 vs.P = 2000 vs.velocity = pl.Torso.CFrame.lookVector*60+Vector3.new(0,150,0) local rv = Instance.new("BodyAngularVelocity",pl.Torso) rv.maxTorque = Vector3.new(1,1,1)*9e9 rv.P = 5000 rv.angularvelocity = Vector3.new(0,200,0) so('69935389',pl.Torso,false,.5,1) Spawn(function() for i=1,20 do wait() local efx= Part(1,1,1,'Really black',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=20329976',3,1,3) efx.CFrame=pl.Torso.CFrame Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(1,.2,1) end efx:Destroy() end) end end) wait(1) pl.Torso.Anchored=true rv:Destroy() wait(.5) pl.Torso.Anchored=false vs.velocity = Vector3.new(0,-200,0) wait(1.5) explosion('Really black','Royal purple',pl.Torso.CFrame,Vector3.new(100,100,100),50,100) so('10730819',pl.Torso,false,1,1) v:BreakJoints() bloop=true vs:Destroy() bp:Destroy() pl.Torso.CFrame=pl.Torso.CFrame+Vector3.new(0,10,0) for i=1, 30 do local p= Part(math.random(15,35),math.random(15,35),math.random(4,5),workspace.Base.BrickColor.Color,0,true,true,mo) p.Material=workspace.Base.Material p.CFrame=cf(pl.Torso.CFrame.x+math.random(-i,i),0,pl.Torso.CFrame.z+math.random(-i,i))*ca(math.random(-10,10)/30,math.random(-10,10)/30,math.random(-10,10)/30)*ca(pi/2,0,0) p.TopSurface=workspace.Base.TopSurface p.RightSurface=workspace.Base.TopSurface p.LeftSurface=workspace.Base.TopSurface p.BottomSurface=workspace.Base.TopSurface p.FrontSurface=workspace.Base.TopSurface p.BackSurface=workspace.Base.TopSurface game:GetService("Debris"):AddItem(p,5+i*.1) if math.random(1,5)==5 then coroutine.resume(coroutine.create(function(p) f=Instance.new("Smoke") f.Parent=p f.Size=15 f.RiseVelocity=0 f.Opacity=.025 wait(.1) f.Enabled=false wait(1) f:Remove() end),p) end end for i=1, 30 do wait() local p= Part(math.random(1,5),math.random(1,5),math.random(1,5),workspace.Base.BrickColor.Color,0,true,false,mo) p:BreakJoints() p.Material=workspace.Base.Material p.CFrame=cf(pl.Torso.CFrame.x+math.random(-i,i),math.random(6,15),pl.Torso.CFrame.z+math.random(-i,i))*ca(math.random(-10,10)/30,math.random(-10,10)/30,math.random(-10,10)/30)*ca(pi/2,0,0) p.TopSurface=workspace.Base.TopSurface p.RightSurface=workspace.Base.TopSurface p.LeftSurface=workspace.Base.TopSurface p.BottomSurface=workspace.Base.TopSurface p.FrontSurface=workspace.Base.TopSurface p.BackSurface=workspace.Base.TopSurface game:GetService("Debris"):AddItem(p,7+i*.1) if math.random(1,5)==5 then coroutine.resume(coroutine.create(function(p) f=Instance.new("Smoke") f.Parent=p f.Size=15 f.RiseVelocity=0 f.Opacity=.025 wait(.1) f.Enabled=false wait(1) f:Remove() end),p) end end end end end end Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) deb=false end function block1() deb=true so('28257433',pl.Torso,false,.5,1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(130)),.1) Tween(rw,cf(1.5,.5,0)*ca(rad(20),rad(30),rad(30)),.1) Tween(hw,cf(0,2,0)*ca(0,rad(90),0),.1) wait(.35) bg.Parent = pl.Torso isblocking=true pl.Humanoid.Name="God" local ff=Instance.new('ForceField',pl) last=ff Spawn(function() while true do if isblocking==false then break end pl.God.Health=100000000000 pl.God.MaxHealth=100000000000 last:Destroy() local ff=Instance.new('ForceField',pl) last=ff bg.cframe = CFrame.new(pl.Torso.Position,Vector3.new(mouse.Hit.p.x,pl.Torso.CFrame.p.y,mouse.Hit.p.z))*CFrame.Angles(0,-rad(90),0) local efx= Part(1,1,1,'Royal purple',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=176248871 ',1,1,1) efx.CFrame=pl['Left Arm'].CFrame*ca(pi/2,pi/1,-pi/2)*cf(0,0,-1)*ca(-rad(40),0,0) Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(.2,.2,.2) end efx:Destroy() end) mgblock(pl['Left Arm'],cf(0,-1,0),1,'Really black','Royal purple',Vector3.new(1.6,1.6,1.6),.1) wait() end end) wait(.3) isblocking=true end function block2() so('28257433',pl.Torso,false,.5,1) bg.Parent = nil isblocking=false last:Destroy() ypcall(function() pl.God.Name="Humanoid" end) pl.Humanoid.Health=100 pl.Humanoid.MaxHealth=100 Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) Tween(hw,cf(0,2,0)*ca(0,0,0),.1) wait(.35) deb=false end function eq() deb=true so('31758934',pl.Torso,false,1,1) ani(true) Tween(rw,cf(1.5,.5,0)*ca(-rad(60),0,-rad(50)),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) wait(.4) mwl.Part1 = pl['Right Arm'] Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) wait(.4) equi=true deb=false end function dc() deb=true equi=false so('31758934',pl.Torso,false,1,1) Tween(rw,cf(1.5,.5,0)*ca(-rad(60),0,-rad(50)),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) wait(.3) Tween(mwl,cf(0,.5,.5)*ca(0,0,pi/3.5),.1) Tween(lw,cf(-1.5,.5,0),.1) Tween(rw,cf(1.5,.5,0),.1) wait(.3) mwl.Part1 = pl.Torso ani(false) deb=false end function checkbind() if #Key==2 and Key[1]==1 and Key[2]==1 then print(unpack(Key)) lunge() print'clean up' Key={} cleanup=sec*10 Spawn(function() wait() print'GO' end) end if #Key==4 and Key[1]==2 and Key[2]==3 and Key[3]==4 and Key[4]==1 then print(unpack(Key)) bam() print'clean up' Key={} cleanup=sec*10 Spawn(function() wait() print'GO' end) end if #Key==4 and Key[1]==2 and Key[2]==3 and Key[3]==3 and Key[4]==4 then print(unpack(Key)) bain() print'clean up' Key={} cleanup=sec*10 Spawn(function() wait() print'GO' end) end if #Key==5 and Key[1]==2 and Key[2]==1 and Key[3]==3 and Key[4]==3 and Key[5]==4 then print(unpack(Key)) bain2() print'clean up' Key={} cleanup=sec*10 Spawn(function() wait() print'GO' end) end end mpa= Part(.25,3,.25,'Really black',0,false,false,mo) mwl= Weld(mpa,pl.Torso,0,.5,.5,0,0,pi/3.5,mo) pa= Part(.4,1,.4,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,-1,0,0,0,0,mo) m= Mesh(pa,1,1,1,1) pa= Part(.4,.5,.4,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,1.25,0,0,0,0,mo) m= Mesh(pa,1,1,1,1) pa= Part(.5,.5,.5,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,-1.5,0,pi/10,pi/4,0,mo) pa= Part(.5,.5,.5,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,-1.5,0,pi/5,pi/8,0,mo) pa= Part(.4,.4,.4,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,1.5,0,pi/10,pi/4,0,mo) pa= Part(.4,.4,.4,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,0,1.5,0,pi/5,pi/8,0,mo) hitb= Part(.75,.76,.75,'Dark stone grey',0,false,false,mo) wl= Weld(hitb,mpa,0,1.9,0,0,0,0,mo) pa= Part(.75,.25,.75,'Royal purple',0,false,false,mo) wl= Weld(pa,mpa,-.5,1.9,0,0,0,pi/2,mo)m= Mesh(pa,4,1,1,1) pa= Part(.75,.5,.75,'Really black',0,false,false,mo) wl= Weld(pa,mpa,-.5,1.9,0,pi/2,0,pi/2,mo)m= Mesh(pa,4,1,1,1) pa= wPart(.75,.2,.4,'Really black',0,false,false,mo) wl= Weld(pa,mpa,.2,2.375,0,0,pi/2,0,mo) pa= wPart(.75,.2,.4,'Really black',0,false,false,mo) wl= Weld(pa,mpa,.2,1.9,.475,pi/2,pi/2,0,mo) pa= wPart(.75,.2,.4,'Really black',0,false,false,mo) wl= Weld(pa,mpa,.2,1.9,-.475,-pi/2,pi/2,0,mo) pa= wPart(.75,.2,.4,'Really black',0,false,false,mo) wl= Weld(pa,mpa,.2,1.425,0,pi/1,pi/2,0,mo) asd= Part(.1,1.13,1.13,'Royal purple',0,false,false,mo) wl= Weld(asd,mpa,.5,1.9,0,0,0,0,mo) function onKeyDown(key) key = key:lower() if deb==true then return end if key == "q" then a=not a if a then eq()else dc()end end if equi==true then if key == "w" then print'1' table.insert(Key,1) end if key == "a" then print'2' table.insert(Key,2) end if key == "s" then print'3' table.insert(Key,3) end if key == "d" then print'4' table.insert(Key,4) end if key == "f" then print'block' block1() end end end function onKeyUp(key) key = key:lower() if equi==true then if isblocking==true then if key == "f" then block2() end end end end function onClicked() if deb==true or equi==false then return end if swing==1 then deb=true Tween(rw,cf(1.5,.5,0)*ca(rad(120),0,rad(40)),.1) Tween(lw,cf(-1.5,.5,0)*ca(rad(20),0,rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2+rad(30),pi/2+rad(50),0),.1) wait(.35) hit(true,hitb,15) so('10209645',pl.Torso,false,1,1) trail(hitb,7,'Royal purple') Tween(rw,cf(1.5,.5,0)*ca(rad(15),0,-rad(30)),.2) Tween(lw,cf(-1.5,.5,0)*ca(-rad(20),0,-rad(20)),.2) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2-rad(10),pi/2+rad(20),0),.2) wait(.25) hit(false) Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) swing=swing+1 deb=false return elseif swing==2 then deb=true Tween(rw,cf(1.5,.5,0)*ca(rad(120),0,-rad(40)),.1) Tween(lw,cf(-1.5,.5,0)*ca(rad(20),0,rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2+rad(30),pi/2-rad(50),0),.1) wait(.35) hit(true,hitb,15) so('10209645',pl.Torso,false,.9,1) trail(hitb,7,'Royal purple') Tween(rw,cf(1.5,.5,0)*ca(rad(15),0,rad(30)),.2) Tween(lw,cf(-1.5,.5,0)*ca(-rad(20),0,-rad(20)),.2) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2-rad(10),pi/2-rad(20),0),.2) wait(.25) hit(false) Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) swing=swing+1 deb=false return elseif swing==3 then deb=true Tween(rw,cf(1,.5,0)*ca(rad(100),0,-rad(40)),.1) Tween(lw,cf(-1,.5,0)*ca(rad(100),0,rad(40)),.1) Tween(mwl,cf(0,-1,-1.25)*ca(-pi/2-rad(10),pi/2-rad(30),0),.1) wait(.35) hit(true,hitb,20) gradient(hitb,BrickColor.new('Royal purple').Color,10,1,0.05) Spawn(function() for i=1,5 do wait(0.05) local efx= Part(1,1,1,'Black',.5,false,true,mo) local m= Mesh(efx,'http://www.roblox.com/asset/?id=51177741',1,1,1) efx.CFrame=hitb.CFrame*ca(0,-pi/2,0) Spawn(function() for i=1,7 do wait() m.Scale=m.Scale+Vector3.new(.1,.1,.1) end efx:Destroy() end) end end) mgblock(hitb,cf(0,0,0),10,'Really black','Royal purple',Vector3.new(1,1,1),0) so('10209645',pl.Torso,false,.6,1) so('63719813',pl.Torso,false,.525,1) trail(hitb,7,'Royal purple') Tween(rw,cf(1,.5,0)*ca(rad(20),0,-rad(40)),.2) Tween(lw,cf(-1,.5,0)*ca(rad(20),0,rad(40)),.2) wait(.25) hit(false) Tween(rw,cf(1.5,.5,0)*ca(rad(10),rad(30),0),.1) Tween(lw,cf(-1.5,.5,0)*ca(0,0,-rad(20)),.1) Tween(mwl,cf(0,-1,-0.5)*ca(-pi/2,pi/2,0),.1) wait(.35) swing=1 deb=false return end end mouse.Button1Down:connect(function() onClicked(mouse) end) mouse.KeyDown:connect(onKeyDown) mouse.KeyUp:connect(onKeyUp) Spawn(function() while wait(0) do checkbind() if equi==true then if cleanup > 0 then cleanup=cleanup-1 if cleanup==0 then print'clean up' Key={} cleanup=sec*10 Spawn(function() wait() print'GO' end) end end end end end)
--- -- \file test/t_csv_parse.lua -- \brief Test for the CSV/TSV parser local Test = require't.Test' local Csv = require't.Csv' local verifyCsv = function( csv, source, result ) for row,n in csv:rows( Csv.split( source, "\n" ) ) do for i,v in pairs( result ) do assert( result[n][i] == row[i], ("For key <%s> expected <%s> but got <%s>"):format(i, result[n][i], row[i]) ) end end end return { Basic = function( self ) Test.describe("Basic straight forward CSV parsing") local csv = Csv({headers=true}) local src = [[ a,b,c 1,2,3]] local res = { { "1","2","3", a="1", b="2", c="3" } } verifyCsv( csv, src, res ) end, BasicCrlf = function( self ) Test.describe("Basic straight forward CSV parsing with CRLF LineBreaks") local csv = Csv({headers=true}) local src = "a,b,c\r\n" .. "1,2,3\r\n" local res = { { "1","2","3", a="1", b="2", c="3" } } verifyCsv( csv, src, res ) end, EmptyStrings = function( self ) Test.describe("Parsing empty strings enclosed in quotes") local csv = Csv({headers=true}) local src = [[ a,b,c 1,"","" 2,3,4]] local res = { { "1","","", a="1", b="", c="" }, { "2","3","4", a="2", b="3", c="4" }, } verifyCsv( csv, src, res ) end, EmptyStringsCrlf = function( self ) Test.describe("Parsing empty strings enclosed in quotes and CRLF line breaks") local csv = Csv({headers=true}) local src = "a,b,c\r\n" .. '1,"",""\r\n' .. "2,3,4\r\n" local res = { { "1","","", a="1", b="", c="" }, { "2","3","4", a="2", b="3", c="4" }, } verifyCsv( csv, src, res ) end, CommaInQuotes = function( self ) Test.describe("Parsing for Commas (Separators) within Quotes") local csv = Csv({headers=true}) local src = [[ first,last,address,city,zip John,Doe,120 any st.,"Anytown, WW",08123 ]] local res = { { "John", "Doe","120 any st.","Anytown, WW","08123", first = "John", last = "Doe", address = "120 any st.", city = "Anytown, WW", zip = "08123" } } verifyCsv( csv, src, res ) end, EscapedQuotes = function( self ) Test.describe("Parsing for escaped quotes within Quotes") local csv = Csv({headers=true}) local src = [[ a,b 1,"ha ""ha"" ha" 3,4 ]] local res = { {"1",'ha "ha" ha', a="1",b='ha "ha" ha'}, {"3", "4", a="3", b="4"} } verifyCsv( csv, src, res ) end, Utf8 = function( self ) Test.describe("Parsing UTF8 encoded content") local csv = Csv({headers=true}) local src = [[ a,b,c 1,2,3 4,5,ʤ ]] local res = { { "1","2","3", a="1", b="2", c="3" }, { "4","5","ʤ", a="4", b="5", c="ʤ" } } verifyCsv( csv, src, res ) end, QuotesAndNewlines = function( self ) Test.describe("Parsing escaped quotes and enclosed newlines") local csv = Csv({headers=true}) local src = [[ a,b 1,"ha ""ha"" ha" 3,4 ]] local res = { { "1", 'ha \n"ha" \nha', a="1", b='ha \n"ha" \nha'}, {"3", "4", a="3", b="4"} } verifyCsv( csv, src, res ) end, NewlinesInQuotes = function( self ) Test.describe("Parsing newlines enclosed in quotes") local csv = Csv({headers=true}) local src = [[ a,b,c 1,2,3 "Once upon a time",5,6 7,8,9 ]] local res = { { "1","2","3", a="1", b="2", c="3" }, { "Once upon \na time", "5","6", a="Once upon \na time", b="5", c="6" }, { "7","8","9", a="7", b="8", c="9" } } verifyCsv( csv, src, res ) end, QuotesAndNewlinesCrlf = function( self ) Test.describe("Parsing escaped quotes and enclosed newlines with CRLF linebreaks") local csv = Csv({headers=true}) local src = 'a,b,c\r\n'.. '1,2,3\r\n' .. '"Once upon \r\n' .. 'a ""time"" \r\n' .. 'in ""space""?",5,6\r\n' .. '7,8,9\r\n' local res = { { "1","2","3", a="1", b="2", c="3" }, { 'Once upon \r\na "time" \r\nin "space"?',"5","6", a='Once upon \r\na "time" \r\nin "space"?', b="5", c="6" }, { "7","8","9", a="7", b="8", c="9" } } verifyCsv( csv, src, res ) end, DoublequoteInsanity = function( self ) Test.describe("Parsing multiple escaped quotes right close to each other") local csv = Csv({headers=true}) local src = [[ a,b,c ,"foo", """""x""" ]] local res = { { nil,"foo",'""x"', a=nil, b="foo", c='""x"' }, } verifyCsv( csv, src, res ) end, DoublequoteNewlineInsanity = function( self ) Test.describe("Parsing multiple escaped quotes right close to each other with enclosed newlines") local csv = Csv({headers=true}) local src = [[ a,b,c,d ,"foo", """ ""x"""" ",bar ]] local res = { { nil,"foo",'""x""\n', "bar", a=nil, b="foo", c='""x""\n', d="bar" }, } verifyCsv( csv, src, res ) end, EmptyStringsAndNilValues = function( self ) Test.describe("Parsing distinguishes between empty string and empty fields") local csv = Csv({headers=true}) local src = [[ a,b,c,d 1,,"",4 ]] local res = { { "1", nil, "", "4",a="1", b=nil, c="", d="4"} } verifyCsv( csv, src, res ) end, LeadingSeparatorAsNil = function( self ) Test.describe("Parsing line starting with separator as NULL(nil) field") local csv = Csv({headers=true}) local src = [[ a,b,c,d ,2,3,4 ]] local res = { { nil, "2", "3", "4",a=nil, b="2", c="3", d="4"} } verifyCsv( csv, src, res ) end, EndingSeparatorAsNil = function( self ) Test.describe("Parsing line ending with separator as NULL(nil) field") local csv = Csv({headers=true}) local src = [[ a,b,c,d 1,2,3, ]] local res = { { "1", "2", "3", nil, a="1", b="2", c="3", d=nil} } verifyCsv( csv, src, res ) end, EndingSeparatorAsNilCrlf = function( self ) Test.describe("Parsing line ending with separator as NULL(nil) field with CRLF linebreaks") local csv = Csv({headers=true}) local src = "a,b,c,d\r\n" .. "1,2,3,\r\n" local res = { { "1", "2", "3", nil, a="1", b="2", c="3", d=nil} } verifyCsv( csv, src, res ) end, EndingEmptyString = function( self ) Test.describe("Parsing line ending with empty string field") local csv = Csv({headers=true}) local src = [[ a,b,c,d 1,2,3,"" ]] local res = { { "1", "2", "3", "", a="1", b="2", c="3", d=""} } verifyCsv( csv, src, res ) end, EndingEmptyStringCrlf = function( self ) Test.describe("Parsing line ending with empty string with CRLF linebreaks") local csv = Csv({headers=true}) local src = 'a,b,c,d\r\n' .. '1,2,3,""\r\n' local res = { { "1", "2", "3", "", a="1", b="2", c="3", d=""} } verifyCsv( csv, src, res ) end, Json = function( self ) Test.describe("Parsing doubleQuoted quotes within an JSON value") local csv = Csv({headers=true}) local src = [==[ id,prop0,prop1,geojson ,value0,,"{""type"": ""Point"", ""coordinates"": [102.0, 0.5]}" ,value0,0.0,"{""type"": ""LineString"", ""coordinates"": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}" ,value0,{u'this': u'that'},"{""type"": ""Polygon"", ""coordinates"": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}" ]==] local res = { { nil, "value0", nil,'{"type": "Point", "coordinates": [102.0, 0.5]}', id=nil,prop0="value0",prop1=nil,geojson='{"type": "Point", "coordinates": [102.0, 0.5]}' }, { nil, "value0", '0.0','{"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}', id=nil,prop0="value0",prop1='0.0',geojson='{"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}' }, { nil, "value0", "{u'this': u'that'}",'{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}', id=nil,prop0="value0",prop1="{u'this': u'that'}",geojson='{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}' } } verifyCsv( csv, src, res ) end, -- ############################### Trimming Excessive whitespaces TrailingWhitespace = function( self ) Test.describe("Parsing removes WhiteSPace after value and before delimiter") local csv = Csv({headers=true}) local src = [[ a,b,c 1 ,2 ,3 ]] local res = { { "1","2","3", a="1", b="2", c="3" }, } verifyCsv( csv, src, res ) end, TrimPreceedingWhitespace = function( self ) Test.describe("Parsing removes WhiteSpace after delimiter and before value") local csv = Csv({headers=true}) local src = [[ a,b,c 1 ,2, 3 ]] local res = { { "1","2","3", a="1", b="2", c="3" }, } verifyCsv( csv, src, res ) end, TrimSurroundingWhitespace = function( self ) Test.describe("Parsing removes WhiteSpace after delimiter and before value") local csv = Csv({headers=true}) local src = [[ a,b,c 1 , 2, 3 ]] local res = { { "1","2","3", a="1", b="2", c="3" }, } verifyCsv( csv, src, res ) end, TrimPreceedingWhitespaceQuoted = function( self ) Test.describe("Parsing removes WhiteSPace after quoted value and before delimiter") local csv = Csv({headers=true}) local src = [[ a,b,c " 1 "," 2", "3 " ]] local res = { { " 1 "," 2","3 ", a=" 1 ", b=" 2", c="3 " }, } verifyCsv( csv, src, res ) end, TrimTrailingWhitespaceQuoted = function( self ) Test.describe("Parsing removes WhiteSpace after delimiter and before quoted value") local csv = Csv({headers=true}) local src = [[ a,b,c " 1 " ," 2","3 " ]] local res = { { " 1 "," 2","3 ", a=" 1 ", b=" 2", c="3 " }, } verifyCsv( csv, src, res ) end, TrimSurroundingWhitespaceQuoted = function( self ) Test.describe("Parsing removes WhiteSpace after and before quoted values") local csv = Csv({headers=true}) local src = [[ a,b,c " 1 ", " 2" ,"3 " ]] local res = { { " 1 "," 2","3 ", a=" 1 ", b=" 2", c="3 " }, } verifyCsv( csv, src, res ) end, -- #################################### Parameters to csv constructor SkipParameterEatsLines = function( self ) Test.describe("Skip Parameter actually skipping lines") local csv = Csv({headers=false, skip=3}) local src = [[ // these lines // here should // be removed 1,foo,bar 2,foo,bar 3,foo,bar ]] local res = { { "1", "foo", "bar" }, { "2", "foo", "bar" }, { "3", "foo", "bar" }, } verifyCsv( csv, src, res ) end, }
local blips = { -- Example {title="", colour=, id=, x=, y=, z=}, -- Apartments -- {title="Apartment", colour=0, id=40, x=-911.91, y=-451.08, z=39.61}, {title="Apartment", colour=0, id=40, x=-268.911, y=-956.445, z=31.223}, {title="Apartment", colour=0, id=40, x=-47.49, y=-585.85, z=37.95}, {title="Apartment", colour=0, id=40, x=-911.91, y=-451.08, z=39.61}, {title="Apartment", colour=0, id=40, x=-933.50, y=-384.39, z=38.96}, {title="Apartment", colour=0, id=40, x=-1447.31, y=-537.77, z=34.74}, {title="Apartment", colour=0, id=40, x=-617.75, y=44.39, z=43.59}, {title="Apartment", colour=0, id=40, x=-773.88, y=311.73, z=85.70}, {title="Apartment", colour=0, id=40, x=-468.84, y=-678.36, z=32.72}, {title="Apartment", colour=0, id=40, x=-810.06, y=-978.83, z=14.22}, {title="Apartment", colour=0, id=40, x=292.25, y=-162.46, z=64.62}, -- Houses -- {title="House", colour=0, id=40, x=-169.286, y=486.4938, z=137.4436}, {title="House", colour=0, id=40, x=340.9412, y=437.1798, z=149.3925}, {title="House", colour=0, id=40, x=373.023, y=416.105, z=145.7006}, {title="House", colour=0, id=40, x=-676.127, y=588.612, z=145.1698}, {title="House", colour=0, id=40, x=-763.107, y=615.906, z=144.1401}, {title="House", colour=0, id=40, x=-857.798, y=682.563, z=152.6529}, {title="House", colour=0, id=40, x=120.500, y=549.952, z=184.097}, {title="House", colour=0, id=40, x=-1288.000, y=440.748, z=97.69459}, -- Offices -- {title="Office", colour=0, id=475, x=-68.342, y=-799.828, z=44.227}, {title="Office", colour=0, id=475, x=-115.121, y=-605.403, z=36.281}, {title="Office", colour=0, id=475, x=-1371.115, y=-503.707, z=33.157}, {title="Office", colour=0, id=475, x=-1581.242, y=-558.449, z=34.953}, -- Businesses -- {title="Cocaine Lockup", colour=0, id=497, x=51.92, y=6486.31, z=31.43}, {title="Counterfeit Cash Factory", colour=0, id=500, x=-1166.843, y=-1386.159, z=4.971}, {title="Document Forgery Office", colour=0, id=498, x=1644.294, y=4857.999, z=41.011}, {title="Meth Lab", colour=0, id=499, x=1181.816, y=-3113.832, z=6.028}, {title="Weed Farm", colour=0, id=496, x=102.446, y=176.030, z=104.716}, -- Facility -- {title="Facility", colour=0, id=590, x=1.79, y=6832.14, z=15.82}, -- Bunker -- {title="Bunker", colour=0, id=557, x=1571.97, y=2234.43, z=79.06}, -- Garages -- {title="Garage", colour=0, id=357, x=507.87, y=-1496.00, z=29.20}, {title="Garage", colour=0, id=357, x=639.16, y=2774.31, z=41.90}, -- Hangar -- {title="Hangar", colour=0, id=569, x=-1139.08, y=-3387.34, z=13.94}, -- Vehicle Warehouse -- {title="Vehicle Warehouse", colour=0, id=524, x=-668.50, y=-2385.95, z=13.93}, -- Crate Warehouses -- {title="Crate Warehouse", colour=0, id=473, x=926.66, y=-1560.23, z=30.74}, {title="Crate Warehouse", colour=0, id=473, x=-324.90, y=-1356.23, z=31.30}, {title="Crate Warehouse", colour=0, id=473, x=274.54, y=-3015.40, z=5.70}, -- Clubhouses -- {title="Clubhouse", colour=0, id=492, x=973.487, y=-101.972, z=74.850}, {title="Clubhouse", colour=0, id=492, x=-38.47, y=6419.88, z=31.49}, {title="Clubhouse", colour=0, id=492, x=1737.78, y=3709.592, z=34.14}, -- Nightclub -- {title="Nightclub", colour=0, id=614, x=346.02, y=-977.81, z=29.37}, -- Aircraft Carrier -- {title="Aircraft Carrier", colour=0, id=16, x=3082.31, y=-4717.11, z=15.26}, -- Yacht -- {title="Yacht", colour=0, id=455, x=-2043.97, y=-1031.58, z=11.98}, {title="Yacht", colour=0, id=455, x=-1363.72, y=6734.10, z=2.44} } Citizen.CreateThread(function() for _, info in pairs(blips) do info.blip = AddBlipForCoord(info.x, info.y, info.z) SetBlipSprite(info.blip, info.id) SetBlipDisplay(info.blip, 4) SetBlipScale(info.blip, 0.9) SetBlipColour(info.blip, info.colour) SetBlipAsShortRange(info.blip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString(info.title) EndTextCommandSetBlipName(info.blip) end end)
function love.load() --default style for the big button joystick = uare.new({ x = WWIDTH*.5-25, y = WHEIGHT*.8-25, width = 50, height = 50, --color color = {200/COLOR_SCALE, 200/COLOR_SCALE, 200/COLOR_SCALE}, hoverColor = {150/COLOR_SCALE, 150/COLOR_SCALE, 150/COLOR_SCALE}, holdColor = {100/COLOR_SCALE, 100/COLOR_SCALE, 100/COLOR_SCALE}, --border border = { color = {255/COLOR_SCALE, 255/COLOR_SCALE, 255/COLOR_SCALE}, hoverColor = {200/COLOR_SCALE, 200/COLOR_SCALE, 200/COLOR_SCALE}, holdColor = {150/COLOR_SCALE, 150/COLOR_SCALE, 150/COLOR_SCALE}, size = 5 }, drag = { enabled = true, bounds = { { x = WWIDTH*.5-50, y = WHEIGHT*.8-50 }, { x = WWIDTH*.5, y = WHEIGHT*.8 } } } }) sliderBackground = uare.new({ x = WWIDTH*.8, y = WHEIGHT*.8, width = 100, height = 40, color = {100/COLOR_SCALE, 100/COLOR_SCALE, 100/COLOR_SCALE}, center = true, text = { font = love.graphics.newFont(24), color = {255/COLOR_SCALE, 255/COLOR_SCALE, 255/COLOR_SCALE}, align = "center", offset = { x = 0, y = 32 } } }) speedSlider = uare.new({ x = WWIDTH*.8, y = WHEIGHT*.8, height = 50, width = 30, color = {255/COLOR_SCALE, 255/COLOR_SCALE, 255/COLOR_SCALE}, hoverColor = {200/COLOR_SCALE, 200/COLOR_SCALE, 200/COLOR_SCALE}, center = true, --makes positioning easier! drag = { enabled = true, fixed = { x = false, --move only on the X axis y = true }, bounds = { { x = WWIDTH*.8-50 }, { x = WWIDTH*.8+50 } } } }) player = {x = WWIDTH*.5, y = WHEIGHT*.5} end function love.update(dt) local mx, my = love.mouse.getX(), love.mouse.getY() uare.update(dt, mx, my) if not joystick.hold then joystick.x, joystick.y = WWIDTH*.5-25, WHEIGHT*.8-25 --we released the joystick end local velocity = {x = (joystick:getHorizontalRange()-.5)*2, y = (joystick:getVerticalRange()-.5)*2} velocity.magnitude = math.sqrt(velocity.x^2 + velocity.y^2) if velocity.magnitude > 1 then --requires a *bit* of tweaking to get a nice joystick feel, else it acts as a normal square mx, my = mx+joystick.width*.5+uare.holdt.d.x, my+joystick.height*.5+uare.holdt.d.y --take difference between mouse and center of joystick in account local angle = math.atan2(my-WHEIGHT*.8, mx-WWIDTH*.5) --get the current angle of center<->mouse... joystick.x = WWIDTH*.5-25+math.cos(angle)*25 joystick.y = WHEIGHT*.8-25+math.sin(angle)*25 --and wrap it in an invisible 25px circle velocity.x, velocity.y = math.cos(angle), math.sin(angle) --then, recalculate the velocity according to that angle end --are you still alive? player.speed = speedSlider:getHorizontalRange()*1000 sliderBackground.text.display = "speed: "..player.speed player.x, player.y = player.x+player.speed*velocity.x*dt, player.y+player.speed*velocity.y*dt if player.x < 20 then player.x = 20 elseif player.x > WWIDTH-20 then player.x = WWIDTH-20 end if player.y < 20 then player.y = 20 elseif player.y > WHEIGHT*.7-20 then player.y = WHEIGHT*.7-20 end end function love.draw() love.graphics.setColor(100/COLOR_SCALE, 100/COLOR_SCALE, 100/COLOR_SCALE) love.graphics.circle("fill", WWIDTH*.5, WHEIGHT*.8, 50) uare.draw() love.graphics.setColor(255/COLOR_SCALE, 255/COLOR_SCALE, 255/COLOR_SCALE) love.graphics.circle("fill", player.x, player.y, 20) end
if IsValid(TESTP) then TESTP:Remove() end local frame = vgui.Create( "DFrame" ) frame:SetSize(400,400) frame:SetTitle("Test panel") frame:Center() frame:MakePopup() local lbl = vgui.Create( "DLabelURL", frame ) lbl:SetPos(50, 50) lbl:SetSize(100, 50) //lbl:SetColor(Color(255,255,255,255)) lbl:SetTextStyleColor(Color(100,255,255,255)) lbl:SetText("I Love Gmod") lbl:SetURL("http://wiki.garrysmod.com/") TESTP=frame TESTL=lbl
require 'torch' require 'image' local mnist = require('mnist') local M = {} local Mnist = torch.class('Mnist', M) function Mnist:__init(path) self.train = mnist.traindataset() -- Convert the data to float and convert it to 0-1 range self.train.data = self.train.data:float():div(255) self.test = mnist.testdataset() -- Convert the data to float and convert it to 0-1 range self.test.data = self.test.data:float():div(255) local train_mean = {} local train_std = {} train_mean[1] = torch.mean(self.train.data) train_std[1] = torch.std(self.train.data) self.train_mean = train_mean self.train_std = train_std end function Mnist:preprocess(split) local train = self.train if split == 'train' then return T.applyTransforms( { T.stdNorm(train.mean, train.std), -- T.hFlip(0.5), -- T.randomCrop(32, 4), } ) elseif split == 'test' then return T.applyTransforms( { T.stdNorm(train.mean, train.std) } ) else error('Unknown split: ' .. split) end end function Mnist:sample(idx) return { input = self.train.data:index(1, idx), target = self.train.labels:index(1, idx) } end return M.Mnist
Config = {} Config.Locale = 'en' Config.targets = { {-2131.82,3263.31,32.81,310.0}, {-2136.57,3256.79,32.81,310.0}, {-2139.88,3249.41,32.81,310.0}, {-2136.08,3265.76,32.81,310.0}, {-2140.64,3259.21,32.81,310.0}, {-2143.91,3251.82,32.81,310.0}, {-2139.15,3267.49,32.81,310.0}, {-2143.09,3260.49,32.81,310.0}, {-2148.03,3254.13,32.81,310.0}, }
--[[ Checks if job is in a given list. Input: KEYS[1] ARGV[1] Output: 1 if element found in the list. ]] local function item_in_list (list, item) for _, v in pairs(list) do if v == item then return 1 end end return nil end local items = redis.call("LRANGE", KEYS[1] , 0, -1) return item_in_list(items, ARGV[1])
--[[ FiveM Scripts Copyright C 2018 Sighmir This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or at your option any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ]] Config = {} -- 'bone' use bonetag https://pastebin.com/D7JMnX1g -- x,y,z are offsets Config.RealWeapons = { {name = 'WEAPON_KNIFE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_w_me_knife_01'}, {name = 'WEAPON_NIGHTSTICK', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'w_me_nightstick'}, {name = 'WEAPON_HAMMER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_tool_hammer'}, {name = 'WEAPON_BAT', bone = 24818, x = 0.0, y = 0.0, z = 0.0, xRot = 320.0, yRot = 320.0, zRot = 320.0, category = 'melee', model = 'w_me_bat'}, {name = 'WEAPON_GOLFCLUB', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'w_me_gclub'}, {name = 'WEAPON_CROWBAR', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'w_me_crowbar'}, {name = 'WEAPON_BOTTLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_w_me_bottle'}, {name = 'WEAPON_KNUCKLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_w_me_dagger'}, {name = 'WEAPON_HATCHET', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'w_me_hatchet'}, {name = 'WEAPON_MACHETE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_ld_w_me_machette'}, {name = 'WEAPON_SWITCHBLADE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_w_me_dagger'}, {name = 'WEAPON_FLASHLIGHT', bone = 24818, x = 0.0, y = 0.0, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'melee', model = 'prop_w_me_dagger'}, {name = 'WEAPON_PISTOL', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_pistol'}, {name = 'WEAPON_COMBATPISTOL', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_combatpistol'}, {name = 'WEAPON_APPISTOL', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_appistol'}, {name = 'WEAPON_PISTOL50', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_pistol50'}, {name = 'WEAPON_VINTAGEPISTOL', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_vintage_pistol'}, {name = 'WEAPON_HEAVYPISTOL', bone = 51826, x = -0.01, y = 0.10, z = 0.07, xRot = -115.0, yRot = 0.0, zRot = 0.0, category = 'handguns', model = 'w_pi_heavypistol'}, {name = 'WEAPON_SNSPISTOL', bone = 58271, x = -0.01, y = 0.1, z = -0.07, xRot = -55.0, yRot = 0.10, zRot = 0.0, category = 'handguns', model = 'w_pi_sns_pistol'}, {name = 'WEAPON_FLAREGUN', bone = 58271, x = -0.01, y = 0.1, z = -0.07, xRot = -55.0, yRot = 0.10, zRot = 0.0, category = 'handguns', model = 'w_pi_flaregun'}, {name = 'WEAPON_MARKSMANPISTOL', bone = 58271, x = -0.01, y = 0.1, z = -0.07, xRot = -55.0, yRot = 0.10, zRot = 0.0, category = 'handguns', model = ''}, {name = 'WEAPON_REVOLVER', bone = 58271, x = -0.01, y = 0.1, z = -0.07, xRot = -55.0, yRot = 0.10, zRot = 0.0, category = 'handguns', model = ''}, {name = 'WEAPON_STUNGUN', bone = 58271, x = -0.01, y = 0.1, z = -0.07, xRot = -55.0, yRot = 0.10, zRot = 0.0, category = 'handguns', model = 'w_pi_stungun'}, {name = 'WEAPON_MICROSMG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_sb_microsmg'}, {name = 'WEAPON_SMG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_sb_smg'}, {name = 'WEAPON_MG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_mg_mg'}, {name = 'WEAPON_COMBATMG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_mg_combatmg'}, {name = 'WEAPON_GUSENBERG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_sb_gusenberg'}, {name = 'WEAPON_COMBATPDW', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = ''}, {name = 'WEAPON_MACHINEPISTOL', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = ''}, {name = 'WEAPON_ASSAULTSMG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = 'w_sb_assaultsmg'}, {name = 'WEAPON_MINISMG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'machine', model = ''}, {name = 'WEAPON_ASSAULTRIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = 'w_ar_assaultrifle'}, {name = 'WEAPON_CARBINERIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = 'w_ar_carbinerifle'}, {name = 'WEAPON_ADVANCEDRIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = 'w_ar_advancedrifle'}, {name = 'WEAPON_SPECIALCARBINE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = 'w_ar_specialcarbine'}, {name = 'WEAPON_BULLPUPRIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = 'w_ar_bullpuprifle'}, {name = 'WEAPON_COMPACTRIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'assault', model = ''}, {name = 'WEAPON_PUMPSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 135.0, zRot = 0.0, category = 'shotgun', model = 'w_sg_pumpshotgun'}, {name = 'WEAPON_SAWNOFFSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'shotgun', model = ''}, {name = 'WEAPON_BULLPUPSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 135.0, zRot = 0.0, category = 'shotgun', model = 'w_sg_bullpupshotgun'}, {name = 'WEAPON_ASSAULTSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'shotgun', model = 'w_sg_assaultshotgun'}, {name = 'WEAPON_MUSKET', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'shotgun', model = 'w_ar_musket'}, {name = 'WEAPON_HEAVYSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 225.0, zRot = 0.0, category = 'shotgun', model = 'w_sg_heavyshotgun'}, {name = 'WEAPON_DBSHOTGUN', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'shotgun', model = ''}, {name = 'WEAPON_AUTOSHOTGUN', bone = 24818, x = 0.1, y = 0.15, z = 0.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'shotgun', model = ''}, {name = 'WEAPON_SNIPERRIFLE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'sniper', model = 'w_sr_sniperrifle'}, {name = 'WEAPON_HEAVYSNIPER', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 135.0, zRot = 0.0, category = 'sniper', model = 'w_sr_heavysniper'}, {name = 'WEAPON_MARKSMANRIFLE', bone = 24818, x = 0.1, y = -0.15, z = 0.0, xRot = 0.0, yRot = 135.0, zRot = 0.0, category = 'sniper', model = 'w_sr_marksmanrifle'}, {name = 'WEAPON_REMOTESNIPER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'none', model = ''}, {name = 'WEAPON_STINGER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'none', model = ''}, {name = 'WEAPON_GRENADELAUNCHER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_lr_grenadelauncher'}, {name = 'WEAPON_RPG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_lr_rpg'}, {name = 'WEAPON_MINIGUN', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_mg_minigun'}, {name = 'WEAPON_FIREWORK', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_lr_firework'}, {name = 'WEAPON_RAILGUN', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_ar_railgun'}, {name = 'WEAPON_HOMINGLAUNCHER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = 'w_lr_homing'}, {name = 'WEAPON_COMPACTLAUNCHER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'heavy', model = ''}, {name = 'WEAPON_STICKYBOMB', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'prop_bomb_01_s'}, {name = 'WEAPON_MOLOTOV', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_ex_molotov'}, {name = 'WEAPON_FIREEXTINGUISHER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_am_fire_exting'}, {name = 'WEAPON_PETROLCAN', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_am_jerrycan'}, {name = 'WEAPON_PROXMINE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = ''}, {name = 'WEAPON_SNOWBALL', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_ex_snowball'}, {name = 'WEAPON_BALL', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_am_baseball'}, {name = 'WEAPON_GRENADE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_ex_grenadefrag'}, {name = 'WEAPON_SMOKEGRENADE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_ex_grenadesmoke'}, {name = 'WEAPON_BZGAS', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'thrown', model = 'w_ex_grenadesmoke'}, {name = 'WEAPON_DIGISCANNER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'w_am_digiscanner'}, {name = 'WEAPON_DAGGER', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'prop_w_me_dagger'}, {name = 'WEAPON_GARBAGEBAG', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = ''}, {name = 'WEAPON_HANDCUFFS', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = ''}, {name = 'WEAPON_BATTLEAXE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'prop_tool_fireaxe'}, {name = 'WEAPON_PIPEBOMB', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = ''}, {name = 'WEAPON_POOLCUE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'prop_pool_cue'}, {name = 'WEAPON_WRENCH', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'w_me_hammer'}, {name = 'GADGET_NIGHTVISION', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = ''}, {name = 'GADGET_PARACHUTE', bone = 24818, x = 65536.0, y = 65536.0, z = 65536.0, xRot = 0.0, yRot = 0.0, zRot = 0.0, category = 'others', model = 'p_parachute_s'} }
local ITEM = Clockwork.item:New("weapon_base"); ITEM.name = "M249 Para"; ITEM.cost = 0; ITEM.model = "models/weapons/3_mach_m249para.mdl"; ITEM.weight = 7; ITEM.uniqueID = "bb_m249_alt"; ITEM.business = false; ITEM.description = "A heavy weapon. Why do they call these things LIGHT machine guns!!?"; ITEM.isAttachment = true; ITEM.loweredOrigin = Vector(3, 0, -4); ITEM.loweredAngles = Angle(0, 45, 0); ITEM.attachmentBone = "ValveBiped.Bip01_Spine"; ITEM.attachmentOffsetAngles = Angle(0, 0, 0); ITEM.attachmentOffsetVector = Vector(-4, 4, 4); ITEM:Register();
TOOL.Category = "Wire Extras/Other" TOOL.Name = "#Directional Radio Tool" TOOL.Command = nil TOOL.ConfigName = "" TOOL.ClientConVar[ "model" ] = "models/radio/ra_small_omni.mdl" --TOOL.ClientConVar[ "tx" ] = 0 TOOL.ClientConVar[ "freeze" ] = 1 if CLIENT then language.Add("tool.wdrk.name", "Wire Directional Radio Kit") language.Add("tool.wdrk.desc", "Spawn Directional Radio Antennae") language.Add("tool.wdrk.0", "Left-click: Spawn a Wire Directional Radio Antenna") language.Add("Undone_wdrk", "Undone Wire Directional Radio Antenna") language.Add("Cleanup_wdrk", "Wire Directional Radio Antennae") language.Add("Cleaned_wdrk", "Removed all Wire Directional Radio Antennae") language.Add("sboxlimit_wdrk", "Wire Directional Radio Antennae limit already reached!") end if SERVER then CreateConVar("sbox_maxwdrk", 10) function MakeRadioPart(ply, Ang, Pos, model, trace, freeze) if not ply:CheckLimit("wdrk") then return false end local tmpitem = model:gsub("models/radio/", "") local itemclass = tmpitem:gsub(".mdl", "") local ent = ents.Create(itemclass) --ent.is_tx = tx ent:SetPos(Pos) ent:SetAngles(Ang) ent:Spawn() ent:Setup() ent:Activate() if freeze then local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) ply:AddFrozenPhysicsObject(ent, phys) end end ply:AddCount("wdrk", ent) return ent end --duplicator.RegisterEntityClass("base_wdr_entity", MakeRadioPart, "Ang", "Pos", "model", "trace", "freeze") -->>>>>>>>>>>> THIS IS USELESS AND DOESNT WORK... WHY GARRY WHYYYYY end cleanup.Register("wdrk") function TOOL:LeftClick(trace) if CLIENT then return true end if trace.Entity && trace.Entity:IsPlayer() then return false end local ply = self:GetOwner() local model = self:GetClientInfo("model") --local tx = self:GetClientNumber("tx") ~= 0 local freeze = self:GetClientNumber("freeze") ~= 0 if trace.Entity:IsValid() && string.find(trace.Entity:GetClass(), "^ra_") && trace.Entity.pl == ply then return true end if not self:GetSWEP():CheckLimit("wdrk") then return false end if not util.IsValidModel(model) then return false end local Ang = trace.HitNormal:Angle() Ang.pitch = Ang.pitch + 90 local radio_item = MakeRadioPart(ply, Ang, trace.HitPos, model, trace, freeze) local min = radio_item:OBBMins() radio_item:SetPos(trace.HitPos - trace.HitNormal * min.z) undo.Create("wdrk") undo.AddEntity(radio_item) undo.SetPlayer(ply) undo.Finish() ply:AddCleanup("wdrk", radio_item) return true end function TOOL:UpdateGhostRadioParts(ent, player) local m = self:GetClientInfo("model") if (not self.GhostEntity || not self.GhostEntity:IsValid() || self.GhostEntity:GetModel() != m) then self:MakeGhostEntity(m, Vector(0,0,0), Angle(0,0,0)) end if not ent then return end if not IsValid(ent) then return end local tr = util.GetPlayerTrace(player, player:GetAimVector()) local trace = util.TraceLine(tr) if not trace.Hit then return end local cls = trace.Entity:GetClass() if trace.Entity and string.find(trace.Entity:GetClass(), "^ra_") or trace.Entity:IsPlayer() then ent:SetNoDraw(true) return end local Ang = trace.HitNormal:Angle() Ang.pitch = Ang.pitch + 90 local min = ent:OBBMins() ent:SetPos(trace.HitPos - trace.HitNormal * min.z) ent:SetAngles(Ang) ent:SetNoDraw(false) end function TOOL:Think() self:UpdateGhostRadioParts(self.GhostEntity, self:GetOwner()) end if SERVER then return end function TOOL.BuildCPanel(panel) local helpText panel:SetHeight( 600 ) panel:SetName( "#tool.wdrk.name" ) panel:Help("#tool.wdrk.desc") panel:CheckBox("Freeze on spawn?","wdrk_freeze") local Scroll = vgui.Create( "DScrollPanel", panel ) -- Create the Scroll panel Scroll:Dock( FILL ) local List = vgui.Create( "DIconLayout", Scroll ) List:Dock( FILL ) List:SetSpaceY( 5 ) -- Sets the space in between the panels on the Y Axis by 5 List:SetSpaceX( 5 ) -- Sets the space in between the panels on the X Axis by 5 local Models = { "models/radio/ra_domestic_dish.mdl", "models/radio/ra_large_drum.mdl", "models/radio/ra_large_omni.mdl", "models/radio/ra_log.mdl", "models/radio/ra_orbital_dish.mdl", "models/radio/ra_panel.mdl", "models/radio/ra_sector.mdl", "models/radio/ra_small_drum.mdl", "models/radio/ra_small_omni.mdl", "models/radio/ra_uplink_dish.mdl" } for _, v in pairs( Models ) do local SpawnI = vgui.Create( "SpawnIcon" , List ) -- SpawnIcon SpawnI:SetModel( v ) -- Model we want for this spawn icon SpawnI:SetSize( 80, 80 ) -- Set the size of it function SpawnI:DoClick() RunConsoleCommand("wdrk_model",v) local tmpitem = v:gsub("models/radio/", "") local itemclass = tmpitem:gsub(".mdl", "") local ent = scripted_ents.Get(itemclass) if ent == nil then return end local polarity = "Both" if ent.pol == 1 then polarity = "Vertical" elseif ent.pol == 2 then polarity = "Horizontal" end helpText:SetText(ent.PrintName .. "\n" .. "Gain: " .. ent.gain .. " dB" .. "\n" .. "Beam Width: " .. ent.beamWidth .. "°" .. "\n" .. "Polarization: " .. polarity) end end helpText = panel:Help("") -- Make it, but don't show anything end
local IItemPotion = require("mod.elona.api.aspect.IItemPotion") local IItemDippable = require("mod.elona.api.aspect.IItemDippable") local IItemWell = require("mod.elona.api.aspect.IItemWell") local Gui = require("api.Gui") local ItemPotionAspect = class.class("ItemPotionAspect", { IItemPotion, IItemDippable }) function ItemPotionAspect:init(item, params) self.effects = params.effects or {} end function ItemPotionAspect:can_dip_into(item, target_item) return target_item:get_aspect(IItemWell) end function ItemPotionAspect:can_draw_from_well(item, well) return item._id == "elona.empty_bottle" end function ItemPotionAspect:on_dip_into(item, params) -- >>>>>>>> shade2/action.hsp:1609 if iType(ciDip)=fltPotion:if iTypeMinor(ci)=fltWe ... local target_item = params.target_item local well = target_item:get_aspect(IItemWell) if well then Gui.play_sound("base.drink1", params.chara.x, params.chara.y) target_item = target_item:separate() item:remove(1) if self:can_draw_from_well(item, target_item) then return well:draw_water_from(target_item, item, params) else return well:pour_water_into(target_item, item, params) end end return "turn_end" -- <<<<<<<< shade2/action.hsp:1635 } .. end return ItemPotionAspect
-- キャラクターに付いていくカメラ -- -- <操作> -- 方向キー:キャラクターモデル移動 -- Z,Cキー:カメラの水平角度を変更 -- S,Xキー:カメラの垂直角度を変更 -- 移動速度 local MOVESPEED = 10.0 -- DxChara.x での走りアニメーションの番号 local ANIM_RUN = 1 -- DxChara.x での待機アニメーションの番号 local ANIM_NEUTRAL = 4 -- カメラの回転速度 local CAMERA_ANGLE_SPEED = 3.0 -- カメラの注視点の高さ local CAMERA_LOOK_AT_HEIGHT = 400.0 -- カメラと注視点の距離 local CAMERA_LOOK_AT_DISTANCE = 2150.0 -- ラインを描く範囲 local LINE_AREA_SIZE = 10000.0 -- ラインの数 local LINE_NUM = 50 local ModelHandle local AnimTotalTime local AnimNowTime local AnimAttachIndex local RunFlag local MoveAnimFrameIndex local Position local MoveFlag local Angle local CameraHAngle local CameraVAngle local MoveVector local SinParam local CosParam -- DXライブラリの初期化 function dx.Init() -- 3Dモデルの読み込み ModelHandle = dx.MV1LoadModel("DxChara.x") -- カメラの向きを初期化 CameraHAngle = 0.0 CameraVAngle = 40.0 -- 向きを初期化 Angle = 0.0 -- 走っているフラグを倒す RunFlag = false -- 待機アニメーションをアタッチ AnimAttachIndex = dx.MV1AttachAnim(ModelHandle, ANIM_NEUTRAL) -- 待機アニメーションの総時間を取得しておく AnimTotalTime = dx.MV1GetAttachAnimTotalTime(ModelHandle, AnimAttachIndex) -- アニメーション再生時間を初期化 AnimNowTime = 0.0 dx.MV1SetAttachAnimTime(ModelHandle, AnimAttachIndex, AnimNowTime) -- アニメーションで移動をしているフレームの番号を検索する MoveAnimFrameIndex = dx.MV1SearchFrame(ModelHandle, "BasePoint") -- アニメーションで移動をしているフレームを無効にする dx.MV1SetFrameUserLocalMatrix(ModelHandle, MoveAnimFrameIndex, dx.MV1GetFrameLocalMatrix(ModelHandle, MoveAnimFrameIndex)) -- 3Dモデルの座標を初期化 Position = dx.VGet(0.0, 0.0, 0.0) -- 描画先を裏画面にする dx.SetDrawScreen(dx.DX_SCREEN_BACK) -- カメラのクリッピング距離を設定 dx.SetCameraNearFar(100.0, 50000.0) -- 背景の色を灰色にする dx.SetBackgroundColor(128, 128, 128) end -- メインループ(何かキーが押されたらループを抜ける) function dx.Update() -- 画面のクリア dx.ClearDrawScreen() -- ZCSXキーでカメラの操作 if dx.CheckHitKey(dx.KEY_INPUT_C) == 1 then CameraHAngle = CameraHAngle + CAMERA_ANGLE_SPEED if CameraHAngle >= 180.0 then CameraHAngle = CameraHAngle - 360.0 end end if dx.CheckHitKey(dx.KEY_INPUT_Z) == 1 then CameraHAngle = CameraHAngle - CAMERA_ANGLE_SPEED if CameraHAngle <= -180.0 then CameraHAngle = CameraHAngle + 360.0 end end if dx.CheckHitKey(dx.KEY_INPUT_S) == 1 then CameraVAngle = CameraVAngle + CAMERA_ANGLE_SPEED if CameraVAngle >= 80.0 then CameraVAngle = 80.0 end end if dx.CheckHitKey(dx.KEY_INPUT_X) == 1 then CameraVAngle = CameraVAngle - CAMERA_ANGLE_SPEED if CameraVAngle <= 0.0 then CameraVAngle = 0.0 end end -- 移動ベクトルを初期化 MoveVector = dx.VGet(0.0, 0.0, 0.0) -- 移動しているかどうかのフラグを倒す MoveFlag = false -- 方向入力に従ってキャラクターの移動ベクトルと向きを設定 if dx.CheckHitKey(dx.KEY_INPUT_LEFT) == 1 then Angle = 90.0 - CameraHAngle MoveFlag = true MoveVector.x = -MOVESPEED end if dx.CheckHitKey(dx.KEY_INPUT_RIGHT) == 1 then Angle = -90.0 - CameraHAngle MoveFlag = true MoveVector.x = MOVESPEED end if dx.CheckHitKey(dx.KEY_INPUT_DOWN) == 1 then Angle = 0.0 - CameraHAngle MoveFlag = true MoveVector.z = -MOVESPEED end if dx.CheckHitKey(dx.KEY_INPUT_UP) == 1 then Angle = 180.0 - CameraHAngle MoveFlag = true MoveVector.z = MOVESPEED end -- 移動した場合は、カメラの水平角度を考慮した方向に座標を移動する if MoveFlag == true then TempMoveVector = TempMoveVector or dx.VECTOR() -- カメラの角度に合わせて移動ベクトルを回転してから加算 SinParam = math.sin(CameraHAngle / 180.0 * dx.DX_PI_F) CosParam = math.cos(CameraHAngle / 180.0 * dx.DX_PI_F) TempMoveVector.x = MoveVector.x * CosParam - MoveVector.z * SinParam TempMoveVector.y = 0.0 TempMoveVector.z = MoveVector.x * SinParam + MoveVector.z * CosParam Position = dx.VAdd(Position, TempMoveVector) end -- 今までと状態が変化した場合はアニメーションを変更する if RunFlag ~= MoveFlag then -- 走っているかどうかのフラグを保存 RunFlag = MoveFlag -- 今までアタッチしていたアニメーションをデタッチ dx.MV1DetachAnim(ModelHandle, AnimAttachIndex) -- 新しいアニメーションをアタッチ if RunFlag then AnimAttachIndex = dx.MV1AttachAnim(ModelHandle, ANIM_RUN) else AnimAttachIndex = dx.MV1AttachAnim(ModelHandle, ANIM_NEUTRAL) end -- アニメーションの総時間を取得しておく AnimTotalTime = dx.MV1GetAttachAnimTotalTime(ModelHandle, AnimAttachIndex) -- アニメーション再生時間を初期化 AnimNowTime = 0.0 else -- アニメーション再生時間を進める AnimNowTime = AnimNowTime + 200.0 -- アニメーション再生時間がアニメーションの総時間を越えていたらループさせる if AnimNowTime >= AnimTotalTime then -- 新しいアニメーション再生時間は、アニメーション再生時間からアニメーション総時間を引いたもの AnimNowTime = AnimNowTime - AnimTotalTime end end -- 新しいアニメーション再生時間をセット dx.MV1SetAttachAnimTime(ModelHandle, AnimAttachIndex, AnimNowTime) -- 新しい向きをセット dx.MV1SetRotationXYZ(ModelHandle, dx.VGet(0.0, Angle / 180.0 * dx.DX_PI_F, 0.0)) -- 3Dモデルに新しい座標をセット dx.MV1SetPosition(ModelHandle, Position) -- カメラの位置と向きを設定 do TempPosition1 = TempPosition1 or dx.VECTOR() TempPosition2 = TempPosition2 or dx.VECTOR() local CameraPosition local CameraLookAtPosition -- 注視点はキャラクターモデルの座標から CAMERA_LOOK_AT_HEIGHT 分だけ高い位置 CameraLookAtPosition = dx.VECTOR(Position) CameraLookAtPosition.y = CameraLookAtPosition.y + CAMERA_LOOK_AT_HEIGHT -- カメラの位置はカメラの水平角度と垂直角度から算出 -- 最初に垂直角度を反映した位置を算出 SinParam = math.sin(CameraVAngle / 180.0 * dx.DX_PI_F) CosParam = math.cos(CameraVAngle / 180.0 * dx.DX_PI_F) TempPosition1.x = 0.0 TempPosition1.y = SinParam * CAMERA_LOOK_AT_DISTANCE TempPosition1.z = -CosParam * CAMERA_LOOK_AT_DISTANCE -- 次に水平角度を反映した位置を算出 SinParam = math.sin(CameraHAngle / 180.0 * dx.DX_PI_F) CosParam = math.cos(CameraHAngle / 180.0 * dx.DX_PI_F) TempPosition2.x = CosParam * TempPosition1.x - SinParam * TempPosition1.z TempPosition2.y = TempPosition1.y TempPosition2.z = SinParam * TempPosition1.x + CosParam * TempPosition1.z -- 算出した座標に注視点の位置を加算したものがカメラの位置 CameraPosition = dx.VAdd(TempPosition2, CameraLookAtPosition) -- カメラの設定に反映する dx.SetCameraPositionAndTarget_UpVecY(CameraPosition, CameraLookAtPosition) end -- 3Dモデルの描画 dx.MV1DrawModel(ModelHandle) -- 位置関係が分かるように地面にラインを描画する do local Pos1 local Pos2 dx.SetUseZBufferFlag(true) Pos1 = dx.VGet(-LINE_AREA_SIZE / 2.0, 0.0, -LINE_AREA_SIZE / 2.0) Pos2 = dx.VGet(-LINE_AREA_SIZE / 2.0, 0.0, LINE_AREA_SIZE / 2.0) for i = 1, LINE_NUM + 1 do dx.DrawLine3D(Pos1, Pos2, dx.GetColor(255, 255, 255)) Pos1.x = Pos1.x + (LINE_AREA_SIZE / LINE_NUM) Pos2.x = Pos2.x + (LINE_AREA_SIZE / LINE_NUM) end Pos1 = dx.VGet(-LINE_AREA_SIZE / 2.0, 0.0, -LINE_AREA_SIZE / 2.0) Pos2 = dx.VGet(LINE_AREA_SIZE / 2.0, 0.0, -LINE_AREA_SIZE / 2.0) for i = 1, LINE_NUM do dx.DrawLine3D(Pos1, Pos2, dx.GetColor(255, 255, 255)) Pos1.z = Pos1.z + (LINE_AREA_SIZE / LINE_NUM) Pos2.z = Pos2.z + (LINE_AREA_SIZE / LINE_NUM) end dx.SetUseZBufferFlag(false) end -- 裏画面の内容を表画面に反映 dx.ScreenFlip() end
local class = require 'lib.middleclass' local Light = require 'source.entities.light' local Entity = require 'source.entities.entity' local Lamp = class ("Lamp", Entity) local img = love.graphics.newImage("assets/sprites/lamp.png") local w = 13 local h = 25 local delay = 0.2 function Lamp:initialize(map, world, x, y) Entity.initialize(self, map, world, x, y, w, h, true) self.map = map self.x = x self.y = y self.properties ={passable = true} self.light = Light:new(self.map, self.x, self.y, 'circle', 0.7, 0.7, "normal") self.counter = delay end function Lamp:update(dt) if math.sqrt ( (self.map.player.x - self.x)^2 + (self.map.player.y - self.y)^2 ) < 64 and not self.map.player.possess then self.counter = self.counter - dt else self.counter = delay end if self.counter < 0 then -- self.map.player:die() end end function Lamp:draw(debug) end return Lamp
vim.g.go_gopls_enabled = 0 vim.g.go_def_mapping_enabled = 0
_G.C_ChatInfo = {} _G.C_ChatInfo.RegisterAddonMessagePrefix = function() end _G.C_ChatInfo.SendAddonMessage = function() end
--MAXIME local gui, grid, col, col2 = {}, {}, {}, {} local screenWidth, screenHeight = guiGetScreenSize() local defaultStations, donorStations = {}, {} local stationToRenew = nil function openRadioManager(defaultStations1, donorStations1) if true then--canAccessManager() then local perk = true closeNewStation() showCursor(true) guiSetInputEnabled(true) if defaultStations1 and type(defaultStations1) == "table" then defaultStations, donorStations = defaultStations1, donorStations1 end if gui.main and isElement(gui.main) then guiSetText(gui.main, "Radio Station Manager v2.1") guiSetEnabled(gui.main, true) else setElementData(localPlayer, "gui:ViewingRadioManager", true, true) local w, h = 800,474 local x, y = (screenWidth-w)/2, (screenHeight-h)/2 gui.main = guiCreateWindow(x,y,w,h,"Radyo İstasyon Yönetimi",false) guiWindowSetSizable(gui.main, false) gui.tabpanel = guiCreateTabPanel(0.0122,0.0401,0.9757,0.87,true,gui.main) gui.defaultStations = guiCreateTab("Server's default stations",gui.tabpanel) gui.donorStations = guiCreateTab("Donor's stations",gui.tabpanel) grid.defaultStations = guiCreateGridList(0,0,1,1,true,gui.defaultStations) col.id = guiGridListAddColumn(grid.defaultStations,"ID",0.05) col.name = guiGridListAddColumn(grid.defaultStations,"Station Name",0.18) col.ip = guiGridListAddColumn(grid.defaultStations,"Station IP",0.3) col.status = guiGridListAddColumn(grid.defaultStations,"Status",0.1) col.owner = guiGridListAddColumn(grid.defaultStations,"Station Owner",0.1) col.expireDate = guiGridListAddColumn(grid.defaultStations,"Expire Date",0.16) col.order = guiGridListAddColumn(grid.defaultStations,"Order",0.08) grid.donorStations = guiCreateGridList(0,0,1,1,true,gui.donorStations) col2.id = guiGridListAddColumn(grid.donorStations,"ID",0.05) col2.name = guiGridListAddColumn(grid.donorStations,"Station Name",0.18) col2.ip = guiGridListAddColumn(grid.donorStations,"Station IP",0.3) col2.status = guiGridListAddColumn(grid.donorStations,"Status",0.1) col2.owner = guiGridListAddColumn(grid.donorStations,"Station Owner",0.1) col2.expireDate = guiGridListAddColumn(grid.donorStations,"Expire Date",0.16) col2.order = guiGridListAddColumn(grid.donorStations,"Order",0.08) gui.addNew = guiCreateButton(0.0135,0.9135,0.32476,0.0675,"Create new station",true,gui.main) guiSetFont(gui.addNew, "default-bold-small") addEventHandler("onClientGUIClick", gui.addNew, function() if source == gui.addNew then openNewStation() end end) gui.buyNew = guiCreateButton(0.0135,0.9135,0.32476,0.0675,"Purchase a new station",true,gui.main) guiSetFont(gui.buyNew, "default-bold-small") addEventHandler("onClientGUIClick", gui.buyNew, function() if source == gui.buyNew then openNewStation(nil, nil, nil, nil, nil, true) end end) guiSetVisible(gui.buyNew, false) gui.renew = guiCreateButton(0.0135,0.9135,0.32476,0.0675,"Renew station",true,gui.main) guiSetFont(gui.renew, "default-bold-small") addEventHandler("onClientGUIClick", gui.renew, function() if source == gui.renew and stationToRenew and type(stationToRenew) == "table" then renewStation(stationToRenew) else exports.mrp_global:playSoundError() end end) guiSetVisible(gui.renew, false) gui.refresh = guiCreateButton(0.0135+0.32476,0.9135,0.32476,0.0675,"Sync stations to all clients",true,gui.main) guiSetFont(gui.refresh, "default-bold-small") local timer1 = nil addEventHandler("onClientGUIClick", gui.refresh, function() if source == gui.refresh then guiSetEnabled(gui.refresh, false) exports.mrp_global:playSoundCreate() if isTimer(timer1) then killTimer(timer1) end timer1 = setTimer(function() if gui.refresh and isElement(gui.refresh) then guiSetEnabled(gui.refresh, true) end end, 5000, 1) triggerServerEvent("forceSyncStationsToAllclients", localPlayer) end end) gui.bClose = guiCreateButton(0.0135+0.32476*2,0.9135,0.32476,0.0675,"Close",true,gui.main) guiSetFont(gui.bClose, "default-bold-small") addEventHandler("onClientGUIClick", gui.bClose, function() if source == gui.bClose then closeRadioManager() end end) addEventHandler("onClientGUITabSwitched", root, tabSwitch) triggerServerEvent("openRadioManager", localPlayer) guiSetEnabled(gui.main, false) end updateDefaultStations() updateDonorStations() end end addEvent("openRadioManager", true) addEventHandler("openRadioManager", root, openRadioManager) addCommandHandler("radios", openRadioManager) function closeRadioManager() if gui.main and isElement(gui.main) then setElementData(localPlayer, "gui:ViewingRadioManager", false, true) removeEventHandler("onClientGUITabSwitched", root, tabSwitch) closeNewStation() destroyElement(gui.main) guiSetInputEnabled(false) showCursor(false) gui.main = nil end end function tabSwitch(theTab) if theTab == gui.defaultStations then outputDebugString("defaultStations") guiSetVisible(gui.addNew, true) guiSetVisible(gui.buyNew, false) updateBottomBtns() guiSetVisible(gui.renew, false) elseif theTab == gui.donorStations then outputDebugString("donorStations") guiSetVisible(gui.addNew, false) guiSetVisible(gui.buyNew, true) if ownedAnyStation() then guiSetEnabled(gui.refresh, true) else guiSetEnabled(gui.refresh, false) end end end function ownedAnyStation() local username = getElementData(localPlayer, "account:username") for i, k in pairs(donorStations) do --outputChatBox(tostring(k["owner"])) --outputChatBox(tostring(username)) if k["owner"] == username then return true end end return false end function togRadioManager(state) if gui.main and isElement(gui.main) then guiSetEnabled(gui.main, state) end end function updateDefaultStations() guiGridListClear(grid.defaultStations) local maxRow = #defaultStations for i = 1, maxRow do local row = guiGridListAddRow(grid.defaultStations) guiGridListSetItemText(grid.defaultStations, row, col.id, defaultStations[i]["id"] , false, true) guiGridListSetItemText(grid.defaultStations, row, col.name, defaultStations[i]["station_name"] , false, false) guiGridListSetItemText(grid.defaultStations, row, col.ip, defaultStations[i]["source"] , false, false) guiGridListSetItemText(grid.defaultStations, row, col.status, (defaultStations[i]["enabled"] == "1" and "Activated" or "Deactivated"), false, false) guiGridListSetItemText(grid.defaultStations, row, col.owner, defaultStations[i]["owner"] or "No-one" , false, false) guiGridListSetItemText(grid.defaultStations, row, col.expireDate, defaultStations[i]["expire_date"] or "Never" , false, false) guiGridListSetItemText(grid.defaultStations, row, col.order, defaultStations[i]["order"] or "--" , false, true) end addEventHandler( "onClientGUIDoubleClick", grid.defaultStations, function( button ) if button == "left" then local row, col = -1, -1 local row, col = guiGridListGetSelectedItem(grid.defaultStations) if row ~= -1 and col ~= -1 then if exports.mrp_integration:isPlayerLeadAdmin(localPlayer) then local id = guiGridListGetItemText( grid.defaultStations , row, 1 ) local name = guiGridListGetItemText( grid.defaultStations , row, 2 ) local ip = guiGridListGetItemText( grid.defaultStations , row, 3 ) local state = guiGridListGetItemText( grid.defaultStations , row, 4 ) local order = guiGridListGetItemText( grid.defaultStations , row, 7 ) openNewStation(id, name, ip, state, order) else exports.mrp_global:playSoundError() end end end end, false) updateBottomBtns() end function updateDonorStations() guiGridListClear(grid.donorStations) local maxRow = #donorStations for i = 1, maxRow do local row = guiGridListAddRow(grid.donorStations) guiGridListSetItemText(grid.donorStations, row, col2.id, donorStations[i]["id"] , false, true) guiGridListSetItemText(grid.donorStations, row, col2.name, donorStations[i]["station_name"] , false, false) guiGridListSetItemText(grid.donorStations, row, col2.ip, donorStations[i]["source"] , false, false) guiGridListSetItemText(grid.donorStations, row, col2.status, (donorStations[i]["enabled"] == "1" and "Activated" or "Deactivated"), false, false) guiGridListSetItemText(grid.donorStations, row, col2.owner, donorStations[i]["owner"] or "No-one" , false, false) guiGridListSetItemText(grid.donorStations, row, col2.expireDate, donorStations[i]["expire_date"] or "Never" , false, false) guiGridListSetItemText(grid.donorStations, row, col2.order, donorStations[i]["order"] or "--" , false, true) end addEventHandler( "onClientGUIDoubleClick", grid.donorStations, function( button ) if button == "left" then local row, col = -1, -1 local row, col = guiGridListGetSelectedItem(grid.donorStations) if row ~= -1 and col ~= -1 then local username = getElementData(localPlayer, "account:username") local owner = guiGridListGetItemText( grid.donorStations , row, 5 ) if owner == username or exports.mrp_integration:isPlayerLeadAdmin(localPlayer) then local id = guiGridListGetItemText( grid.donorStations , row, 1 ) local name = guiGridListGetItemText( grid.donorStations , row, 2 ) local ip = guiGridListGetItemText( grid.donorStations , row, 3 ) local state = guiGridListGetItemText( grid.donorStations , row, 4 ) local order = guiGridListGetItemText( grid.donorStations , row, 7 ) openNewStation(id, name, ip, state, order, true) else exports.mrp_global:playSoundError() end end end end, false) addEventHandler( "onClientGUIClick", grid.donorStations, function( button ) if button == "left" then local row, col = -1, -1 local row, col = guiGridListGetSelectedItem(grid.donorStations) if row ~= -1 and col ~= -1 then local username = getElementData(localPlayer, "account:username") local owner = guiGridListGetItemText( grid.donorStations , row, 5 ) if owner == username then --or exports.integration:isPlayerLeadAdmin(localPlayer) then local id = guiGridListGetItemText( grid.donorStations , row, 1 ) local name = guiGridListGetItemText( grid.donorStations , row, 2 ) local ip = guiGridListGetItemText( grid.donorStations , row, 3 ) local owner = guiGridListGetItemText( grid.donorStations , row, 5 ) local ex = guiGridListGetItemText( grid.donorStations , row, 6 ) guiSetVisible(gui.renew, true) guiSetVisible(gui.buyNew, false) stationToRenew = {id, name, ip, owner, ex} else guiSetVisible(gui.renew, false) guiSetVisible(gui.buyNew, true) stationToRenew = nil end end end end, false) end function updateBottomBtns() if exports.mrp_integration:isPlayerLeadAdmin(localPlayer) then guiSetEnabled(gui.addNew, true) guiSetEnabled(gui.refresh, true) else guiSetEnabled(gui.addNew, false) guiSetEnabled(gui.refresh, false) end end function openNewStation(id, name, ip, state, order, buyNew) closeNewStation() togRadioManager(false) exports.mrp_global:playSoundSuccess() local perk = true local w, h = 400, 135 gui.wNewStation = guiCreateWindow(0, 0, w, h, "Yeni Istasyon Ekleme Arayüzü", false) exports.mrp_global:centerWindow(gui.wNewStation) local margin = 10 local lineH = 25 local col1 = 85 gui.l1 = guiCreateLabel(margin, margin, w-margin*2, lineH, "NEW STATION", false, gui.wNewStation) guiSetFont(gui.l1, "default-bold-small") guiLabelSetHorizontalAlign(gui.l1, "center", true) guiLabelSetVerticalAlign(gui.l1, "center", true) gui.l2 = guiCreateLabel(margin, margin+lineH, col1, lineH, "Station Name:", false, gui.wNewStation) guiSetFont(gui.l2, "default-bold-small") guiLabelSetVerticalAlign(gui.l2, "center", true) gui.eName = guiCreateEdit(margin+col1, margin+lineH, w-margin*2-col1, lineH, name and name or "", false, gui.wNewStation) gui.l3 = guiCreateLabel(margin, margin+lineH*2, col1, lineH, "Station IP:", false, gui.wNewStation) guiSetFont(gui.l3, "default-bold-small") guiLabelSetVerticalAlign(gui.l3, "center", true) gui.eIP = guiCreateEdit(margin+col1, margin+lineH*2, w-margin*2-col1, lineH, ip and ip or "", false, gui.wNewStation) local buttons = 5 local buttonW = (w-margin*2)/buttons local moveCost = 0 gui.bMoveUp = guiCreateButton(margin, margin+lineH/2+lineH*3, buttonW , lineH, buyNew and "Move up\n("..moveCost.." GCs)" or "Move up",false,gui.wNewStation) guiSetFont(gui.bMoveUp, buyNew and "default-small" or "default-bold-small") addEventHandler("onClientGUIClick", gui.bMoveUp, function() if source == gui.bMoveUp then triggerServerEvent("moveStationPosition", localPlayer, id, name, order, true, buyNew) exports.mrp_global:playSoundCreate() closeNewStation() end end) gui.bMoveDown = guiCreateButton(margin+buttonW, margin+lineH/2+lineH*3, buttonW , lineH, buyNew and "Move down\n("..moveCost.." GCs)" or "Move down",false,gui.wNewStation) guiSetFont(gui.bMoveDown, buyNew and "default-small" or "default-bold-small") addEventHandler("onClientGUIClick", gui.bMoveDown, function() if source == gui.bMoveDown then triggerServerEvent("moveStationPosition", localPlayer, id, name, order, false, buyNew) exports.mrp_global:playSoundCreate() closeNewStation() end end) gui.bSubmit = guiCreateButton(margin+buttonW*2, margin+lineH/2+lineH*3, buttonW , lineH, "Create",false,gui.wNewStation) guiSetFont(gui.bSubmit, "default-bold-small") addEventHandler("onClientGUIClick", gui.bSubmit, function() if source == gui.bSubmit then local sName = guiGetText(gui.eName) local sIP = guiGetText(gui.eIP) if string.len(sName) < 1 or string.len(sIP) < 1 then exports.mrp_global:playSoundError() else if guiGetText(gui.bSubmit) == "Save" then triggerServerEvent("editStation", localPlayer, id, sName, sIP) exports.mrp_global:playSoundCreate() elseif guiGetText(gui.bSubmit) == "Create" then triggerServerEvent("createNewStation", localPlayer, sName, sIP) exports.mrp_global:playSoundCreate() elseif guiGetText(gui.bSubmit) == "Purchase" then triggerServerEvent("createNewStation", localPlayer, sName, sIP, true) exports.mrp_global:playSoundCreate() else triggerServerEvent("togStation", localPlayer, id, guiGetText(gui.bSubmit)) exports.mrp_global:playSoundCreate() end closeNewStation() end end end) gui.bDelete = guiCreateButton(margin+buttonW*3, margin+lineH/2+lineH*3, buttonW , lineH, "Delete",false,gui.wNewStation) guiSetFont(gui.bDelete, "default-bold-small") addEventHandler("onClientGUIClick", gui.bDelete, function() if source == gui.bDelete then if id then triggerServerEvent("deleteStation", localPlayer, id) exports.mrp_global:playSoundCreate() closeNewStation() else exports.mrp_global:playSoundError() end end end) gui.bClose1 = guiCreateButton(margin+buttonW*4, margin+lineH/2+lineH*3, buttonW , lineH, "Close",false,gui.wNewStation) guiSetFont(gui.bClose1, "default-bold-small") addEventHandler("onClientGUIClick", gui.bClose1, function() if source == gui.bClose1 then closeNewStation() end end) if id then guiSetEnabled(gui.bMoveDown, true) guiSetEnabled(gui.bMoveUp, true) guiSetText(gui.l1, "EDIT STATION #"..id) else guiSetEnabled(gui.bMoveDown, false) guiSetEnabled(gui.bMoveUp, false) guiSetEnabled(gui.bDelete, false) if buyNew then guiSetText(gui.l1, "PURCHASE NEW STATION") else guiSetText(gui.l1, "NEW STATION") end end if state == "Activated" then guiSetText(gui.bSubmit, "Deactivated") elseif state == "Deactivated" then guiSetText(gui.bSubmit, "Activated") else if buyNew then guiSetText(gui.bSubmit, "Purchase") else guiSetText(gui.bSubmit, "Create") end end local changeSubmitBtn = function () if id and (source == gui.eName or source == gui.eIP) then guiSetText(gui.bSubmit, "Save") end end addEventHandler("onClientGUIChanged", gui.eName, changeSubmitBtn) addEventHandler("onClientGUIChanged", gui.eIP, changeSubmitBtn) end function closeNewStation() if gui.wNewStation and isElement(gui.wNewStation) then destroyElement(gui.wNewStation) gui.wNewStation = nil togRadioManager(true) end end function renewStation(station) closeRenewStation() togRadioManager(false) exports.mrp_global:playSoundSuccess() local w, h = 400, 170 gui.wRenewStation = guiCreateWindow(0, 0, w, h, "Istasyon Yenileme Arayüzü", false) exports.mrp_global:centerWindow(gui.wRenewStation) local margin = 20 local lineH = 16 local col1 = w - margin*2 gui.l1 = guiCreateLabel(margin, margin, w-margin*2, lineH, "RENEW STATION", false, gui.wRenewStation) guiSetFont(gui.l1, "default-bold-small") guiLabelSetHorizontalAlign(gui.l1, "center", true) guiLabelSetVerticalAlign(gui.l1, "center", true) gui.l2 = guiCreateLabel(margin, margin+lineH, col1, lineH, "You're about to renew radio station ID#"..station[1]..":", false, gui.wRenewStation) --guiSetFont(gui.l2, "default-bold-small") guiLabelSetVerticalAlign(gui.l2, "center", true) gui.l3 = guiCreateLabel(margin, margin+lineH*2, col1, lineH, "Station Name: "..station[2], false, gui.wRenewStation) guiSetFont(gui.l3, "default-bold-small") guiLabelSetVerticalAlign(gui.l3, "center", true) gui.l4 = guiCreateLabel(margin, margin+lineH*3, col1, lineH, "Streaming URL: "..station[3], false, gui.wRenewStation) guiSetFont(gui.l4, "default-bold-small") guiLabelSetVerticalAlign(gui.l3, "center", true) gui.l5 = guiCreateLabel(margin, margin+lineH*4, col1, lineH, "Owner: "..station[4], false, gui.wRenewStation) guiSetFont(gui.l5, "default-bold-small") guiLabelSetVerticalAlign(gui.l3, "center", true) gui.l6 = guiCreateLabel(margin, margin+lineH*5, col1, lineH, "Expiration Date: "..station[5], false, gui.wRenewStation) guiSetFont(gui.l6, "default-bold-small") guiLabelSetVerticalAlign(gui.l3, "center", true) local buttons = 4 local bH = 30 local buttonW = (w-margin*2)/buttons local perk = true local cost7 = 0 local cost30 = cost7*3 local cost90 = cost7*3*2 gui.b7days = guiCreateButton(margin, margin+lineH/2+lineH*6, buttonW , bH, "7 days\n("..cost7.." GCs)",false,gui.wRenewStation) --guiSetFont(gui.b7days, "default-bold-small") addEventHandler("onClientGUIClick", gui.b7days, function() if source == gui.b7days then triggerServerEvent("renewStation", localPlayer, station, 7) exports.mrp_global:playSoundCreate() closeRenewStation() end end) gui.b30days = guiCreateButton(margin+buttonW, margin+lineH/2+lineH*6, buttonW , bH, "30 days\n("..cost30.." GCs)",false,gui.wRenewStation) --guiSetFont(gui.b30days, "default-bold-small") addEventHandler("onClientGUIClick", gui.b30days, function() if source == gui.b30days then triggerServerEvent("renewStation", localPlayer, station, 30) exports.mrp_global:playSoundCreate() closeRenewStation() end end) gui.b90days = guiCreateButton(margin+buttonW*2, margin+lineH/2+lineH*6, buttonW , bH, "90 days\n("..cost90.." GCs)",false,gui.wRenewStation) --guiSetFont(gui.b90days, "default-bold-small") addEventHandler("onClientGUIClick", gui.b90days, function() if source == gui.b90days then triggerServerEvent("renewStation", localPlayer, station, 90) exports.mrp_global:playSoundCreate() closeRenewStation() end end) gui.bClose1 = guiCreateButton(margin+buttonW*3, margin+lineH/2+lineH*6, buttonW , bH, "Close",false,gui.wRenewStation) --guiSetFont(gui.bClose1, "default-bold-small") addEventHandler("onClientGUIClick", gui.bClose1, function() if source == gui.bClose1 then closeRenewStation() end end) end function closeRenewStation() if gui.wRenewStation and isElement(gui.wRenewStation) then destroyElement(gui.wRenewStation) gui.wRenewStation = nil togRadioManager(true) end end
local K, C = unpack(KkthnxUI) local Module = K:GetModule("Auras") local _G = _G local unpack = _G.unpack local CreateFrame = _G.CreateFrame local GetTotemInfo = _G.GetTotemInfo local totems = {} function Module:TotemBar_Init() local margin = 6 local vertical = C["Auras"].VerticalTotems local iconSize = C["Auras"].TotemSize local width = vertical and (iconSize + margin * 2) or (iconSize * 4 + margin * 5) local height = vertical and (iconSize * 4 + margin * 5) or (iconSize + margin * 2) local totemBar = _G["KKUI_TotemBar"] if not totemBar then totemBar = CreateFrame("Frame", "KKUI_TotemBar", K.PetBattleHider) end totemBar:SetSize(width, height) if not totemBar.mover then totemBar.mover = K.Mover(totemBar, "Totembar", "Totems", { "BOTTOMRIGHT", UIParent, "BOTTOM", -450, 20 }) end totemBar.mover:SetSize(width, height) for i = 1, 4 do local totem = totems[i] if not totem then totem = CreateFrame("Frame", nil, totemBar) totem.CD = CreateFrame("Cooldown", nil, totem, "CooldownFrameTemplate") totem.CD:SetPoint("TOPLEFT", totem, "TOPLEFT", 1, -1) totem.CD:SetPoint("BOTTOMRIGHT", totem, "BOTTOMRIGHT", -1, 1) totem.CD:SetReverse(true) totem.Icon = totem:CreateTexture(nil, "ARTWORK") totem.Icon:SetAllPoints() totem.Icon:SetTexCoord(unpack(K.TexCoords)) totem:CreateBorder() totem:SetAlpha(0) totems[i] = totem local blizzTotem = _G["TotemFrameTotem" .. i] blizzTotem:SetParent(totem) blizzTotem:SetAllPoints() blizzTotem:SetAlpha(0) totem.__owner = blizzTotem end totem:SetSize(iconSize, iconSize) totem:ClearAllPoints() if i == 1 then totem:SetPoint("BOTTOMLEFT", margin, margin) elseif vertical then totem:SetPoint("BOTTOM", totems[i - 1], "TOP", 0, margin) else totem:SetPoint("LEFT", totems[i - 1], "RIGHT", margin, 0) end end end function Module:TotemBar_Update() for i = 1, 4 do local totem = totems[i] local defaultTotem = totem.__owner local slot = defaultTotem.slot local haveTotem, _, start, dur, icon = GetTotemInfo(slot) if haveTotem and dur > 0 then totem.Icon:SetTexture(icon) totem.CD:SetCooldown(start, dur) totem.CD:Show() totem:SetAlpha(1) else totem.Icon:SetTexture("") totem.CD:Hide() totem:SetAlpha(0) end end end function Module:CreateTotems() if not C["Auras"].Totems then return end Module:TotemBar_Init() K:RegisterEvent("PLAYER_ENTERING_WORLD", Module.TotemBar_Update) K:RegisterEvent("PLAYER_TOTEM_UPDATE", Module.TotemBar_Update) end
local sprinklers = require("sprinklers") local headers = require("headers") local module = {} function module.process(c, request) print("Processing requests ...") local _, _, method, req, major, minor = string.find(request, "([A-Z]+) (.+) HTTP/(%d).(%d)") headers.buildHeader(c, 200, "json", false, false) return executeCommand(req) end function executeCommand(req) if(string.find(req,"/sprinkler/start/1")) then sprinklers.startSprinkler(1) end if(string.find(req,"/sprinkler/start/2")) then sprinklers.startSprinkler(2) end if(string.find(req,"/sprinkler/stop/1")) then sprinklers.stopSprinkler(1) end if(string.find(req,"/sprinkler/stop/2")) then sprinklers.stopSprinkler(2) end return sprinklers.status() end return module
dependency 'channelfeed' client_script 'obituary.lua' export 'printObituary' files 'obituary.css'
--[[ --=====================================================================================================-- Script Name: Advanced Server Logging, for SAPP (PC & CE) This script will log: * Join & Quit events * Game Start Events * Game End Events * Script Load & Script Unload Events * Global Chat * Team Chat * Vehicle Chat * Chat Commands (w/password filtering) * Rcon/Console Commands (w/password filtering) > Chat Logs will be simultaneously saved to date.FullLog.txt and date.Chat.txt > Command Logs will be simultaneously saved to date.FullLog.txt and date.Commands.txt > This script will also censor passwords in command logs. Copyright (c) 2019, Jericho Crosby <jericho.crosby227@gmail.com> * Notice: You can use this document subject to the following conditions: https://github.com/Chalwk77/Halo-Scripts-Phasor-V2-/blob/master/LICENSE * Written by Jericho Crosby (Chalwk) --=====================================================================================================-- ]]-- api_version = "1.12.0.0" -- Configuration Starts -- local full_log_path = "sapp\\%date%.FullLog.txt" --[[ These variables in can be used in on_join/on_quit & on_command/on_chat messages: %name% = player name %id% = player id %ip% = player ip %hash% = player hash %level% = player admin level %state% = admin status (true/false) %message% = (Chat/Command output) %total% = Total number of players currently online. ]] local on_join = "[JOIN] Name: %name% ID: [%id%] IP: [%ip%] CD-Key Hash: [%hash%] Total Players: [%total%/16]" local on_quit = "[QUIT] Name: %name% ID: [%id%] IP: [%ip%] CD-Key Hash: [%hash%] Total Players: [%total%/16]" local on_load = "[SCRIPT LOAD] Advanced Logger was loaded" local on_reload = "[SERVER] SAPP Was Reloaded" local on_unload = "[SCRIPT UNLOAD] Advanced Logger was unloaded" local on_game_end = "[GAME END] The Game has ended (post game carnage report showing)" local on_game_start = "[GAME START] A new game has started on [%map% | mode: %mode%]" local chat_logs_path = "sapp\\%date%.Chat.txt" local on_chat = { [0] = "[GLOBAL] %name% ID: [%id%] IP: [%ip%]: %message%", [1] = "[TEAM] %name% ID: [%id%] IP: [%ip%]: %message%", [2] = "[VEHICLE] %name% ID: [%id%] IP: [%ip%]: %message%", [3] = "[UNKNOWN] %name% ID: [%id%] IP: [%ip%]: %message%", } local command_logs_path = "sapp\\%date%.Commands.txt" local on_command = { [0] = "[CONSOLE COMMAND] [Admin = %state% | Level: %level%] %name% ID: [%id%] IP: [%ip%]: %message%", [1] = "[RCON COMMAND] [Admin = %state% | Level: %level%] %name% ID: [%id%] IP: [%ip%]: %message%", [2] = "[CHAT COMMAND] [Admin = %state% | Level: %level%] %name% ID: [%id%] IP: [%ip%]: /%message%", [3] = "[CENSORED] %message%" -- message will be replaced with "censor_character" } -- Any command containing these words will be censored: local censored_content = { censor_character = "*****", "login", "admin_add", "change_password", "admin_change_pw", "admin_add_manually", } -- If true, player info will be printed to the server console when someone joins/quits: local print_player_info = true local player_info = { "Player: %name%", "CD Hash: %hash%", "IP Address: %ip%", "Index ID: %id%", "Privilege Level: %level%", } -- Configuration Ends -- local players = {} local gsub, gmatch, sub = string.gsub, string.gmatch, string.sub local lower, find = string.lower, string.find function OnScriptLoad() register_callback(cb["EVENT_JOIN"], "OnPlayerConnect") register_callback(cb["EVENT_LEAVE"], "OnPlayerDisconnect") register_callback(cb["EVENT_CHAT"], "OnServerChat") register_callback(cb["EVENT_COMMAND"], "OnServerCommand") register_callback(cb["EVENT_GAME_START"], "OnGameStart") register_callback(cb["EVENT_GAME_END"], "OnGameEnd") register_callback(cb['EVENT_PREJOIN'], "OnPlayerPrejoin") if (get_var(0, "$gt") ~= "n/a") then players = { } SaveClientData(0) for i = 1, 16 do if player_present(i) then SaveClientData(i) end end Write(on_reload, full_log_path) else Write(on_load, full_log_path) end end function OnGameStart() if (get_var(0, "$gt") ~= "n/a") then local map = get_var(0, "$map") local mode = get_var(0, "$mode") local log = gsub(gsub(on_game_start, "%%map%%", map), "%%mode%%", mode) Write(log, full_log_path) Write(log, chat_logs_path) Write(log, command_logs_path) SaveClientData(0) end end function OnGameEnd() local map = get_var(0, "$map") local mode = get_var(0, "$mode") local log = gsub(gsub(on_game_end, "%%map%%", map), "%%mode%%", mode) Write(log, full_log_path) Write(log, chat_logs_path) Write(log, command_logs_path) end function OnServerChat(PlayerIndex, Message, type) if (type ~= 6) then local msg = TextSplit(Message) if (#msg == 0 or msg == nil) then return elseif not isCommand(msg) then local t = players[PlayerIndex] if (t) then local log = on_chat[type] if (log) then t["%%message%%"], t["%%total%%"] = Message, get_var(0, "$pn") for k, v in pairs(t) do log = gsub(log, k, v) end cprint(log, 11) Write(log, full_log_path) Write(log, chat_logs_path) t["%%message%%"] = "" end end end end end function OnServerCommand(PlayerIndex, Command, Environment, Password) local cmd = TextSplit(Command) if (#cmd == 0 or cmd == nil) then return else local t = players[PlayerIndex] if (t) then t["%%message%%"], t["%%total%%"] = Command, get_var(0, "$pn") local content = CensoredContent(Command) if (content ~= nil) then t["%%message%%"] = content Environment = 3 end local log = on_command[Environment] if (log) then for k, v in pairs(t) do log = gsub(log, k, v) end cprint(log, 11) Write(log, full_log_path) Write(log, command_logs_path) end t["%%message%%"] = "" end end end function OnPlayerPrejoin(PlayerIndex) SaveClientData(PlayerIndex) if (print_player_info) then cprint("________________________________________________________________________________", 10) cprint("Player attempting to connect to the server...", 13) local t = players[PlayerIndex] if (t) then t = t.all_info for i = 1, #t do cprint(t[i], 10) end end end end local function QuitJoin(PlayerIndex, Type) local log = "" local t = players[PlayerIndex] if (t) then local time_stamp = os.date("%A %d %B %Y - %X") if (Type == 1) then log = on_join if (print_player_info) then cprint("Join Time: " .. time_stamp, 10) cprint("Status: " .. t["%%name%%"] .. " connected successfully.", 13) cprint("________________________________________________________________________________", 10) end elseif (Type == 2) then if (print_player_info) then cprint("________________________________________________________________________________", 12) t["%%total%%"] = get_var(0, "$pn") - 1 local tab = t.all_info for i = 1, #tab do cprint(tab[i], 12) end cprint("Quit Time: " .. time_stamp, 12) cprint("________________________________________________________________________________", 12) end log = on_quit players[PlayerIndex] = nil end for k, v in pairs(t) do log = gsub(log, k, v) end Write(log, full_log_path) end end function OnPlayerConnect(PlayerIndex) QuitJoin(PlayerIndex, 1) end function OnPlayerDisconnect(PlayerIndex) QuitJoin(PlayerIndex, 2) end function SaveClientData(PlayerIndex) local p = tonumber(PlayerIndex) local level = tonumber(get_var(p, "$lvl")) local state = tostring((level >= 1)) local name = get_var(p, "$name") local ip = get_var(p, "$ip") local hash = get_var(p, "$hash") if (p == 0) then name = "SERVER" ip = "N/A" hash = "N/A" state = "true" end players[p] = { ["%%id%%"] = p, ["%%name%%"] = name, ["%%ip%%"] = ip, ["%%hash%%"] = hash, ["%%level%%"] = level, ["%%message%%"] = "", ["%%state%%"] = state, ["%%total%%"] = get_var(0, "$pn") } if (print_player_info) then local t = {} for i = 1, #player_info do t[#t + 1] = player_info[i] end for k, v in pairs(players[p]) do for i = 1, #t do t[i] = gsub(t[i], k, v) end end players[p].all_info = t end end function Write(Content, Path) local Date = os.date("[%d/%m/%Y]"):gsub('[:/]','-') local path = gsub(Path, "%%date%%",Date) local file = io.open(path, "a+") if (file) then local timestamp = os.date("[%d/%m/%Y - %H:%M:%S]") file:write(timestamp .. " " .. Content .. "\n") end file:close() end function TextSplit(Message) local args, index = {}, 1 for Params in gmatch(Message, "([^%s]+)") do args[index] = Params index = index + 1 end return args end function isCommand(table) if (sub(table[1], 1, 1) == "/" or sub(table[1], 1, 1) == "\\") then return true end end function CensoredContent(Message) local words = censored_content for i = 1, #words do local word = words[i] if find(Message:lower(), word) then return words.censor_character end end return nil end function OnScriptUnload() Write(on_unload, full_log_path) end
#!/usr/bin/lua local irc = require "irc" local dcc = require "irc.dcc" irc.DEBUG = true local ip_prog = io.popen("get_ip") local ip = ip_prog:read() ip_prog:close() irc.set_ip(ip) local function print_state() for chan in irc.channels() do print(chan..": Channel ops: "..table.concat(chan:ops(), " ")) print(chan..": Channel voices: "..table.concat(chan:voices(), " ")) print(chan..": Channel normal users: "..table.concat(chan:users(), " ")) print(chan..": All channel members: "..table.concat(chan:members(), " ")) end end local function on_connect() print("Joining channel #doytest...") irc.join("#doytest") print("Joining channel #doytest2...") irc.join("#doytest2") end irc.register_callback("connect", on_connect) local function on_me_join(chan) print("Join to " .. chan .. " complete.") print(chan .. ": Channel type: " .. chan.chanmode) if chan.topic.text and chan.topic.text ~= "" then print(chan .. ": Channel topic: " .. chan.topic.text) print(" Set by " .. chan.topic.user .. " at " .. os.date("%c", chan.topic.time)) end irc.act(chan.name, "is here") print_state() end irc.register_callback("me_join", on_me_join) local function on_join(chan, user) print("I saw a join to " .. chan) if tostring(user) ~= "doylua" then irc.say(tostring(chan), "Hi, " .. user) end print_state() end irc.register_callback("join", on_join) local function on_part(chan, user, part_msg) print("I saw a part from " .. chan .. " saying " .. part_msg) print_state() end irc.register_callback("part", on_part) local function on_nick_change(new_nick, old_nick) print("I saw a nick change: " .. old_nick .. " -> " .. new_nick) print_state() end irc.register_callback("nick_change", on_nick_change) local function on_kick(chan, user) print("I saw a kick in " .. chan) print_state() end irc.register_callback("kick", on_kick) local function on_quit(chan, user) print("I saw a quit from " .. chan) print_state() end irc.register_callback("quit", on_quit) local function whois_cb(cb_data) print("WHOIS data for " .. cb_data.nick) if cb_data.user then print("Username: " .. cb_data.user) end if cb_data.host then print("Host: " .. cb_data.host) end if cb_data.realname then print("Realname: " .. cb_data.realname) end if cb_data.server then print("Server: " .. cb_data.server) end if cb_data.serverinfo then print("Serverinfo: " .. cb_data.serverinfo) end if cb_data.away_msg then print("Awaymsg: " .. cb_data.away_msg) end if cb_data.is_oper then print(nick .. "is an IRCop") end if cb_data.idle_time then print("Idletime: " .. cb_data.idle_time) end if cb_data.channels then print("Channel list for " .. cb_data.nick .. ":") for _, channel in ipairs(cb_data.channels) do print(channel) end end end local function serverversion_cb(cb_data) print("VERSION data for " .. cb_data.server) print("Version: " .. cb_data.version) print("Comments: " .. cb_data.comments) end local function ping_cb(cb_data) print("CTCP PING for " .. cb_data.nick) print("Roundtrip time: " .. cb_data.time .. "s") end local function time_cb(cb_data) print("CTCP TIME for " .. cb_data.nick) print("Localtime: " .. cb_data.time) end local function version_cb(cb_data) print("CTCP VERSION for " .. cb_data.nick) print("Version: " .. cb_data.version) end local function stime_cb(cb_data) print("TIME for " .. cb_data.server) print("Server time: " .. cb_data.time) end local function on_channel_msg(chan, from, msg) if from == "doy" then if msg == "leave" then irc.part(chan.name) return elseif msg:sub(1, 3) == "op " then chan:op(msg:sub(4)) return elseif msg:sub(1, 5) == "deop " then chan:deop(msg:sub(6)) return elseif msg:sub(1, 6) == "voice " then chan:voice(msg:sub(7)) return elseif msg:sub(1, 8) == "devoice " then chan:devoice(msg:sub(9)) return elseif msg:sub(1, 5) == "kick " then chan:kick(msg:sub(6)) return elseif msg:sub(1, 5) == "send " then dcc.send(from, msg:sub(6)) return elseif msg:sub(1, 6) == "whois " then irc.whois(whois_cb, msg:sub(7)) return elseif msg:sub(1, 8) == "sversion" then irc.server_version(serverversion_cb) return elseif msg:sub(1, 5) == "ping " then irc.ctcp_ping(ping_cb, msg:sub(6)) return elseif msg:sub(1, 5) == "time " then irc.ctcp_time(time_cb, msg:sub(6)) return elseif msg:sub(1, 8) == "version " then irc.ctcp_version(version_cb, msg:sub(9)) return elseif msg:sub(1, 5) == "stime" then irc.server_time(stime_cb) return elseif msg:sub(1, 6) == "trace " then irc.trace(trace_cb, msg:sub(7)) return elseif msg:sub(1, 5) == "trace" then irc.trace(trace_cb) return end end if from ~= "doylua" then irc.say(chan.name, from .. ": " .. msg) end end irc.register_callback("channel_msg", on_channel_msg) local function on_private_msg(from, msg) if from == "doy" then if msg == "leave" then irc.quit("gone") return elseif msg:sub(1, 5) == "send " then dcc.send(from, msg:sub(6)) return end end if from ~= "doylua" then irc.say(from, msg) end end irc.register_callback("private_msg", on_private_msg) local function on_channel_act(chan, from, msg) irc.act(chan.name, "jumps on " .. from) end irc.register_callback("channel_act", on_channel_act) local function on_private_act(from, msg) irc.act(from, "jumps on you") end irc.register_callback("private_act", on_private_act) local function on_op(chan, from, nick) print(nick .. " was opped in " .. chan .. " by " .. from) print_state() end irc.register_callback("op", on_op) local function on_deop(chan, from, nick) print(nick .. " was deopped in " .. chan .. " by " .. from) print_state() end irc.register_callback("deop", on_deop) local function on_voice(chan, from, nick) print(nick .. " was voiced in " .. chan .. " by " .. from) print_state() end irc.register_callback("voice", on_voice) local function on_devoice(chan, from, nick) print(nick .. " was devoiced in " .. chan .. " by " .. from) print_state() end irc.register_callback("devoice", on_devoice) local function on_dcc_send() return true end irc.register_callback("dcc_send", on_dcc_send) irc.connect{network = "irc.libera.chat", nick = "doylua"}
--- -- @author wesen -- @copyright 2018-2019 wesen <wesen-ac@web.de> -- @release 0.1 -- @license MIT -- local Object = require "classic" --- -- Error exception for the error() and pcall() functions. -- Classes that extend this class must implement a getMessage() method. -- -- @type Exception -- local Exception = Object:extend() -- Getters and Setters --- -- Returns the message. -- -- @treturn string The message -- function Exception:getMessage() end return Exception
-- train.lua -- Zdeněk Janeček, 2016 (ycdmdj@gmail.com) -- -- University of West Bohemia local mnist = require 'mnist' require 'classrbm' require 'plot_stats' require 'image' cmd = torch.CmdLine() cmd:text() cmd:text('Train a ClassRBM MNIST digit classificator.') cmd:text() cmd:text('Options') -- data cmd:option('-prefix', '', 'prefix of this run') cmd:option('-v', false, 'verbose mode') -- model params cmd:text('Model parameters') cmd:option('-n_visible', 28*28, 'RBM hidden layer size.') cmd:option('-n_hidden', 6000, 'RBM hidden layer size.') cmd:option('-n_class', 10, 'Number of target classes') cmd:text('Optimalization parameters') -- optimization cmd:option('-learning_rate',0.005,'learning rate') cmd:option('-momentum',0.5,'momentum') cmd:option('-L2',0.000022,'L2 decay') cmd:option('-max_epochs', 60, 'number of full passes through the training data while RBM train') --cmd:option('-sparsity_decay_rate',0.9,'decay rate for sparsity') --cmd:option('-sparsity_target',0.08,'sparsity target') --cmd:option('-sparsity_cost',0.0002,'sparsity cost') cmd:option('-batch_size',12,'number of sequences to train on in parallel') cmd:option('-stat_interval',4092,'statistics interval') cmd:option('-cuda', false,'use CUDA backend') cmd:option('-opencl', false,'use OpenCL backend') opt = cmd:parse(arg) torch.seed() local trainset = mnist.traindataset() local testset = mnist.testdataset() local oneY = torch.Tensor(opt.n_class) testset['data'] = testset['data']:double():clamp(0,1) trainset['data'] = trainset['data']:double():clamp(0,1) testset['label'] = testset['label']:double() trainset['label'] = trainset['label']:double() if opt.cuda then require 'cutorch' require 'cunn' testset['data'] = testset['data']:cuda() testset['label'] = testset['label']:cuda() trainset['data'] = trainset['data']:cuda() trainset['label'] = trainset['label']:cuda() oneY = oneY:cuda() elseif opt.opencl then require 'cltorch' require 'clnn' testset['data'] = testset['data']:cl() testset['label'] = testset['label']:cl() trainset['data'] = trainset['data']:cl() trainset['label'] = trainset['label']:cl() oneY = oneY:cl() end local validation_size = 256 function reconstruction_test() local err = 0 for i=1, validation_size do local index = torch.random(testset.size) local v1 = testset[index].x:view(opt.n_visible) local y1 = testset[index].y oneY:zero() oneY[y1+1] = 1 local v2, y2 = rbm:forward{v1, oneY} err = err + (torch.ne(oneY, y2):sum() == 0 and 0 or 1) end return (1-err/validation_size)*100 end function reconstruction_train() local err = 0 for i=1, validation_size do local index = torch.random(trainset.size) local v1 = trainset[index].x:view(opt.n_visible) local y1 = trainset[index].y oneY:zero() oneY[y1+1] = 1 local v2, y2 = rbm:forward{v1, oneY} err = err + (torch.ne(oneY, y2):sum() == 0 and 0 or 1) end return (1-err/validation_size)*100 end function free_energy_test() local err = 0 for i=1, validation_size do local index = torch.random(testset.size) local v1 = testset[index].x:view(opt.n_visible) local y1 = testset[index].y oneY:zero() oneY[y1+1] = 1 err = err + rbm:freeEnergy(v1, oneY) end return err/validation_size end function free_energy_train() local err = 0 for i=1, validation_size do local index = torch.random(trainset.size) local v1 = trainset[index].x:view(opt.n_visible) local y1 = trainset[index].y oneY:zero() oneY[y1+1] = 1 err = err + rbm:freeEnergy(v1, oneY) end return err/validation_size end -- 1) Run RBM train function train_feval(t) local index = torch.random(trainset.size) local v = trainset[index].x:view(opt.n_visible) local y = trainset[index].y oneY:zero() oneY[y+1] = 1 local _, yt = rbm:forward{v, oneY} local err = torch.ne(oneY, yt):sum() == 0 and 0 or 1 rbm:backward({v, oneY}, nil) dl_dx:mul(-opt.learning_rate) rbm.gradWeight:add(torch.mul(rbm.gradWeight, -opt.L2)) rbm.gradUWeight:add(torch.mul(rbm.gradUWeight, -opt.L2)) momentum_update(dl_dx, velocity, x, opt) --sparsity_update(rbm, qval, {v, oneY}, opt) return err end function store_rbm(params, name) local target_rbm = ClassRBM(opt.n_visible, opt.n_hidden, opt.n_class) local p, _ = target_rbm:getParameters() p:copy(params) torch.save(name, target_rbm) end -- Create RBM rbm = ClassRBM(opt.n_visible, opt.n_hidden, opt.n_class) -- Training parameters weightVelocity = rbm.gradWeight:clone() vbiasVelocity = rbm.gradVbias:clone() hbiasVelocity = rbm.gradHbias:clone() uweightVelocity = rbm.gradUWeight:clone() dbiasVelocity = rbm.gradDbias:clone() qval = torch.zeros(opt.n_hidden, 1) if opt.cuda then rbm = rbm:cuda() qval = qval:cuda() weightVelocity = weightVelocity:cuda() vbiasVelocity = vbiasVelocity:cuda() hbiasVelocity = hbiasVelocity:cuda() uweightVelocity = uweightVelocity:cuda() dbiasVelocity = dbiasVelocity:cuda() elseif opt.opencl then rbm = rbm:cl() qval = qval:cl() weightVelocity = weightVelocity:cl() vbiasVelocity = vbiasVelocity:cl() hbiasVelocity = hbiasVelocity:cl() uweightVelocity = uweightVelocity:cl() dbiasVelocity = dbiasVelocity:cl() end velocity = nn.Module.flatten{weightVelocity, vbiasVelocity, hbiasVelocity, uweightVelocity, dbiasVelocity} x,dl_dx = rbm:getParameters() histogramValues = { weight = rbm.weight, vbias = rbm.vbias, hbias = rbm.hbias, uweight = rbm.uweight, dbias = rbm.dbias, weightVelocity = weightVelocity, vbiasVelocity = vbiasVelocity, hbiasVelocity = hbiasVelocity, uweightVelocity = uweightVelocity, dbiasVelocity = dbiasVelocity } training_time = trainset.size/2 err = 0; iter = 0; patience = 15; best_val_err = 1/0 best_rbm = torch.Tensor() best_rbm:resizeAs(x):copy(x) for epoch=1, opt.max_epochs do print('train epoch '..epoch) velocity:zero() if epoch == math.floor(opt.max_epochs*0.5) then config.momentum = 0.8 elseif epoch == math.floor(opt.max_epochs*0.72) then config.momentum = 0.9 end epoch_err = 0 for t = 0, training_time-1 do iter = iter + 1 --xlua.progress(t, training_time) curr_err = train_feval(t) epoch_err = epoch_err + curr_err err = err + curr_err if iter >= opt.stat_interval then local test = reconstruction_test(rbm) local train = reconstruction_train(rbm) local energy_test = free_energy_test(rbm) local energy_train = free_energy_train(rbm) print(string.format('%s t=%d loss=%.4f test=%.4f%% train=%.4f%% ftest=%.4f ftrain=%.4f', os.date("%d/%m %H:%M:%S"), t, err/opt.stat_interval, test, train, energy_test, energy_train)) -- reset counters err = 0; iter = 0 if opt.v then draw_hist(rbm.mu1, 'mean_hidden-'..epoch..'-'..t, 'pravděpodobnost') draw_stats(histogramValues, 'hist_'..epoch..'-'..t) local wm = image.toDisplayTensor{ input=rbm.weight:view(torch.LongStorage{rbm.n_hidden, 28, 28}), padding=2, nrow=22} image.save('images/weight-map_'..epoch..'-'..t..'.png', wm) end end end if epoch_err < best_val_err then best_val_err = epoch_err best_rbm:copy(x) patience = 15 else patience = patience - 1 print('-> patience=', patience) if patience < 0 then break end end if epoch == math.floor(opt.max_epochs*0.5) then store_rbm(best_rbm, 'models/'..opt.prefix..'trained_rbm_'..epoch..'.dat') end end store_rbm(best_rbm, 'models/'..opt.prefix..'trained_rbm_final.dat')
local basedir = minetest.get_worldpath() .. "/detached_chest" minetest.mkdir(basedir) local get_save_file = function(playername, channel) local saneplayername = string.gsub(playername, "[.|/]", "") local sanechannelname = string.gsub(channel, "[.|/]", "") minetest.mkdir(basedir .. "/" .. saneplayername) return basedir .. "/" .. saneplayername .. "/" .. sanechannelname end -- playername -> { inv_name = <inv>, inv_name2 = <inv> } local player_inventories = {} function detached_chest.get_inventory_name(player, channel) return player:get_player_name() .. "_" .. channel end -- create / get function detached_chest.setup_inventory(player, channel) local inv_name = detached_chest.get_inventory_name(player, channel) local playername = player:get_player_name() local inv_map = player_inventories[playername] if not inv_map then inv_map = {} player_inventories[playername] = inv_map end local inv = inv_map[inv_name] if not inv then inv = minetest.create_detached_inventory(inv_name, {}) -- TODO: on_* checks inv:set_size("main", 8*4) -- restore local save_file = get_save_file(playername, inv_name) local file = io.open(save_file,"r") if file then local data = file:read("*a") local stacks = minetest.deserialize(data) for i, stack in ipairs(stacks) do inv:set_stack("main", i, ItemStack(stack)) end file:close() end inv_map[inv_name] = inv end return inv end -- cleanup minetest.register_on_leaveplayer(function(player) local playername = player:get_player_name() if not player_inventories[playername] then return end for inv_name, inv in pairs(player_inventories[playername]) do -- persist local list = inv:get_list("main") local data = {} for _, stack in ipairs(list) do table.insert(data, stack:to_string()) end local save_file = get_save_file(playername, inv_name) local file = io.open(save_file,"w") file:write(minetest.serialize(data)) file:close() minetest.remove_detached_inventory(inv_name) player_inventories[playername] = nil end end)
local U = {} local sn = { noremap=true, silent=true } --- General -- Leader vim.api.nvim_set_keymap('', '<Space>', '<Nop>', sn) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Windows local fn = vim.fn local is_win = fn.has('win32') or fn.has('win64') if (is_win) then vim.api.nvim_set_keymap('', '<C-z>', '<Nop>', sn) end --- Lsp vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', sn) vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', sn) vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', sn) vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', sn) function U.on_lsp_attach(client, bufnr) -- Enable completion triggered by <c-x><c-o> vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- See `:help vim.lsp.*` for documentation on any of the below functions vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', sn) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', sn) end --- Telescope vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>Telescope buffers<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', { noremap = true }) --- LSP Saga -- vim.api.nvim_set_keymap('n', 'gh', ':Lspsaga lsp_finder<CR>', sn) -- vim.api.nvim_set_keymap('n', '<leader>ca', ':Lspsaga code_action<CR>', sn) -- vim.api.nvim_set_keymap('v', '<leader>ca', ':<C-U>Lspsaga range_code_action<CR>', sn) -- vim.api.nvim_set_keymap('n', 'K', ':Lspsaga hover_doc<CR>', sn) -- vim.api.nvim_set_keymap('n', '<C-f>', '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(1)<CR>', sn) -- vim.api.nvim_set_keymap('n', '<C-b>', '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(-1)<CR>', sn) -- vim.api.nvim_set_keymap('n', 'gs', ':Lspsaga signature_help<CR>', sn) -- vim.api.nvim_set_keymap('n', 'gr', ':Lspsaga rename<CR>', sn) -- vim.api.nvim_set_keymap('n', 'gd', ':Lspsaga preview_definition<CR>', sn) -- vim.api.nvim_set_keymap('n', '<leader>cd', ':Lspsaga show_line_diagnostics<CR>', sn) -- vim.api.nvim_set_keymap('n', '[e', ':Lspsaga diagnostic_jump_next<CR>', sn) -- vim.api.nvim_set_keymap('n', ']e', ':Lspsaga diagnostic_jump_prev<CR>', sn) -- vim.api.nvim_set_keymap('n', '<A-d>', ':Lspsaga open_floaterm<CR>', sn) -- vim.api.nvim_set_keymap('t', '<A-d>', '<C-\\><C-n>:Lspsaga close_floaterm<CR>', sn) return U
local text_and_number_interface= {} local function rotate_color(color, angle) local hsv= ColorToHSV(color) hsv.Hue= (hsv.Hue + angle) % 360 return HSVToColor(hsv) end local corner_lumas= {2, .5, .5, 2} local alt_corner_lumas= {2, .5, .5, 2} local corner_angles= {30, 0, 0, -30} local alt_corner_angles= {-30, 0, 0, 30} local function rct_internal(text, color, corners, lumas, angles) for i, corner in ipairs(corners) do local new_color= color new_color= rotate_color(new_color, angles[i]) new_color= adjust_luma(new_color, lumas[i]) text[corner](text, new_color) end end function rot_color_text(text, color) rct_internal(text, color, {"diffuseupperleft", "diffuseupperright", "diffuselowerleft", "diffuselowerright"}, corner_lumas, corner_angles) end function alt_rot_color_text(text, color) rct_internal(text, color, {"diffuseupperleft", "diffuseupperright", "diffuselowerleft", "diffuselowerright"}, alt_corner_lumas, alt_corner_angles) end function normal_text(name, text, color, stroke, tx, ty, z, align, commands) color= color or fetch_color("text") tx= tx or 0 ty= ty or 0 z= z or 1 align= align or center local passed_init= commands and commands.InitCommand commands= commands or {} commands.Name= name commands.Text= text commands.InitCommand= function(self) self:xy(tx,ty):zoom(z):horizalign(align):diffuse(color) if stroke and stroke[4] > 0 then self:strokecolor(stroke) end maybe_distort_text(self) if passed_init then passed_init(self) end end return LoadFont("Common Normal") .. commands end function set_text_from_parts(self, parts) self:ClearAttributes() local full_text= "" for i, part in ipairs(parts) do full_text= full_text .. part[1] end self:settext(full_text) local curr_pos= 0 for i, part in ipairs(parts) do local part_len= #part[1] self:AddAttribute(curr_pos, {Length= part_len, Diffuse= part[2]}) curr_pos= curr_pos + part_len end end function attributed_text(name, x, y, z, align, parts, commands) local ret= Def.BitmapText{ Name= name, Font= "Common Normal", InitCommand= function(self) self:xy(x, y):zoom(z):horizalign(align) set_text_from_parts(self, parts) maybe_distort_text(self) if commands.InitCommand then commands.InitCommand(self) end end } for k, v in pairs(commands) do if k ~= "InitCommand" then ret[k]= v end end return ret end do local default_params= { sx= 0, sy= 0, tx= 0, ty= 0, tz= 1, tc= fetch_color("text"), tt= "", ts= "", ta= right, na= left, tf= "Common Normal", nf= "Common Normal", text_section= "Misc", nx= 0, ny= 0, nz= 1, nc= fetch_color("text"), nt= "0" } function text_and_number_interface:create_actors(name, params) if not name then return nil end self.name= name -- This is to avoid modifying the passed in table, which allows the caller -- to reuse it. local real_params= {} if params then for k, v in pairs(params) do real_params[k]= v end end params= real_params for k, v in pairs(default_params) do if not params[k] then params[k]= default_params[k] end end self.x= params.sx self.y= params.sy self.tx= params.tx self.ts= params.ts self.nx= params.nx self.text_section= params.text_section return Def.ActorFrame{ Name= name, InitCommand= function(subself) subself:xy(params.sx, params.sy) self.container= subself self.text= subself:GetChild("text") self.number= subself:GetChild("number") end, LoadFont(params.tf) .. { Name= "text", Text= self:get_string(params.tt), InitCommand= function(self) self:xy(params.tx, params.ty):zoom(params.tz):diffuse(params.tc) :horizalign(params.ta) maybe_distort_text(self) end }, LoadFont(params.nf) .. { Name= "number", Text= params.nt, InitCommand= function(self) self:xy(params.nx, params.ny):zoom(params.nz):diffuse(params.nc) :horizalign(params.na) maybe_distort_text(self) end }, } end end function text_and_number_interface:get_string(text) if not text then text= "" end local t= get_string_wrapper(self.text_section, text) if self.upper then --Trace("Uppering.") t= t:upper() end return t .. self.ts end function text_and_number_interface:set_text(text) if self.text then self.text:settext(self:get_string(text)) end end function text_and_number_interface:set_number(n) if self.number then self.number:settext(n) end end function text_and_number_interface:get_widths() local total= 0 local tw= 0 local nw= 0 if self.text then tw= self.text:GetZoomedWidth() + math.abs(self.tx) end if self.number then nw= self.number:GetZoomedWidth() + math.abs(self.nx) end total= tw + nw return total, tw, nw end function text_and_number_interface:move_to(x, y, time) if self.container then if time and time > 0 then self.container:finishtweening():april_linear(time) end self.x= x self.y= y self.container:xy(x, y) end end function text_and_number_interface:get_text_actor() return self.text end function text_and_number_interface:get_number_actor() return self.number end function text_and_number_interface:hide() if self.container then self.text:diffusealpha(0) self.number:diffusealpha(0) end end function text_and_number_interface:unhide() if self.container then self.text:diffusealpha(1) self.number:diffusealpha(1) end end text_and_number_interface_mt= { __index= text_and_number_interface } function width_limit_text(text, limit, natural_zoom) natural_zoom= natural_zoom or 1 if text:GetWidth() * natural_zoom > limit then text:zoomx(limit / text:GetWidth()) else text:zoomx(natural_zoom) end end function width_clip_text(text, limit) local full_text= text:GetText() local fits= text:GetZoomedWidth() <= limit local prev_max= #full_text - 1 local prev_min= 0 if not fits then while prev_max - prev_min > 1 do local new_max= math.round((prev_max + prev_min) / 2) text:settext(full_text:sub(1, 1+new_max)) if text:GetZoomedWidth() <= limit then prev_min= new_max else prev_max= new_max end end text:settext(full_text:sub(1, 1+prev_min)) end end function width_clip_limit_text(text, limit, natural_zoom) natural_zoom= natural_zoom or text:GetZoomY() local text_width= text:GetWidth() * natural_zoom if text_width > limit * 2 then text:zoomx(natural_zoom * .5) width_clip_text(text, limit) else width_limit_text(text, limit, natural_zoom) end end local function is_delim(c) return c == " " or c == "_" or c == "-" or c == "." end function split_string_to_words(s) local words= {} s= tostring(s) for word in s:gmatch("[%w']+") do words[#words+1]= word end if #words < 1 then words[1]= s end return words end function rec_calc_actor_extent(aframe, depth) depth= depth or "" if not aframe then return 0, 0, 0, 0 end local halign= aframe:GetHAlign() local valign= aframe:GetVAlign() local w= aframe:GetZoomedWidth() local h= aframe:GetZoomedHeight() local halignjust= (halign - .5) * w local valignjust= (valign - .5) * h local xmin= w * -halign local xmax= w * (1 - halign) local ymin= h * -valign local ymax= h * (1 - valign) if aframe.GetChildren then local xz= aframe:GetZoomX() local yz= aframe:GetZoomY() local children= aframe:GetChildren() for i, c in pairs(children) do if c:GetVisible() then local cx= c:GetX() + halignjust local cy= c:GetY() + valignjust --Trace(depth .. "child " .. i .. " at " .. cx .. ", " .. cy) local cxmin, cxmax, cymin, cymax= rec_calc_actor_extent(c,depth.." ") xmin= math.min((cxmin * xz) + cx, xmin) ymin= math.min((cymin * yz) + cy, ymin) xmax= math.max((cxmax * xz) + cx, xmax) ymax= math.max((cymax * yz) + cy, ymax) end end else --Trace(depth .. "no children") end --Trace(depth .. "rec_calc_actor_extent:") --Trace(depth .. "ha: " .. halign .. " va: " .. valign .. " w: " .. w .. -- " h: " .. h .. " haj: " .. halignjust .. " vaj: " .. valignjust .. -- " xmn: " .. xmin .. " xmx: " .. xmax .. " ymn: " .. ymin .. " ymx: " -- .. ymax) return xmin, xmax, ymin, ymax end function rec_calc_actor_pos(actor) -- This doesn't handle zooming. if not actor then return 0, 0 end local x= actor:GetDestX() local y= actor:GetDestY() local wx, wy= 0, 0 if actor.GetNumWrapperStates then local wrappers= actor:GetNumWrapperStates() for i= 1, wrappers do local nitori= actor:GetWrapperState(i) wx= wx + nitori:GetDestX() wy= wy + nitori:GetDestY() end end local px, py= rec_calc_actor_pos(actor:GetParent()) return x+px+wx, y+py+wy end local frame_tester_interface= {} frame_tester_interface_mt= { __index= frame_tester_interface } function frame_tester_interface:create_actors(name, x, y, remaining_depth) end function create_frame_quads(label, pad, fw, fh, outer_color, inner_color, fx, fy) if not fx then fx= fw/2 end if not fy then fy= fh/2 end return Def.ActorFrame{ InitCommand=cmd(xy,fx,fy), Name=label, Def.Quad{ Name="outer", InitCommand=cmd(xy,0,0;diffuse,outer_color;setsize,fw,fh) }, Def.Quad{ Name="inner", InitCommand=cmd(xy,0,0;diffuse,inner_color;setsize,fw-(pad*2),fh-(pad*2)) } } end local halvable_sides= {top= true, bottom= true} local function generic_left_half(self) self:cropright(0.5) end local function generic_right_half(self) self:cropleft(0.5) end local function generic_unhalf(self) self:cropright(0):cropleft(0) end local function generic_icon_sprite(button, side, add_to) local path= THEME:GetPathG("", "button_icons/"..button..".png", true) if not path or path == "" then return nil end local icon_scale= misc_config:get_data().cursor_button_icon_size local args= { Name= button, Texture= path, InitCommand= function(self) add_to[#add_to+1]= {side, self} scale_to_fit(self, 16 * icon_scale, 16 * icon_scale) self:diffusealpha(.5) if side == "top" then self:vertalign(bottom) elseif side == "bottom" then self:vertalign(top) elseif side == "left" then self:horizalign(right) elseif side == "right" then self:horizalign(left) end end, } if halvable_sides[side] then args.LeftCommand= generic_left_half args.RightCommand= generic_right_half args.FullCommand= generic_unhalf end return Def.Sprite(args) end local arrow_h= 8 local full_arrow_verts= { left= {-arrow_h, 0, 0, arrow_h, 0, -arrow_h}, right= {arrow_h, 0, 0, -arrow_h, 0, arrow_h}, top= {0, -arrow_h, -arrow_h, 0, arrow_h, 0}, bottom= {0, arrow_h, arrow_h, 0, -arrow_h, 0}, } local left_half_arrow_verts= { left= full_arrow_verts.left, right= {0, 0, 0, 0, 0, 0}, top= {0, -arrow_h, -arrow_h, 0, 0, 0}, bottom= {0, arrow_h, 0, 0, -arrow_h, 0}, } local right_half_arrow_verts= { left= {0, 0, 0, 0, 0, 0}, right= full_arrow_verts.right, top= {0, -arrow_h, 0, 0, arrow_h, 0}, bottom= {0, arrow_h, arrow_h, 0, 0, 0}, } local function generic_arrow(button, side, add_to, add_approaches, cursor_self) return Def.ActorMultiVertex{ Name= button, InitCommand= function(self) add_to[#add_to+1]= {side, self} self:SetDrawState{Mode= "DrawMode_Triangles"}:SetNumVertices(3) add_approaches(cursor_self, 3) end, RefitCommand= noop_blank, LeftCommand= function(self, param) cursor_self:set_verts_for_part(param[1], left_half_arrow_verts[side]) end, RightCommand= function(self, param) cursor_self:set_verts_for_part(param[1], right_half_arrow_verts[side]) end, FullCommand= function(self, param) cursor_self:set_verts_for_part(param[1], full_arrow_verts[side]) end, } end local vert_speed= 512 local function handle_approach(currents, goals, delta) local speeds= {} for i= 1, #currents do speeds[i]= vert_speed; end if get_music_file_length then multiapproach(currents, goals, speeds, delta) else multiapproach(currents, goals, speeds) end end local function align_x(x, align, w) return x + (align * w) end local pulse_cycle= 1 local move_time= 0.1 cursor_mt= { __index= { create_actors= function( self, name, x, y, t, main, hilight, button_list, align) self.main_color= main or fetch_color("player.both") self.hilight_color= hilight or fetch_color("player.hilight") self.x= x self.x= y self.align= align or 0 self.w= 0 self.h= 0 self.t= t self.hw= 0 self.hh= 0 self.sprite_parts= {} self.parts= {} self.part_ranges= {} self.currents= {} self.goals= {} self.corner_currents= {0, 0, 0, 0} self.corner_goals= {0, 0, 0, 0} self.update= function(frame, delta) local lerp_t= self.pulse_time / pulse_cycle self.pulse_time= self.pulse_time + delta self.curr_color= lerp_color(lerp_t, self.start_color, self.goal_color) self.curr_alpha= lerp(lerp_t, self.start_alpha, self.goal_alpha) -- I think something is causing a negative delta. self.curr_thick= math.abs(lerp(lerp_t, self.start_thick, self.goal_thick)) handle_approach(self.currents, self.goals, delta) handle_approach(self.corner_currents, self.corner_goals, delta) for i= 1, #self.parts do self:update_part(i, self.parts[i]) self:position_part(self.parts[i]) end for i= 1, #self.sprite_parts do self:position_part(self.sprite_parts[i]) self.sprite_parts[i][2]:diffusealpha(self.curr_alpha) end if self.pulse_time > pulse_cycle then self:reverse_pulse() end end self:start_pulse() local args= { Name= "cursor", InitCommand= function(subself) self.container= subself subself:xy(x, y):SetUpdateFunction(self.update) self:un_half() end, LoadActor(THEME:GetPathG("", "cursor_outline.lua"), {self= self}), } for i, button_info in ipairs(button_list) do -- button_info= {side, button} -- side= "left" or "top" or "right" or "bottom" local sprite= generic_icon_sprite( button_info[2], button_info[1], self.sprite_parts) if sprite then args[#args+1]= sprite else args[#args+1]= generic_arrow( button_info[2], button_info[1], self.parts, self.add_approaches, self) end end return Def.ActorFrame(args) end, start_pulse= function(self) self.start_color= self.main_color self.goal_color= self.hilight_color self.start_alpha= 1 self.goal_alpha= 0 self.start_thick= self.t*2 self.goal_thick= self.t self.pulse_time= 0 end, reverse_pulse= function(self) self.start_color, self.goal_color= self.goal_color, self.start_color self.start_thick, self.goal_thick= self.goal_thick, self.start_thick self.start_alpha, self.goal_alpha= self.goal_alpha, self.start_alpha self.pulse_time= 0 end, add_approaches= function(self, vert_count) table.insert(self.part_ranges, {#self.currents, vert_count}) for i, tab in ipairs{self.currents, self.goals} do for v= 1, vert_count*2 do table.insert(tab, 0) end end end, update_part= function(self, id, part) local range= self.part_ranges[id] local start= range[1] local currs= self.currents local verts= {} for v= 0, range[2]-1 do local i= start+(v*2) table.insert(verts, {{currs[i+1], currs[i+2], 0}, self.curr_color}) end part[2]:SetVertices(verts):SetLineWidth(self.curr_thick) end, position_part= function(self, part) local corcur= self.corner_currents local xadd= ({none= 0, left= corcur[1], right= corcur[3], top= 0, bottom= 0})[part[1]] local yadd= ({none= 0, left= 0, right= 0, top= corcur[2], bottom= corcur[4]})[part[1]] if part[1] ~= "none" then xadd= align_x(xadd, self.align, corcur[3] - corcur[1]) end part[2]:xy(xadd, yadd) end, set_verts_for_part= function(self, id, verts) local start= self.part_ranges[id][1] local goals= self.goals for v= 1, #verts do if v % 2 == 1 then goals[start+v]= align_x(verts[v], self.align, self.w) else goals[start+v]= verts[v] end end end, refit= function(self, nx, ny, nw, nh) nx= nx or self.container:GetX() ny= ny or self.container:GetY() local new_size= ((nw and (self.w ~= nw)) or (nh and (self.h ~= nh))) self.x= nx self.y= ny self.w= nw or self.w self.h= nh or self.h self.hw= self.w/2 self.hh= self.h/2 self.corner_goals= { align_x(-self.hw, self.align, self.w), -self.hh, align_x(self.hw, self.align, self.w), self.hh, } local secs_into_pulse= self.container:GetSecsIntoEffect() local remain= pulse_cycle - secs_into_pulse self.container:stoptweening():april_linear(move_time):xy(nx, ny) if new_size then for i= 1, #self.parts do self.parts[i][2]:playcommand("Refit", {i}) end end end, left_half= function(self) for i= 1, #self.parts do self.parts[i][2]:playcommand("Left", {i}) end for i= 1, #self.sprite_parts do self.sprite_parts[i][2]:playcommand("Left") end end, right_half= function(self) for i= 1, #self.parts do self.parts[i][2]:playcommand("Right", {i}) end for i= 1, #self.sprite_parts do self.sprite_parts[i][2]:playcommand("Right") end end, un_half= function(self) for i= 1, #self.parts do self.parts[i][2]:playcommand("Full", {i}) end for i= 1, #self.sprite_parts do self.sprite_parts[i][2]:playcommand("Full") end end, hide= function(self) for i= 1, #self.parts do self.parts[i][2]:visible(false) end for i= 1, #self.sprite_parts do self.sprite_parts[i][2]:visible(false) end end, unhide= function(self) for i= 1, #self.parts do self.parts[i][2]:visible(true) end for i= 1, #self.sprite_parts do self.sprite_parts[i][2]:visible(true) end end, set_parts_vis= function(self, sides, part_list, vis) for i= 1, #part_list do if string_in_table(part_list[i][1], sides) then part_list[i][2]:visible(vis) end end end, set_sides_vis= function(self, sides, vis) self:set_parts_vis(sides, self.parts, vis) self:set_parts_vis(sides, self.sprite_parts, vis) end }} amv_outline_mt= { __index= { create_actors= function(self, name, x, y, w, h, t, color) x= x or 0 y= y or 0 w= w or 0 h= h or 0 t= t or 0 color= color or fetch_color("player.both") self.name= name self.w= w self.h= h self.t= t return Def.ActorMultiVertex{ Name= name, InitCommand= function(subself) self.container= subself -- 6 verts, so the cursor can easily be cut in half. subself:xy(x, y):SetVertices{ {{0, -h/2, 0}, color}, {{w/2, -h/2, 0}, color}, {{w/2, h/2, 0}, color}, {{0, h/2, 0}, color}, {{-w/2, h/2, 0}, color}, {{-w/2, -h/2, 0}, color}, {{0, -h/2, 0}, color}, } :SetLineWidth(t):SetDrawState{Mode= "DrawMode_LineStrip"} end } end, refit= function(self, nx, ny, nw, nh) nx= nx or self.container:GetX() ny= ny or self.container:GetY() nw= nw or self.w nh= nh or self.h self.w= nw self.h= nh self.container:finishtweening() self.container:april_linear(0.05) self.container:xy(nx, ny) self.container:SetVertices{ {{0, -nh/2, 0}}, {{nw/2, -nh/2, 0}}, {{nw/2, nh/2, 0}}, {{0, nh/2, 0}}, {{-nw/2, nh/2, 0}}, {{-nw/2, -nh/2, 0}}, {{0, -nh/2, 0}}, } end, recolor= function(self, color) if color then self:SetVertices{{color}, {color}, {color}, {color}, {color}, {color}, {color}} end end, rethicken= function(self, thickness) thickness= thickness or self.t self.t= thickness self.container:SetLineWidth(thickness) end, hide= function(self) self.container:visible(false) end, unhide= function(self) self.container:visible(true) end }} frame_helper_mt= { __index= { create_actors= function(self, name, pad, fw, fh, outer_color, inner_color, fx, fy) self.name= name self.pad= pad self.x= fx self.y= fy self.w= fw self.h= fh self.outer= setmetatable({}, amv_outline_mt) return Def.ActorFrame{ Name= name, InitCommand= function(subself) self.container= subself subself:xy(fx, fy) self.inner= subself:GetChild("inner") end, Def.Quad{ Name= "inner", InitCommand= cmd(xy, 0, 0; diffuse, inner_color; setsize, fw, fh) }, self.outer:create_actors("outer", 0, 0, fw-pad/2, fh-pad/2, pad, outer_color) } end, resize= function(self, now, noh) self.w= now or self.w self.h= noh or self.h self.outer:refit(0, 0, now, noh) self.inner:setsize(self.w, self.h) end, resize_to_outline= function(self, frame, pad) local xmn, xmx, ymn, ymx= rec_calc_actor_extent(frame) self:move((xmx+xmn)/2, (ymx+ymn)/2) self:resize((xmx-xmn)+(pad*2), (ymx-ymn)+(pad*2)) end, move= function(self, x, y) x= x or self.x y= y or self.y self.container:stoptweening():april_linear(0.1):xy(x, y) self.x, self.y= x, y end, hide= function(self) self.container:visible(false) end, unhide= function(self) self.container:visible(true) end, }} function credit_reporter(x, y, show_credits) return normal_text( "credit", "Credits", fetch_color("credits"), nil, x, y, 1, center, { OnCommand= cmd(playcommand, "set"), CoinsChangedMessageCommand= cmd(playcommand, "set"), setCommand= function(self) local credits, coins, needed= get_coin_info() local text= credits .. " : " .. coins .. " / " .. needed if show_credits then text= "Credits: " .. text end if needed == 0 then text= "" end self:settext(text) end }) end function chart_info_text(steps, song) local info_text= "" if steps then local author= steps_get_author(steps, song) if not author or author == "" then author= "Uncredited" end local difficulty= steps_to_string(steps) local rating= steps:GetMeter() info_text= author .. ": " .. difficulty .. ": " .. rating end return info_text end function chart_info_text_for_pn(pn) local cur_steps= gamestate_get_curr_steps(pn) if not cur_steps then return "" end local author= steps_get_author(cur_steps, gamestate_get_curr_song()) local difficulty= steps_to_string(cur_steps) local rating= cur_steps:GetMeter() return author .. ": " .. difficulty .. ": " .. rating end -- Because somebody decided stepmania's scaletofit should change the position -- of the actor. function scale_to_fit(actor, width, height) local xscale= width / actor:GetWidth() local yscale= height / actor:GetHeight() actor:zoom(math.min(xscale, yscale)) end -- Until my fix of the engine side version is merged. -- usage: clip_scale(some_actor, width, height) function clip_scale(self, zw, zh) local uzw= self:GetWidth() local uzh= self:GetHeight() local xz= zw / uzw local yz= zh / uzh self:cropleft(0):cropright(0):croptop(0):cropbottom(0) local function handle_dim(dimz, dim, dimdest, cropa, cropb) self:zoom(dimz) local clip_amount= (1 - (dimdest / dim)) / 2 cropa(self, clip_amount) cropb(self, clip_amount) end if xz > yz then handle_dim(xz, self:GetZoomedHeight(), zh, self.croptop, self.cropbottom) else handle_dim(yz, self:GetZoomedWidth(), zw, self.cropleft, self.cropright) end end grade_image_mt= { __index= { create_actors= function(self, x, y, size, image) image= image or grade_image_path() return Def.ActorFrame{ InitCommand= function(subself) self.container= subself if x and y then subself:xy(x, y) end self:set_size(size or 0) self:set_image(image) end, Def.Sprite{ InitCommand= function(subself) self.sprite= subself subself:animate(false) end }, } end, get_x= function(self) return self.container:GetX() end, move= function(self, x, y) self.container:xy(x, y) end, set_image= function(self, path) self.sprite:Load(path) self.sprite_loaded= true scale_to_fit(self.sprite, self.size, self.size) end, set_size= function(self, size) self.size= size if self.sprite_loaded then scale_to_fit(self.sprite, self.size, self.size) end end, set_grade= function(self, grade, color) if self.sprite_loaded then self.sprite:setstate(math.min(grade-1, self.sprite:GetNumStates()-1)) if color then rot_color_text(self.sprite, color) else self.sprite:diffuse{1, 1, 1, 1} end end end, hide= function(self) self.hidden= true self.container:hibernate(math.huge) end, unhide= function(self) self.hidden= false self.container:hibernate(0) end, }}
local _, C = unpack(select(2, ...)) local _G = _G C.themes["Blizzard_Collections"] = function() if C["General"].NoTutorialButtons then _G.PetJournalTutorialButton:Kill() end end
local PlayerInput = Class('PlayerInput') function PlayerInput:init(player) self.owner = player -- instance of the player class self.movedir = Vec2(0, 0) -- resulting direction of movement from all the inputs self.keypressed = false -- whether a relevant input key is pressed end function PlayerInput:update(dt) if keyboard.isDown('w') then self.movedir.y = -1 self.keypressed = true elseif keyboard.isDown('s') then self.movedir.y = 1 self.keypressed = true else self.movedir.y = 0 end if keyboard.isDown('a') then self.movedir.x = -1 elseif keyboard.isDown('d') then self.movedir.x = 1 else self.movedir.x = 0 end end return PlayerInput
--- 模块功能:阿里云物联网套件客户端OTA功能. -- 目前固件签名算法仅支持MD5 -- @module aLiYunOta -- @author openLuat -- @license MIT -- @copyright openLuat -- @release 2018.04.16 require"log" require"http" module(..., package.seeall) --gVersion:固件版本号字符串,如果用户没有调用本文件的setVer接口设置,则默认为_G.PROJECT.."_".._G.VERSION.."_"..sys.getcorever() --gName:阿里云iot网站上配置的新固件文件下载后,在模块中的保存路径,如果用户没有调用本文件的setName接口设置,则默认为/luazip/update.bin --gCb:新固件下载成功后,要执行的回调函数 local gVersion,gName,gCb = _G.PROJECT.."_".._G.VERSION.."_".."Luat_V0000_LTE" local gFilePath,gFileSize local processed,processMileStone = 0,100*1024 --productKey:产品标识 --deviceName:设备名称 local productKey,deviceName --verRpted:版本号是否已经上报 local verRpted,sConnected --lastStep:最后一次上报的下载新固件的进度 local lastStep --下载中标志 local downloading local function otaCb(result,filePath,md5,size) log.info("aLiYunOta.otaCb",gCb,result,filePath,size,io.fileSize(filePath)) downloading = false --校验MD5 if result then if type(gName) == "string" then local calMD5 = crypto.md5(filePath,"file") result = (string.upper(calMD5) == string.upper(md5)) log.info("aLiYunOta.otaCb cmp md5",result,calMD5,md5) else rtos.fota_end() log.info("aLiYunOta.otaCb",result,size) end end if gCb then gCb(result,filePath) else if result then sys.restart("ALIYUN_OTA") end end end --[[ 函数名:upgradeStepRpt 功能 :新固件文件下载进度上报 参数 : step:1到100代表下载进度比;-2代表下载失败 desc:描述信息,可为空或者nil 返回值:无 ]] local function upgradeStepRpt(step,desc) log.info("aLiYunOta.upgradeStepRpt",step,desc,sConnected) if sConnected then if step<=0 or step==100 then sys.timerStop(getPercent) end lastStep = step aLiYun.publish("/ota/device/progress/"..productKey.."/"..deviceName,"{\"id\":1,\"params\":{\"step\":\"".."100".."\",\"desc\":\""..(desc or "").."\"}}") end end function getPercent() local step if type(gName) == "string" then step = io.fileSize(gName)*100/gFileSize else step = processed*100/gFileSize end log.info("aLiYunOta.getPercent",step) if step~=0 and step~=lastStep then upgradeStepRpt(step) end sys.timerStart(getPercent,5000) end local function downloadCbFnc(result,prompt,head,filePath) log.info("aLiYunOta.downloadCbFnc",result,prompt,filePath) sys.publish("ALIYUN_OTA_DOWNLOAD_IND",result) end local function saveUpdata(pdata,binlen,statusCode) log.info("saveUpdata",binlen,statusCode) if statusCode == "206" and pdata and binlen then if rtos.fota_process(pdata,binlen) ~=0 then --返回-94表示没有进行初始化,需要调用rtos.fota_start()进行更新初始化 log.info("updata.fota_process","fail!!") return else --打印此升级包的长度跟总包长度 processed = processed + pdata:len() log.info("updata.fota_process",processed,binlen) if(processed > processMileStone) then processMileStone = processMileStone + 100*1024 log.info("updata.fota_process",processed,binlen) end end end end local function downloadTask(url,size,md5) log.info("aLiYunOta.downloadTask1",downloading,url,size,md5) if not downloading then downloading = true gFileSize = size local rangeBegin,retryCnt = 0,0 sys.timerStart(getPercent,5000) while true do if not gName then gName = saveUpdata end http.request("GET",url,nil,{["Range"]="bytes="..rangeBegin.."-"},"",20000,downloadCbFnc,gName) --if rangeBegin==0 then os.remove(gName) end local _,result = sys.waitUntil("ALIYUN_OTA_DOWNLOAD_IND") log.info("aLiYunOta.downloadTask2",result) if result then upgradeStepRpt(100,0) sys.timerStart(otaCb,5000,true,gName,md5,size) break else retryCnt = retryCnt+1 if retryCnt>=30 then upgradeStepRpt(-2,"timeout") otaCb(false,gName) break end end if type(gname) == "string" then rangeBegin = io.fileSize(gName) else rangeBegin = processed end end end end --[[ 函数名:upgrade 功能 :收到云端固件升级通知消息时的回调函数 参数 : payload:消息负载(原始编码,收到的payload是什么内容,就是什么内容,没有做任何编码转换) 返回值:无 ]] function upgrade(payload) local result local jsonData,result = json.decode(payload) log.info("aLiYunOta.upgrade",result,payload) if rtos.fota_start() ~=0 then log.info("fota_start fail") sys.timerStart(verRpt,10000) return end if result and jsonData.data and jsonData.data.url then sys.taskInit(downloadTask,jsonData.data.url,jsonData.data.size,jsonData.data.md5) end end --[[ 函数名:verRptCb 功能 :上报固件版本号给云端后,收到PUBACK时的回调函数 参数 : result:true表示上报成功,false或者nil表示失败 返回值:无 ]] local function verRptCb(result) log.info("aLiYunOta.verRptCb",result) verRpted = result if not result then sys.timerStart(verRpt,20000) end end --[[ 函数名:verRpt 功能 :上报固件版本号给云端 参数 :无 返回值:无 ]] function verRpt() log.info("aLiYunOta.verRpt",sConnected,gVersion) if sConnected then aLiYun.publish("/ota/device/inform/"..productKey.."/"..deviceName,"{\"id\":1,\"params\":{\"version\":\""..gVersion.."\"}}",1,verRptCb) end end function connectCb(result,key,name) sConnected = result if result then log.info("aLiYunOta.connectCb",verRpted) productKey,deviceName = key,name --订阅主题 aLiYun.subscribe({["/ota/device/upgrade/"..key.."/"..name]=0, ["/ota/device/upgrade/"..key.."/"..name]=1}) if not verRpted then --上报固件版本号给云端 verRpt() end else sys.timerStop(verRpt) end end --- 设置当前的固件版本号 -- @string version,当前固件版本号 -- @return nil -- @usage -- aLiYunOta.setVer("MCU_VERSION_1.0.0") function setVer(version) local oldVer = gVersion gVersion = version if verRpted and version~=oldVer then verRpted = false verRpt() end end --- 设置新固件保存的文件名 -- @string name,新固件下载后保存的文件名;注意此文件名并不是保存的完整路径,完整路径通过setCb设置的回调函数去获取 -- @return nil -- @usage -- aLiYunOta.setName("MCU_FIRMWARE.bin") function setName(name) gName = name end --- 设置新固件下载后的回调函数 -- @function cbFnc,新固件下载后的回调函数 -- 回调函数的调用形式为:cbFnc(result,filePath),result为下载结果,true表示成功,false或者nil表示失败;filePath为新固件文件保存的完整路径 -- @return nil -- @usage -- aLiYunOta.setCb(cbFnc) function setCb(cbFnc) gCb = cbFnc end
--聖夜に煌めく竜 --Scripted by mallu11 function c100270041.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(100270041,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCondition(c100270041.descon) e1:SetTarget(c100270041.destg) e1:SetOperation(c100270041.desop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --battle indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(c100270041.indes) c:RegisterEffect(e3) --effect indes local e4=e3:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e4:SetValue(c100270041.efilter) c:RegisterEffect(e4) --remove local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(100270041,1)) e5:SetCategory(CATEGORY_REMOVE) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_BATTLE_START) e5:SetCountLimit(1) e5:SetCondition(c100270041.rmcon) e5:SetTarget(c100270041.rmtg) e5:SetOperation(c100270041.rmop) c:RegisterEffect(e5) end function c100270041.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function c100270041.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c100270041.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function c100270041.indes(e,c) return c:IsAttribute(ATTRIBUTE_DARK) end function c100270041.efilter(e,re) return re:IsActiveType(TYPE_MONSTER) and Duel.GetChainInfo(0,CHAININFO_TRIGGERING_ATTRIBUTE)&ATTRIBUTE_DARK~=0 end function c100270041.rmcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() e:SetLabelObject(bc) return Duel.GetAttacker()==c and bc and bc:IsControler(1-tp) end function c100270041.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetLabelObject() if chk==0 then return bc and bc:IsRelateToBattle() and bc:IsAbleToRemove() end Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0) end function c100270041.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=e:GetLabelObject() if bc and bc:IsRelateToBattle() and bc:IsControler(1-tp) and Duel.Remove(bc,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetLabelObject(bc) e1:SetCountLimit(1) e1:SetOperation(c100270041.retop) Duel.RegisterEffect(e1,tp) end if c:IsRelateToEffect(e) and c:IsChainAttackable() then Duel.ChainAttack() end end function c100270041.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetLabelObject()) end
-- Usage -- Just testing if lua syntax errors are caught when loading the script -- Author: Pedro Paixao -- Test parameters if #KEYS ~= 1 return 1
local _, ns = ... local L = ns.L local LUI = LolzenUI.L local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", function(self, event, addon) if addon == "LolzenUI_Options" and LolzenUIcfg.modules["unitframes"] == true then -- // Create a subcategory panel for Power Colors // -- ns.uf_powercolor_options = CreateFrame("Frame", "unitframe_powercolorpanel", ns["unitframes"]) ns.uf_powercolor_options.name = " "..L["sub_panel_unitframes_powercolors"] ns.uf_powercolor_options.parent = LUI["unitframes"] InterfaceOptions_AddCategory(ns.uf_powercolor_options) local title = ns.createTitle("uf_powercolor_options", L["sub_panel_unitframes_powercolors_title"]) local mana_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_mana"]..":") mana_text:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 4, -30) local mtBG = ns.createBackground("uf_powercolor_options", 600, 330) mtBG:SetPoint("TOPLEFT", mana_text, "BOTTOMLEFT", -8, 20) mtBG:SetFrameLevel(1) local mana = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[0], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) mana:SetPoint("LEFT", mana_text, "RIGHT", 100, 0) mana.setActualColors = function() LolzenUIcfg.unitframes.powercolors[0] = {mana:GetVertexColor()} LolzenUI.SetUFPowerColorMana() end local mana_f = ns.createColorPicker("uf_powercolor_options", mana, LolzenUIcfg.unitframes.powercolors[0]) mana_f:SetAllPoints(mana) local rage_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_rage"]..":") rage_text:SetPoint("TOPLEFT", mana_text, "BOTTOMLEFT", 0, -10) local rage = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[1], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) rage:SetPoint("TOP", mana, "BOTTOM", 0, -4) rage.setActualColors = function() LolzenUIcfg.unitframes.powercolors[1] = {rage:GetVertexColor()} LolzenUI.SetUFPowerColorRage() end local rage_f = ns.createColorPicker("uf_powercolor_options", rage, LolzenUIcfg.unitframes.powercolors[1]) rage_f:SetAllPoints(rage) local focus_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_focus"]..":") focus_text:SetPoint("TOPLEFT", rage_text, "BOTTOMLEFT", 0, -10) local focus = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[2], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) focus:SetPoint("TOP", rage, "BOTTOM", 0, -4) focus.setActualColors = function() LolzenUIcfg.unitframes.powercolors[2] = {focus:GetVertexColor()} LolzenUI.SetUFPowerColorFocus() end local focus_f = ns.createColorPicker("uf_powercolor_options", focus, LolzenUIcfg.unitframes.powercolors[2]) focus_f:SetAllPoints(focus) local energy_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_energy"]..":") energy_text:SetPoint("TOPLEFT", focus_text, "BOTTOMLEFT", 0, -10) local energy = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[3], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) energy:SetPoint("TOP", focus, "BOTTOM", 0, -4) energy.setActualColors = function() LolzenUIcfg.unitframes.powercolors[3] = {energy:GetVertexColor()} LolzenUI.SetUFPowerColorEnergy() end local energy_f = ns.createColorPicker("uf_powercolor_options", energy, LolzenUIcfg.unitframes.powercolors[3]) energy_f:SetAllPoints(energy) local cp_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_combopoints"]..":") cp_text:SetPoint("TOPLEFT", energy_text, "BOTTOMLEFT", 0, -10) local cp = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[4], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) cp:SetPoint("TOP", energy, "BOTTOM", 0, -4) cp.setActualColors = function() LolzenUIcfg.unitframes.powercolors[4] = {cp:GetVertexColor()} LolzenUI.SetUFPowerColorCP() end local cp_f = ns.createColorPicker("uf_powercolor_options", cp, LolzenUIcfg.unitframes.powercolors[4]) cp_f:SetAllPoints(cp) local runes_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_runes"]..":") runes_text:SetPoint("TOPLEFT", cp_text, "BOTTOMLEFT", 0, -10) local runes = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[5], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) runes:SetPoint("TOP", cp, "BOTTOM", 0, -4) runes.setActualColors = function() LolzenUIcfg.unitframes.powercolors[5] = {runes:GetVertexColor()} LolzenUI.SetUFPowerColorRunes() end local runes_f = ns.createColorPicker("uf_powercolor_options", runes, LolzenUIcfg.unitframes.powercolors[5]) runes_f:SetAllPoints(runes) local rp_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_runicpower"]..":") rp_text:SetPoint("TOPLEFT", runes_text, "BOTTOMLEFT", 0, -10) local rp = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[6], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) rp:SetPoint("TOP", runes, "BOTTOM", 0, -4) rp.setActualColors = function() LolzenUIcfg.unitframes.powercolors[6] = {rp:GetVertexColor()} LolzenUI.SetUFPowerColorRunePower() end local rp_f = ns.createColorPicker("uf_powercolor_options", rp, LolzenUIcfg.unitframes.powercolors[6]) rp_f:SetAllPoints(rp) local soulshards_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_soulshards"]..":") soulshards_text:SetPoint("TOPLEFT", rp_text, "BOTTOMLEFT", 0, -10) local soulshards = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[7], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) soulshards:SetPoint("TOP", rp, "BOTTOM", 0, -4) soulshards.setActualColors = function() LolzenUIcfg.unitframes.powercolors[7] = {soulshards:GetVertexColor()} LolzenUI.SetUFPowerColorSoulshards() end local soulshards_f = ns.createColorPicker("uf_powercolor_options", soulshards, LolzenUIcfg.unitframes.powercolors[7]) soulshards_f:SetAllPoints(soulshards) local lp_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_lunarpower"]..":") lp_text:SetPoint("TOPLEFT", soulshards_text, "BOTTOMLEFT", 0, -10) local lp = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[8], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) lp:SetPoint("TOP", soulshards, "BOTTOM", 0, -4) lp.setActualColors = function() LolzenUIcfg.unitframes.powercolors[8] = {lp:GetVertexColor()} LolzenUI.SetUFPowerColorLunarPower() end local lp_f = ns.createColorPicker("uf_powercolor_options", lp, LolzenUIcfg.unitframes.powercolors[8]) lp_f:SetAllPoints(lp) local hp_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_holypower"]..":") hp_text:SetPoint("TOPLEFT", lp_text, "BOTTOMLEFT", 0, -10) local hp = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[9], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) hp:SetPoint("TOP", lp, "BOTTOM", 0, -4) hp.setActualColors = function() LolzenUIcfg.unitframes.powercolors[9] = {hp:GetVertexColor()} LolzenUI.SetUFPowerColorHolyPower() end local hp_f = ns.createColorPicker("uf_powercolor_options", hp, LolzenUIcfg.unitframes.powercolors[9]) hp_f:SetAllPoints(hp) local maelstrom_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_maelstrom"]..":") maelstrom_text:SetPoint("TOPLEFT", hp_text, "BOTTOMLEFT", 0, -10) local maelstrom = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[11], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) maelstrom:SetPoint("TOP", hp, "BOTTOM", 0, -4) maelstrom.setActualColors = function() LolzenUIcfg.unitframes.powercolors[11] = {maelstrom:GetVertexColor()} LolzenUI.SetUFPowerColorMaelstrom() end local maelstrom_f = ns.createColorPicker("uf_powercolor_options", maelstrom, LolzenUIcfg.unitframes.powercolors[11]) maelstrom_f:SetAllPoints(maelstrom) local chi_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_chi"]..":") chi_text:SetPoint("TOPLEFT", maelstrom_text, "BOTTOMLEFT", 0, -10) local chi = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[12], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) chi:SetPoint("TOP", maelstrom, "BOTTOM", 0, -4) chi.setActualColors = function() LolzenUIcfg.unitframes.powercolors[12] = {chi:GetVertexColor()} LolzenUI.SetUFPowerColorChi() end local chi_f = ns.createColorPicker("uf_powercolor_options", chi, LolzenUIcfg.unitframes.powercolors[12]) chi_f:SetAllPoints(chi) local insanity_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_insanity"]..":") insanity_text:SetPoint("TOPLEFT", chi_text, "BOTTOMLEFT", 0, -10) local insanity = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[13], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) insanity:SetPoint("TOP", chi, "BOTTOM", 0, -4) insanity.setActualColors = function() LolzenUIcfg.unitframes.powercolors[13] = {insanity:GetVertexColor()} LolzenUI.SetUFPowerColorInsanity() end local insanity_f = ns.createColorPicker("uf_powercolor_options", insanity, LolzenUIcfg.unitframes.powercolors[13]) insanity_f:SetAllPoints(insanity) local ac_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_arcanecharges"]..":") ac_text:SetPoint("TOPLEFT", insanity_text, "BOTTOMLEFT", 0, -10) local ac = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[16], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) ac:SetPoint("TOP", insanity, "BOTTOM", 0, -4) ac.setActualColors = function() LolzenUIcfg.unitframes.powercolors[16] = {ac:GetVertexColor()} LolzenUI.SetUFPowerColorArcaneCharges() end local ac_f = ns.createColorPicker("uf_powercolor_options", ac, LolzenUIcfg.unitframes.powercolors[16]) ac_f:SetAllPoints(ac) local fury_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_fury"]..":") fury_text:SetPoint("TOPLEFT", ac_text, "BOTTOMLEFT", 0, -10) local fury = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[17], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) fury:SetPoint("TOP", ac, "BOTTOM", 0, -4) fury.setActualColors = function() LolzenUIcfg.unitframes.powercolors[17] = {fury:GetVertexColor()} LolzenUI.SetUFPowerColorFury() end local fury_f = ns.createColorPicker("uf_powercolor_options", fury, LolzenUIcfg.unitframes.powercolors[17]) fury_f:SetAllPoints(fury) local pain_text = ns.createFontstring("uf_powercolor_options", L["sub_panel_unitframes_powercolors_pain"]..":") pain_text:SetPoint("TOPLEFT", fury_text, "BOTTOMLEFT", 0, -10) local pain = ns.createColorTexture("uf_powercolor_options", 16, 16, LolzenUIcfg.unitframes.powercolors[18], LolzenUIcfg.unitframes.general["uf_statusbar_texture"]) pain:SetPoint("TOP",fury, "BOTTOM", 0, -4) pain.setActualColors = function() LolzenUIcfg.unitframes.powercolors[18] = {pain:GetVertexColor()} LolzenUI.SetUFPowerColorPain() end local pain_f = ns.createColorPicker("uf_powercolor_options", pain, LolzenUIcfg.unitframes.powercolors[18]) pain_f:SetAllPoints(pain) ns["uf_powercolor_options"].default = function(self) LolzenUIcfg.unitframes.powercolors = _G["LolzenUIdefaultcfg"].unitframes.powercolors ReloadUI() end end end)
object_draft_schematic_weapon_loot_darksting = object_draft_schematic_weapon_shared_loot_darksting:new { } ObjectTemplates:addTemplate(object_draft_schematic_weapon_loot_darksting, "object/draft_schematic/weapon/loot_darksting.iff")
if GameHelpers.Client == nil then GameHelpers.Client = {} end ---Get the current character stored in characterSheet's main timeline. ---@param main FlashObject|nil ---@return EclCharacter function GameHelpers.Client.GetCharacterSheetCharacter(main) local character = nil if main == nil then if not Vars.ControllerEnabled then main = Ext.GetUIByType(Data.UIType.characterSheet):GetRoot() else main = Ext.GetUIByType(Data.UIType.statsPanel_c):GetRoot() end end if main ~= nil then character = GameHelpers.Client.TryGetCharacterFromDouble(main.characterHandle) end return character or Client:GetCharacter() end ---Get the current character stored in characterSheet's main timeline. ---@param main FlashObject|nil ---@return EclCharacter function GameHelpers.Client.GetCharacterCreationCharacter(main) local character = nil if main == nil then if not Vars.ControllerEnabled then main = Ext.GetUIByType(Data.UIType.characterCreation):GetRoot() else main = Ext.GetUIByType(Data.UIType.characterCreation_c):GetRoot() end end if main ~= nil then character = GameHelpers.Client.TryGetCharacterFromDouble(main.characterHandle) end return character or Client:GetCharacter() end ---Get the GM's target character in GM mode. ---@return EclCharacter function GameHelpers.Client.GetGMTargetCharacter() local character = nil local ui = Ext.GetUIByType(Data.UIType.GMPanelHUD) if ui then local handle = ui:GetValue("targetHandle", "number") if handle and handle ~= 0 then character = GameHelpers.Client.TryGetCharacterFromDouble(handle) end end return character end ---Get the current character set in the hotbar. ---@return EclCharacter|nil function GameHelpers.Client.GetCharacter() local character = nil if not Vars.ControllerEnabled then local ui = Ext.GetUIByType(Data.UIType.hotBar) if ui ~= nil then local main = ui:GetRoot() if main ~= nil then character = GameHelpers.Client.TryGetCharacterFromDouble(main.hotbar_mc.characterHandle) end end if not character and SharedData.GameMode == GAMEMODE.GAMEMASTER then character = GameHelpers.Client.GetGMTargetCharacter() end else local ui = Ext.GetUIByType(Data.UIType.bottomBar_c) if ui ~= nil then local main = ui:GetRoot() if main ~= nil then character = GameHelpers.Client.TryGetCharacterFromDouble(main.characterHandle) end end end return character end ---@return boolean function GameHelpers.Client.IsGameMaster(ui, this) if Client and Client.Character and (Client.Character.IsGameMaster and not Client.Character.IsPossessed) then return true end if not Vars.ControllerEnabled then local ui = ui or Ext.GetUIByType(Data.UIType.characterSheet) if ui then ---@type CharacterSheetMainTimeline local this = this or ui:GetRoot() if this and this.isGameMasterChar then return true end end end return false end ---Tries to get a character from a double value. ---@param double number ---@return EclCharacter function GameHelpers.Client.TryGetCharacterFromDouble(double) local b,character = xpcall(function() if not GameHelpers.Math.IsNaN(double) then local handle = Ext.DoubleToHandle(double) if handle then return Ext.GetCharacter(handle) end else fprint(LOGLEVEL.WARNING, "[GameHelpers.Client.TryGetCharacterFromDouble] Double handle is NaN (not a number)!") return nil end end, debug.traceback) return character end
ATTRIBUTE.name = "Computers" ATTRIBUTE.description = "." ATTRIBUTE.category = "Proffesions"
require('Vars') require('World') require('Bird') require('Camera') Pipes = { pipes = {}, w = 50, x = Screen.w, space = { x = Screen.w/2 } } function Pipes.create() space = {} space.h = love.math.random(100,160) space.y = love.math.random(50, Screen.h - (space.h+50)) block1 = { x = Pipes.x, width = Pipes.w, height = space.y - space.h/2 } block1.y = block1.height / 2 block1.body = love.physics.newBody(World, block1.x, block1.y, "static") block1.shape = love.physics.newRectangleShape(block1.width, block1.height) block1.fixture = love.physics.newFixture(block1.body, block1.shape, 5) -- A higher density gives it more mass. block2 = { x = Pipes.x, width = Pipes.w, height = Screen.h - (block1.height + space.h) } block2.y = block1.height + space.h + block2.height/2 block2.body = love.physics.newBody(World, block2.x, block2.y, "static") block2.shape = love.physics.newRectangleShape(block2.width, block2.height) block2.fixture = love.physics.newFixture(block2.body, block2.shape, 1) Pipes.x = Pipes.x + Pipes.space.x return {one = block1, two = block2, scored=false, space = space} end while Pipes.x < Screen.w*2+1 do table.insert(Pipes.pipes, Pipes.create()) end function Pipes.reset() for _, pipe in pairs(Pipes.pipes) do pipe.one.body:setX(Pipes.x) pipe.two.body:setX(Pipes.x) Pipes.x = Pipes.x + Pipes.space.x pipe.scored = false end end function Pipes:updatePosition(pipe) if pipe.one.body:getX() < Bird.body:getX() - (Screen.w/2 + Pipes.w/2) then -- If the pipe is off the Screen --reset the pipe to come onto the Screen pipe.one.body:setX(Bird.body:getX() + Screen.w + Pipes.w/2) pipe.two.body:setX(Bird.body:getX() + Screen.w + Pipes.w/2) pipe.scored = false Pipes:updateSpacing(pipe) end end function Pipes:updateSpacing(pipe) space = {} space.h = love.math.random(100,160) space.y = love.math.random(50, Screen.h - (space.h+50)) pipe.one.height = space.y - space.h/2 pipe.two.height = Screen.h - (block1.height + space.h) pipe.one.y = pipe.one.height / 2 pipe.one.body:setY(pipe.one.height / 2) pipe.two.y = pipe.one.height + space.h + pipe.two.height/2 pipe.two.body:setY(pipe.one.height + space.h + pipe.two.height/2) pipe.one.fixture:destroy() pipe.one.shape = love.physics.newRectangleShape(pipe.one.width, pipe.one.height) pipe.one.fixture = love.physics.newFixture(pipe.one.body, pipe.one.shape, 1) pipe.two.fixture:destroy() pipe.two.shape = love.physics.newRectangleShape(pipe.two.width, pipe.two.height) pipe.two.fixture = love.physics.newFixture(pipe.two.body, pipe.two.shape, 1) end function Pipes.draw() love.graphics.setColor(0.20, 0.20, 0.20) -- set the drawing color to grey for the blocks for _, pipe in pairs(Pipes.pipes) do --Draw the Pipes pipe.img = Images.pipe pipe.x = pipe.one.body:getX() + Pipes.w/2 - Camera.x pipe.y = pipe.one.body:getY() + pipe.one.height/2 pipe.o = math.pi pipe.sx = pipe.one.width/pipe.img:getWidth() love.graphics.draw(pipe.img, pipe.x, pipe.y, pipe.o, pipe.sx, 1) pipe.img = Images.pipe pipe.x = pipe.two.body:getX() - Pipes.w/2 - Camera.x pipe.y = pipe.two.body:getY() - pipe.two.height/2 pipe.o = 0 pipe.sx = pipe.two.width/pipe.img:getWidth() love.graphics.draw(pipe.img, pipe.x, pipe.y, pipe.o, pipe.sx, 1) end end function Pipes:collision(pipe) distance1, _, _, _, _ = love.physics.getDistance(Bird.fixture, pipe.one.fixture) distance2, _, _, _, _ = love.physics.getDistance(Bird.fixture, pipe.two.fixture) if distance1 == 0 or distance2 == 0 then --If the player hit a pipe or the Ground if Game.over == false then Game.over = true Bird.body:setLinearVelocity(0, 0) Bird.body:setX(Bird.body:getX()) --This line is why we need the if statement, otherwise the Bird just keeps travelling backwards Sounds.hit:play() Sounds.fail:play() end end end
-- add target target("demo") -- set kind set_kind("binary") -- add deps add_deps("[targetname]") -- add defines add_defines("__tb_prefix__=\"demo\"") -- set the object files directory set_objectdir("$(buildir)/.objs") -- add links directory add_linkdirs("$(buildir)") -- add includes directory add_includedirs("$(buildir)") add_includedirs("$(buildir)/[targetname]") -- add links add_links("[targetname]") -- add packages add_options("tbox", "base") -- add files add_files("*.c")
local funcs = require("sclua.funcs") local Buffer_metatable = {} Buffer_metatable.__index = Buffer_metatable function Buffer_metatable:alloc(numframes, numchannels,cmplMsg) numchannels = numchannels or 1 OSCFunc.newfilter("/b_info",self.bufnum,self:queryresponse(),true) ThreadServerSendT{{'/b_alloc', {self.bufnum, numframes, numchannels}},{"/b_query",{self.bufnum}}} return self end function Buffer_metatable:allocRead(path,start,numframes) start = start or 0 numframes = numframes or -1 OSCFunc.newfilter("/b_info",self.bufnum,self:queryresponse(),true) --ThreadServerSendT{{'/b_allocRead', {self.bufnum, path, start, numframes}},{"/b_query",{self.bufnum}}} ThreadServerSend{'/b_allocRead', {self.bufnum, path, start, numframes,{"blob",toOSC({"/b_query",{self.bufnum}})}}} end function Buffer_metatable:allocReadChannel(path,start,numframes,channels) start = start or 0 numframes = numframes or -1 channels = channels or {0} --channels[#channels+1] = {"blob",""} --supernova needs that no more OSCFunc.newfilter("/b_info",self.bufnum,self:queryresponse(),true) local msg = {'/b_allocReadChannel', {self.bufnum, path, start, numframes,unpack(channels)}} table.insert(msg[2],{"blob",toOSC({"/b_query",{self.bufnum}})}) ThreadServerSend(msg) end function Buffer_metatable:read(path,start,numframes,bufstart,leaveopen) start = start or 0 numframes = numframes or -1 bufstart = bufstart or 0 leaveopen = leaveopen or 0 OSCFunc.newfilter("/done",{"/b_read",self.bufnum},function(msg) prtable(msg) end,true) ThreadServerSend(self.server:Msg('/b_read', self.bufnum, path, start, numframes,bufstart,leaveopen)) end --Header format is one of: --"aiff", "next", "wav", "ircam"", "raw" --Sample format is one of: --"int8", "int16", "int24", "int32", "float", "double", "mulaw", "alaw" function Buffer_metatable:write(path,headerf,samplef, numframes, bufstart, leaveopen, cmplMsg) headerf = headerf or "wav" samplef = samplef or "float" numframes = numframes or -1 bufstart = bufstart or 0 leaveopen = leaveopen or 0 OSCFunc.newfilter("/done",{"/b_write",self.bufnum},function(msg) end,true) ThreadServerSend(self.server:Msg('/b_write', self.bufnum, path, headerf, samplef, numframes, bufstart, leaveopen,cmplMsg)) end function Buffer_metatable:free() self.server:sendMsg('/b_free', self.bufnum) self.server.allbuffers[self] = nil end function Buffer_metatable:zero() self.server:sendMsg('/b_zero', self.bufnum) end function Buffer_metatable:set(index, value) self.server:sendMsg('/b_set', self.bufnum, index, value) end function Buffer_metatable:setn(index, numsamples, value) -- not ready perphas ... instead of value or use unpack self.server:sendMsg('/b_setn', self.bufnum, index, numsamples, unpack(value)) end function Buffer_metatable:fill(index, numsamples, value) self.server:sendMsg('/b_fill', self.bufnum, index, numsamples, value) end function Buffer_metatable:close() self.server:sendMsg('/b_close', self.bufnum) end function Buffer_metatable:queryresponse() return function(msg) print("buffer:",msg[2][1]," frames:",msg[2][2]," channels:",msg[2][3]," samprate:",msg[2][4]) self.frames = msg[2][2] self.channels = msg[2][3] end end function Buffer_metatable:query(block) if block then print("blockin on b_query",self.bufnum) local tmplinda = lanes.linda() OSCFunc.newfilter("/b_info",self.bufnum,self:queryresponse(),true,true,tmplinda) ThreadServerSend(self.server:Msg('/b_query', self.bufnum)) local key,val = tmplinda:receive("OSCReceive") -- wait OSCFunc.handleOSCReceive(val) -- clean responder and print else OSCFunc.newfilter("/b_info",self.bufnum,self:queryresponse(),true) ThreadServerSend(self.server:Msg('/b_query', self.bufnum)) end end function Buffer_metatable:get(index) self.server:sendMsg('/b_get', self.bufnum, index) end function Buffer_metatable:getn(index, numsamples,action) assert(numsamples) if action then OSCFunc.newfilter("/b_setn",self.bufnum,function(msg2) --prtable(msg2) local t = {} for i=4,#msg2[2] do t[#t+1] = msg2[2][i] end action(t) end,true) end ThreadServerSend(self.server:Msg('/b_getn', self.bufnum, index, numsamples)) end function Buffer_metatable:loadToFloatArray(index, count, action) --forkIfNeeded(function() index = index or 0 count = count or -1 local tmpPath = os.tmpname() self:write(tmpPath, "wav", "float", count, index) self.server:sync() local sndfile = require"sndfile_ffi" local ffi = require"ffi" local sf = sndfile.Sndfile(tmpPath) --print("sf load",tmpPath,sf:channels(),sf:frames(),sf:samplerate(),sf:format()) local samples = tonumber(sf:channels()*sf:frames()) --print("samples",samples,type(samples)) local rbuff = ffi.new("float[?]",samples) local readen = sf:readf_float(rbuff, sf:frames()) --assert(200==readen) if sf:frames()~=readen then prerror("sf error:",sndfile.C.sf_error(sf.sf)) end local ret = {} for i=0,samples-1 do ret[i+1] = rbuff[i] end sf:close() local ok,err = os.remove(tmpPath) if not ok then prerror("could not delete tmp file ",err) end --print"calling action" if action then action(ret) end --print"called action" return ret --end) end function Buffer_metatable:__gc() self:free() end -- support garbage collection: function Buffer_metatable:__gc() self:free() end return Buffer_metatable
------------------------------------------------------------------------------- -- Mob Framework Mod by Sapier -- Converted to 'creatures' mob engine API by Jordan Irwin (AntumDeluge) -- -- You may copy, use, modify or do nearly anything except removing this -- copyright notice. -- And of course you are NOT allow to pretend you have written it. -- --! @file init.lua --! @brief shark implementation --! @copyright Sapier --! @author Sapier --! @date 2014-05-30 -- -- Contact sapier a t gmx net ------------------------------------------------------------------------------- local S = core.get_translator("shark") cmer_shark = { modname = core.get_current_modname() } cmer_shark.modpath = core.get_modpath(cmer_shark.modname) local version = "1.0" local variant = "me" -- Creatures MOB-Engine local version_full = tostring(version) .. "-" .. variant local function mlog(lvl, msg) if lvl and msg == nil then msg = lvl lvl = nil end if lvl == nil then core.log("[" .. cmer_shark.modname .. "] " .. msg) else core.log(lvl, "[" .. cmer_shark.modname .. "] " .. msg) end end mlog("action", "v" .. version_full .. " loading ...") local mobname = "creatures:shark" local scripts = { "settings", "items", } for _, script in ipairs(scripts) do dofile(cmer_shark.modpath .. "/" .. script .. ".lua") end local spawn_nodes = {"group:sand", "default:clay"} if core.global_exists("ethereal") then table.insert(spawn_nodes, "ethereal:seaweed") end local shark_def = { name = ":creatures:shark", nametag = creatures.feature_nametags and S("Shark") or nil, stats = { hp = 15, -- TODO: add setting to change --hp_min = 10, --hp_max = 15, hostile = true, lifetime = 600, -- 10 minutes can_jump = 0, can_swim = true, }, -- FIXME: -- - shark moves on land after being attacked -- - shark doesn't attack until attacked -- - shark floats into air when attacked modes = { idle = { chance = 0.1, duration = 30, moving_speed = 0, }, follow = { chance = 0.1, duration = 120, moving_speed = 2, }, attack = { chance = 0.8, moving_speed = 3, }, }, model = { mesh = "shark.b3d", textures = {"shark_mesh.png"}, collisionbox = {-0.38, -0.25, -0.38, 0.38, 0.25, 0.38}, --rotation = 0.0, animations = { idle = { start = 1, stop = 80, speed = 24, }, follow = { start = 80, stop = 160, speed = 24, }, attack = { start = 80, stop = 160, speed = 24, }, }, }, drops = { {"shark:meat_raw", 3, 1.0}, {"shark:tooth", {min=1, max=3}, 0.4}, {"shark:skin", 1, 0.4}, }, combat = { attack_damage = 6, --attack_speed = 1.0, attack_radius = 2.0, --search_enemy = , --search_timer = , search_radius = 10.0, --search_type = , }, spawning = { abm_nodes = { spawn_on = spawn_nodes, neighbors = {"default:water_source", "default:water_flowing",}, }, abm_interval = cmer_shark.interval, abm_chance = cmer_shark.chance, --max_number = 1, number = 1, time_range = {min=cmer_shark.min_time, max=cmer_shark.max_time}, light = {min=cmer_shark.min_light, max=cmer_shark.max_light}, height_limit = {min=cmer_shark.min_height, max=cmer_shark.max_height}, }, } creatures.register_mob(shark_def) if core.global_exists("asm") then asm.addEgg({ name = "shark", inventory_image = "shark_inv.png", spawn = mobname, ingredients = "shark:tooth", }) end mlog("action", "v" .. version_full .. " loaded")
---@class GridEntityType @enum GridEntityType = {} --- --- 0 GridEntityType.GRID_NULL = 0 --- --- 1 GridEntityType.GRID_DECORATION = 1 --- --- 2 GridEntityType.GRID_ROCK = 2 --- --- 3 GridEntityType.GRID_ROCKB = 3 --- --- 4 GridEntityType.GRID_ROCKT = 4 --- --- 5 GridEntityType.GRID_ROCK_BOMB = 5 --- --- 6 GridEntityType.GRID_ROCK_ALT = 6 --- --- 7 GridEntityType.GRID_PIT = 7 --- --- 8 GridEntityType.GRID_SPIKES = 8 --- --- 9 GridEntityType.GRID_SPIKES_ONOFF = 9 --- --- 10 GridEntityType.GRID_SPIDERWEB = 10 --- --- 11 GridEntityType.GRID_LOCK = 11 --- --- 12 GridEntityType.GRID_TNT = 12 --- not used! --- --- 13 GridEntityType.GRID_FIREPLACE = 13 --- --- 14 GridEntityType.GRID_POOP = 14 --- --- 15 GridEntityType.GRID_WALL = 15 --- --- 16 GridEntityType.GRID_DOOR = 16 --- --- 17 GridEntityType.GRID_TRAPDOOR = 17 --- --- 18 GridEntityType.GRID_STAIRS = 18 --- --- 19 GridEntityType.GRID_GRAVITY = 19 --- --- 20 GridEntityType.GRID_PRESSURE_PLATE = 20 --- --- 21 GridEntityType.GRID_STATUE = 21 --- --- 22 GridEntityType.GRID_ROCK_SS = 22 --- --- 23 GridEntityType.GRID_TELEPORTER = 23 --- --- 24 GridEntityType.GRID_PILLAR = 24 --- --- 25 GridEntityType.GRID_ROCK_SPIKED = 25 --- special skull in Depths 2 --- --- 26 GridEntityType.GRID_ROCK_ALT2 = 26 --- --- 27 GridEntityType.GRID_ROCK_GOLD = 27 return GridEntityType
local find_patch = {} find_patch.MAX_INT32 = 2147483647 find_patch.range = 10000 local function isValid(x) if not x or not x.valid then return end return x end local function round(num, dp) local mult = 10 ^ (dp or 0) return math.floor(num * mult + 0.5) / mult end function find_patch.getDistance(pos1, pos2) local pos1 = {x = pos1.x or pos1[1], y = pos1.y or pos1[2]} local pos2 = {x = pos2.x or pos2[1], y = pos2.y or pos2[2]} local a = math.abs(pos1.x - pos2.x) local b = math.abs(pos1.y - pos2.y) local c = math.sqrt(a ^ 2 + b ^ 2) return c end function find_patch.getClosest(pos, list) local x, y = pos.x or pos[1], pos.y or pos[2] local closest = find_patch.MAX_INT32 for _, posenum in pairs(list) do local distance = find_patch.getDistance(pos, posenum) if distance < closest then x, y = posenum.x, posenum.y closest = distance end end if closest == find_patch.MAX_INT32 then return end return {position = {x, y}, distance = closest} end local colors = { iron_ore = {r = 137, g = 186, b = 211}, copper_ore = {r = 252, g = 166, b = 102}, stone = {r = 182, g = 150, b = 87}, coal = {r = 55, g = 50, b = 40}, uranium_ore = {r = 162, g = 249, b = 15}, crude_oil = {r = 144, g = 144, b = 144} } function find_patch.findPatch(res_name, range, player) if (res_name == "square") then IndicateClosestMagicChunk(player) end local patches = player.surface.find_entities_filtered { name = res_name, type = "resource", position = player.position, radius = range } local all = {} for each, patch in pairs(patches) do table.insert(all, patch.position) end local found = find_patch.getClosest(player.position, all) if not found then player.print("No " .. res_name .. " patch found") return end player.print(res_name .. " found " .. round(found.distance, 2) .. " tiles away") res_name = res_name:gsub("-", "_") local line = rendering.draw_line { surface = player.surface, from = player.character, to = found.position, players = {player.index}, color = colors[res_name], width = 3.2, gap_length = 5, dash_length = 8, time_to_live = 60 * 60 } local circle = rendering.draw_circle { color = colors[res_name], radius = 4, width = 6.4, filled = false, target = found.position, players = {player.index}, surface = player.surface, time_to_live = 60 * 60 } end local resources = { ["i"] = "iron-ore", ["iron"] = "iron-ore", ["iron-ore"] = "iron-ore", ["iron_ore"] = "iron-ore", ["c"] = "copper-ore", ["copper"] = "copper-ore", ["copper-ore"] = "copper-ore", ["copper_ore"] = "copper-ore", ["s"] = "stone", ["stone"] = "stone", ["coal"] = "coal", ["u"] = "uranium-ore", ["uranium"] = "uranium-ore", ["uranium-ore"] = "uranium-ore", ["uranium_ore"] = "uranium-ore", ["o"] = "crude-oil", ["oil"] = "crude-oil", ["crude-oil"] = "crude-oil", ["crude_oil"] = "crude-oil", ["square"] = "square", ["magic-square"] = "square", ["magic_square"] = "square", ["magic"] = "square" } commands.add_command('find', 'finds the nearest patch of given resource', function(command) local player = game.players[command.player_index] if isValid(player) and player.admin then local resource = command.parameter if resources[resource] then find_patch.findPatch(resources[resource], find_patch.range, player) end else player.print("[color=red]admin only...[/color]") end end) return find_patch
love.filesystem.require("Server.lua") lastevnt = "" time = 0 function connCallback(ip, port) lastevnt = "Client " .. ip .. " connected." end function rcvCallback(data, ip, port) lastevnt = "Client " .. ip .. " sent: " .. data end function disconnCallback(ip, port) lastevnt = "Client " .. ip .. " disconnected." end server:Init(9090) server:setPing(true, 3, "ping") server:setHandshake("Hi") --useless in with this beta LUBE binary (copy-protection) server:setCallback(rcvCallback, connCallback, disconnCallback) function keypressed(key) if key == love.key_q or key == love.key_escape then love.system.exit() end end function update(dt) server:update() server:checkPing(dt) time = time + dt if time > 15 then server:send("LUBE: A smooth experience across the world") time = 0 end end function draw() text = "Last event:" love.graphics.draw(text, center.x - fontd.width*#text/2, center.y - fontd.height/2) love.graphics.draw(lastevnt, center.x - fontd.width*#lastevnt/2, center.y + fontd.height/2) end
local menuroot = menu.my_root() local menuAction = menu.action local menuToggle = menu.toggle local menuToggleLoop = menu.toggle_loop local joaat = util.joaat local wait = util.yield local createPed = PED.CREATE_PED local getEntityCoords = ENTITY.GET_ENTITY_COORDS local getPlayerPed = PLAYER.GET_PLAYER_PED local requestModel = STREAMING.REQUEST_MODEL local hasModelLoaded = STREAMING.HAS_MODEL_LOADED local noNeedModel = STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED local setPedCombatAttr = PED.SET_PED_COMBAT_ATTRIBUTES local giveWeaponToPed = WEAPON.GIVE_WEAPON_TO_PED WhiteText = {r = 1.0, g = 1.0, b = 1.0, a = 1.0} ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISC FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function GetLocalPed() return PLAYER.PLAYER_PED_ID() end function ToastCoordinates(v3coords) util.toast(v3coords.x .. " || " .. v3coords.y .. " || " .. v3coords.z) end function SE_add_explosion(x, y, z, exptype, dmgscale, isheard, isinvis, camshake, nodmg) FIRE.ADD_EXPLOSION(x, y, z, exptype, dmgscale, isheard, isinvis, camshake, nodmg) end function SE_add_owned_explosion(ped, x, y, z, exptype, dmgscale, isheard, isinvis, camshake) FIRE.ADD_OWNED_EXPLOSION(ped, x, y, z, exptype, dmgscale, isheard, isinvis, camshake) end function DistanceBetweenTwoCoords(v3_1, v3_2) local distance = math.sqrt(((v3_2.x - v3_1.x)^2) + ((v3_2.y - v3_1.y)^2) + ((v3_2.z - v3_1.z)^2)) return distance end function GetPlayerName_ped(ped) local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(ped) local playerName = NETWORK.NETWORK_PLAYER_GET_NAME(playerID) return playerName end function GetPlayerName_pid(pid) local playerName = NETWORK.NETWORK_PLAYER_GET_NAME(pid) return playerName end --thank you to: https://easings.net for the functions! function EaseOutCubic(x) return 1 - ((1-x) ^ 3) end function EaseInCubic(x) return x * x * x end function EaseInOutCubic(x) --Thank you QUICKNET for re-writing this function! if(x < 0.5) then return 4 * x * x * x; else return 1 - ((-2 * x + 2) ^ 3) / 2 end end function GetTableFromV3Instance(v3int) local tbl = {x = v3.getX(v3int), y = v3.getY(v3int), z = v3.getZ(v3int)} return tbl end function DoesTableContainValue(table, value) for _, v in pairs(table) do if v == value then return true end end return false end function GetValueIndexFromTable(table, value) for i, v in pairs(table) do if v == value then return i end end return nil end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISC FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- CAM FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function SmoothTeleportToCord(v3coords, teleportFrame) local wppos = v3coords local localped = getPlayerPed(players.user()) if wppos ~= nil then --cam setup here if not CAM.DOES_CAM_EXIST(CCAM) then CAM.DESTROY_ALL_CAMS(true) CCAM = CAM.CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", true) CAM.SET_CAM_ACTIVE(CCAM, true) CAM.RENDER_SCRIPT_CAMS(true, false, 0, true, true, 0) end -- if teleportFrame then util.create_tick_handler(function () if CAM.DOES_CAM_EXIST(CCAM) then local tickCamCoord = CAM.GET_CAM_COORD(CCAM) if not PED.IS_PED_IN_ANY_VEHICLE(localped, true) then --if they not in a vehicle ENTITY.SET_ENTITY_COORDS(localped, tickCamCoord.x, tickCamCoord.y, tickCamCoord.z, false, false, false, false) --teleport the player else local veh = PED.GET_VEHICLE_PED_IS_IN(localped, false) ENTITY.SET_ENTITY_COORDS(veh, tickCamCoord.x, tickCamCoord.y, tickCamCoord.z, false, false, false, false) --teleport the vehicle end else return false end end) end -- local pc = getEntityCoords(getPlayerPed(players.user())) -- for i = 0, 1, STP_SPEED_MODIFIER do --make the cam move up here CAM.SET_CAM_COORD(CCAM, pc.x, pc.y, pc.z + EaseOutCubic(i) * STP_COORD_HEIGHT) directx.draw_text(0.5, 0.5, tostring(EaseOutCubic(i) * STP_COORD_HEIGHT), 1, 0.6, WhiteText, false) local look = util.v3_look_at(CAM.GET_CAM_COORD(CCAM), pc) CAM.SET_CAM_ROT(CCAM, look.x, look.y, look.z, 2) wait() end --CAM.DO_SCREEN_FADE_OUT(1000) --fade out the screen ------------ local currentZ = CAM.GET_CAM_COORD(CCAM).z local coordDiffx = wppos.x - pc.x local coordDiffxy = wppos.y - pc.y for i = 0, 1, STP_SPEED_MODIFIER / 2 do --make the camera on x/y plane CAM.SET_CAM_COORD(CCAM, pc.x + (EaseInOutCubic(i) * coordDiffx), pc.y + (EaseInOutCubic(i) * coordDiffxy), currentZ) wait() end -- local groundZ = PATHFIND.GET_APPROX_HEIGHT_FOR_POINT(wppos.x, wppos.y) -- ENTITY.SET_ENTITY_COORDS(localped, wppos.x, wppos.y, groundZ, false, false, false, false) local success, ground_z repeat STREAMING.REQUEST_COLLISION_AT_COORD(wppos.x, wppos.y, wppos.z) success, ground_z = util.get_ground_z(wppos.x, wppos.y) util.yield() until success if not PED.IS_PED_IN_ANY_VEHICLE(localped, true) then --if they not in a vehicle ENTITY.SET_ENTITY_COORDS(localped, wppos.x, wppos.y, ground_z, false, false, false, false) --teleport the player else local veh = PED.GET_VEHICLE_PED_IS_IN(localped, false) local v3Out = memory.alloc() local headOut = memory.alloc() PATHFIND.GET_CLOSEST_VEHICLE_NODE_WITH_HEADING(wppos.x, wppos.y, ground_z, v3Out, headOut, 1, 3.0, 0) local head = memory.read_float(headOut) memory.free(headOut) memory.free(v3Out) ENTITY.SET_ENTITY_COORDS(veh, wppos.x, wppos.y, ground_z, false, false, false, false) --teleport the vehicle ENTITY.SET_ENTITY_HEADING(veh, head) end wait() local pc2 = getEntityCoords(getPlayerPed(players.user())) local coordDiffz = CAM.GET_CAM_COORD(CCAM).z - ground_z -2 local camcoordz = CAM.GET_CAM_COORD(CCAM).z --CAM.DO_SCREEN_FADE_IN(2000) --fade in the screen for i = 0, 1, STP_SPEED_MODIFIER / 2 do --move the camera down local pc23 = getEntityCoords(getPlayerPed(players.user()))-- extra for x/y CAM.SET_CAM_COORD(CCAM, pc23.x, pc23.y, camcoordz - (EaseOutCubic(i) * coordDiffz)) wait() end ------------- ---- wait() --camera deletion here CAM.RENDER_SCRIPT_CAMS(false, false, 0, true, true, 0) if CAM.IS_CAM_ACTIVE(CCAM) then CAM.SET_CAM_ACTIVE(CCAM, false) end CAM.DESTROY_CAM(CCAM, true) else util.toast("No waypoint set!") end end function SmoothTeleportToVehicle(pedInVehicle) local wppos = getEntityCoords(pedInVehicle) local localped = getPlayerPed(players.user()) --check for emtpy seats local maxPassengers = VEHICLE.GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(veh) local seatFree = false local continueQ local veh = PED.GET_VEHICLE_PED_IS_IN(pedInVehicle, false) for i = -1, maxPassengers do --check for empty seats seatFree = VEHICLE.IS_VEHICLE_SEAT_FREE(veh, i, false) if seatFree then continueQ = true end end if seatFree == false then util.toast("No seats available in said vehicle.") continueQ = false end -- > -- if wppos ~= nil then --cam setup here if not CAM.DOES_CAM_EXIST(CCAM) then CAM.DESTROY_ALL_CAMS(true) CCAM = CAM.CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", true) CAM.SET_CAM_ACTIVE(CCAM, true) CAM.RENDER_SCRIPT_CAMS(true, false, 0, true, true, 0) end -- local pc = getEntityCoords(getPlayerPed(players.user())) -- for i = 0, 1, STP_SPEED_MODIFIER do --make the cam move up here CAM.SET_CAM_COORD(CCAM, pc.x, pc.y, pc.z + EaseOutCubic(i) * STP_COORD_HEIGHT) directx.draw_text(0.5, 0.5, tostring(EaseOutCubic(i) * STP_COORD_HEIGHT), 1, 0.6, WhiteText, false) local look = util.v3_look_at(CAM.GET_CAM_COORD(CCAM), pc) CAM.SET_CAM_ROT(CCAM, look.x, look.y, look.z, 2) wait() end --CAM.DO_SCREEN_FADE_OUT(1000) --fade out the screen ------------ local currentZ = CAM.GET_CAM_COORD(CCAM).z local coordDiffx = wppos.x - pc.x local coordDiffxy = wppos.y - pc.y for i = 0, 1, STP_SPEED_MODIFIER / 2 do --make the camera on x/y plane CAM.SET_CAM_COORD(CCAM, pc.x + (EaseInOutCubic(i) * coordDiffx), pc.y + (EaseInOutCubic(i) * coordDiffxy), currentZ) wait() end PED.SET_PED_INTO_VEHICLE(localped, veh, i) if continueQ then wait() local pc2 = getEntityCoords(getPlayerPed(players.user())) local coordDiffz = CAM.GET_CAM_COORD(CCAM).z - pc2.z local camcoordz = CAM.GET_CAM_COORD(CCAM).z --CAM.DO_SCREEN_FADE_IN(2000) --fade in the screen for i = 0, 1, STP_SPEED_MODIFIER / 2 do --move the camera down local pc23 = getEntityCoords(pedInVehicle)-- extra for x/y CAM.SET_CAM_COORD(CCAM, pc23.x, pc23.y, camcoordz - (EaseOutCubic(i) * coordDiffz)) wait() end end wait() --camera deletion here CAM.RENDER_SCRIPT_CAMS(false, false, 0, true, true, 0) if CAM.IS_CAM_ACTIVE(CCAM) then CAM.SET_CAM_ACTIVE(CCAM, false) end CAM.DESTROY_CAM(CCAM, true) else util.toast("No waypoint set!") end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- CAM FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- NETWORK FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function FastNet(entity, playerID) local netID = NETWORK.NETWORK_GET_NETWORK_ID_FROM_ENTITY(entity) NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then for i = 1, 30 do if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) wait(10) else goto continue end end end ::continue:: if SE_Notifications then util.toast("Has control.") end NETWORK.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID(netID) wait(10) NETWORK.SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(netID) wait(10) NETWORK.SET_NETWORK_ID_CAN_MIGRATE(netID, false) wait(10) NETWORK.SET_NETWORK_ID_ALWAYS_EXISTS_FOR_PLAYER(netID, playerID, true) wait(10) ENTITY.SET_ENTITY_AS_MISSION_ENTITY(entity, true, false) wait(10) ENTITY._SET_ENTITY_CLEANUP_BY_ENGINE(entity, false) wait(10) if ENTITY.IS_ENTITY_AN_OBJECT(entity) then NETWORK.OBJ_TO_NET(entity) end wait(10) if BA_visible then ENTITY.SET_ENTITY_VISIBLE(entity, true, 0) else ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) wait() ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) wait() ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) end end function NetIt(entity, playerID) local netID = NETWORK.NETWORK_GET_NETWORK_ID_FROM_ENTITY(entity) NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then for i = 1, 100 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) wait(50) end else if SE_Notifications then util.toast("Has control.") end end wait(10) NETWORK.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID(netID) wait(10) NETWORK.SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(netID) wait(10) NETWORK.SET_NETWORK_ID_CAN_MIGRATE(netID, false) wait(10) NETWORK.SET_NETWORK_ID_ALWAYS_EXISTS_FOR_PLAYER(netID, playerID, true) wait(10) ENTITY.SET_ENTITY_AS_MISSION_ENTITY(entity, true, false) wait(10) ENTITY._SET_ENTITY_CLEANUP_BY_ENGINE(entity, false) wait(10) if ENTITY.IS_ENTITY_AN_OBJECT(entity) then NETWORK.OBJ_TO_NET(entity) end wait(10) if BA_visible then ENTITY.SET_ENTITY_VISIBLE(entity, true, 0) else ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) wait() ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) wait() ENTITY.SET_ENTITY_VISIBLE(entity, false, 0) end end function GetGamerHandleFromPlayer(playerID) local gmr_hndl = memory.alloc(104) NETWORK.NETWORK_HANDLE_FROM_PLAYER(playerID, gmr_hndl, 13) if NETWORK.NETWORK_IS_HANDLE_VALID(gmr_hndl, 13) then local gamerHandle = gmr_hndl memory.free(gmr_hndl) return gamerHandle else memory.free(gmr_hndl) util.toast("GamerHandle failed!") return nil end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- NETWORK FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- POSITION FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function Get_Waypoint_Pos2() if HUD.IS_WAYPOINT_ACTIVE() then local blip = HUD.GET_FIRST_BLIP_INFO_ID(8) local waypoint_pos = HUD.GET_BLIP_COORDS(blip) return waypoint_pos else util.toast("NO_WAYPOINT_SET") end end function GetClosestPlayerWithRange(range) local pedPointers = entities.get_all_peds_as_pointers() local rangesq = range * range local ourCoords = getEntityCoords(GetLocalPed()) local tbl = {} local closest_player = 0 for i = 1, #pedPointers do local tarcoords = entities.get_position(pedPointers[i]) local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if vdist <= rangesq then tbl[#tbl+1] = entities.pointer_to_handle(pedPointers[i]) end end if tbl ~= nil then local dist = 999999 for i = 1, #tbl do if tbl[i] ~= GetLocalPed() then if PED.IS_PED_A_PLAYER(tbl[i]) then local tarcoords = getEntityCoords(tbl[i]) local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if e < dist then dist = e closest_player = tbl[i] end end end end end if closest_player ~= 0 then return closest_player else return nil end end function GetClosestPlayerWithRange_Whitelist(range, inair) --variation of getClosestPlayerWithinRange to work with my whitelisting feature for silent aimbot local pedPointers = entities.get_all_peds_as_pointers() local rangesq = range * range local ourCoords = getEntityCoords(GetLocalPed()) local tbl = {} local closest_player = 0 for i = 1, #pedPointers do local tarcoords = entities.get_position(pedPointers[i]) local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if vdist <= rangesq then local handle = entities.pointer_to_handle(pedPointers[i]) if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then --air check local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle) if not AIM_WHITELIST[playerID] then --this is the whitelist check. tbl[#tbl+1] = handle end end end end if tbl ~= nil then local dist = 999999 for i = 1, #tbl do if tbl[i] ~= GetLocalPed() then if PED.IS_PED_A_PLAYER(tbl[i]) then local tarcoords = getEntityCoords(tbl[i]) local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if e < dist then dist = e closest_player = tbl[i] end end end end end if closest_player ~= 0 then return closest_player else return nil end end function GetSuitableAimbotTarget(fov, fovcheck, dist, loscheck) local ourped = GetLocalPed() local distsq = dist * dist local ourc = getEntityCoords(ourped) local entTable = entities.get_all_peds_as_pointers() local inRange = {} for _, entity in pairs(entTable) do local entpos = entities.get_position(entity) if SYSTEM.VDIST2(ourc.x, ourc.y, ourc.z, entpos.x, entpos.y, entpos.z) <= distsq then --distance check local handle = entities.pointer_to_handle(entity) if (handle ~= ourped) then if (not PED.IS_PED_DEAD_OR_DYING(handle)) and (INTERIOR.GET_INTERIOR_FROM_ENTITY(handle) == 0) then --dead/interior check if (fovcheck and PED.IS_PED_FACING_PED(ourped, handle, fov)) or (not fovcheck) then --fov check if (PED.IS_PED_A_PLAYER(handle)) and (not AIM_WHITELIST[NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle)]) then --whitelist, player check if (loscheck and ENTITY.HAS_ENTITY_CLEAR_LOS_TO_ENTITY(ourped, handle, 17)) or (not loscheck) then --line-of-sight check inRange[#inRange+1] = handle end end end end end end end local retplayer local d = 99999999999 if #inRange ~= 0 then for _, ped in pairs(inRange) do local tc = getEntityCoords(ped) local vidsti = SYSTEM.VDIST2(ourc.x, ourc.y, ourc.z, tc.x, tc.y, tc.z) if vidsti < d then retplayer = ped d = vidsti end end return retplayer end return nil end function ShootSingleBulletBetweenCoords(coords1, coords2, dmg, weaponhash, ownerped, audible, invisible, speed) MISC.SHOOT_SINGLE_BULLET_BETWEEN_COORDS( coords1.x, coords1.y, coords1.z, coords2.x, coords2.y, coords2.z, dmg, true, weaponhash, ownerped, audible, invisible, speed) end function ShootBulletAtPedBone(ped, boneID, dmg, weaponHash, speed) local bonecoords = PED.GET_PED_BONE_COORDS(ped, boneID, 0, 0, 0) local ourped = GetLocalPed() local ourhead = PED.GET_PED_BONE_COORDS(ourped, 12844, 0, 0, 0); local ourfront = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ourped, 0, 1, 0) ourfront.z = ourhead.z --to shoot out of infront of our head ShootSingleBulletBetweenCoords(ourfront, bonecoords, dmg, weaponHash, ourped, true, false, speed) end function GetClosestPlayerWithRange_Whitelist_DisallowEntities(range, disallowedEntities, inair) --variation of GetClosestPlayerWithRange_Whitelist, that makes entities not returned if they are in the table. local pedPointers = entities.get_all_peds_as_pointers() local rangesq = range * range local ourCoords = getEntityCoords(GetLocalPed()) local tbl = {} local closest_player = 0 for i = 1, #pedPointers do local tarcoords = entities.get_position(pedPointers[i]) local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if vdist <= rangesq then local handle = entities.pointer_to_handle(pedPointers[i]) local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle) if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then --air check if not AIM_WHITELIST[playerID] then --this is the whitelist check. if not DoesTableContainValue(disallowedEntities, handle) then --this is the disallowed entities table check tbl[#tbl+1] = handle end end end end end if tbl ~= nil then local dist = 999999 for i = 1, #tbl do if tbl[i] ~= GetLocalPed() then if PED.IS_PED_A_PLAYER(tbl[i]) then local tarcoords = getEntityCoords(tbl[i]) local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if e < dist then dist = e closest_player = tbl[i] end end end end end if closest_player ~= 0 then return closest_player else return nil end end function GetClosestNonPlayerPedWithRange(range) local pedPointers = entities.get_all_peds_as_pointers() local rangesq = range * range local ourCoords = getEntityCoords(GetLocalPed()) local tbl = {} local closest_ped = 0 for i = 1, #pedPointers do local tarcoords = entities.get_position(pedPointers[i]) local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if vdist <= rangesq then tbl[#tbl+1] = entities.pointer_to_handle(pedPointers[i]) end end if tbl ~= nil then local dist = 999999 for i = 1, #tbl do if tbl[i] ~= GetLocalPed() then if not PED.IS_PED_A_PLAYER(tbl[i]) then local tarcoords = getEntityCoords(tbl[i]) local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if e < dist then dist = e closest_ped = tbl[i] end end end end end if closest_ped ~= 0 then return closest_ped else return nil end end function GetClosestNonPlayerPedWithRange_DisallowedEntities(range, disallowedEntities, inair) --modified version of GetClosestNonPlayerPedWithRange that takes a table of disallowed entities (blacklisted peds) local pedPointers = entities.get_all_peds_as_pointers() local rangesq = range * range local ourCoords = getEntityCoords(GetLocalPed()) local tbl = {} local closest_ped = 0 for i = 1, #pedPointers do local tarcoords = entities.get_position(pedPointers[i]) local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if vdist <= rangesq then local handle = entities.pointer_to_handle(pedPointers[i]) if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then if not DoesTableContainValue(disallowedEntities, handle) then tbl[#tbl+1] = handle end end end end if tbl ~= nil then local dist = 999999 for i = 1, #tbl do if tbl[i] ~= GetLocalPed() then if not PED.IS_PED_A_PLAYER(tbl[i]) then local tarcoords = getEntityCoords(tbl[i]) local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z) if e < dist then dist = e closest_ped = tbl[i] end end end end end if closest_ped ~= 0 then return closest_ped else return nil end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- POSITION FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MODEL FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function RqModel (hash) STREAMING.REQUEST_MODEL(hash) local count = 0 util.toast("Requesting model...") while not STREAMING.HAS_MODEL_LOADED(hash) and count < 100 do STREAMING.REQUEST_MODEL(hash) count = count + 1 wait(10) end if not STREAMING.HAS_MODEL_LOADED(hash) then util.toast("Tried for 1 second, couldn't load this specified model!") end end function SpawnPedOnPlayer(hash, pid) RqModel(hash) local lc = getEntityCoords(getPlayerPed(pid)) local pe = entities.create_ped(26, hash, lc, 0) STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash) return pe end function SpawnObjectOnPlayer(hash, pid) RqModel(hash) local lc = getEntityCoords(getPlayerPed(pid)) local ob = entities.create_object(hash, lc) STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash) return ob end function SpawnPickupOnPlayer(pickuphash, modelhash, value, pid) RqModel(modelhash) local pc = getEntityCoords(getPlayerPed(pid)) OBJECT.CREATE_PICKUP(pickuphash, pc.x, pc.y, pc.z, 99999, value, true, modelhash) end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MODEL FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- SUICIDE FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function MakePlayerExplodeSuicide(pid) local playerPed = getPlayerPed(pid) local playerCoords = getEntityCoords(playerPed) -- checks for interior, godmode, and vehicle all in one if / elseif statement... if players.is_godmode(pid) and not players.is_in_interior(pid) then util.toast("Player is in godmode, stopping explode...") elseif players.is_in_interior(pid) then util.toast("Player is in an interior, stopping explode...") elseif PED.IS_PED_IN_ANY_VEHICLE(playerPed, true) then for i = 0, 50, 1 do --50 explosions to account for armored vehicles, using type 5, as a tank shell as well xD SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 5, 10, SEisExploAudible, SEisExploInvis, 0) wait(10) end else SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 1, 10, SEisExploAudible, SEisExploInvis, 0) end end function MakePlayerMolotovSuicide(pid) local playerPed = getPlayerPed(pid) local playerCoords = getEntityCoords(playerPed) --checks for godmode and interior if players.is_godmode(pid) and not players.is_in_interior(pid) then util.toast("Player is in godmode, stopping explode...") elseif players.is_in_interior(pid) then util.toast("Player is in an interior, stopping explode...") else SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 3, 10, SEisExploAudible, SEisExploInvis, 0) end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- SUICIDE FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- TOXIC FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function EveryoneExplodeSuicides() for i = 0, 31, 1 do if players.exists(i) then --checks for if the PID exists in session local playerPed = getPlayerPed(i) local playerCoords = getEntityCoords(playerPed) if PED.IS_PED_IN_ANY_VEHICLE(playerPed, true) then for a = 0, 50, 1 do --50 explosions to account for armored vehicles, using type 5, as a tank shell as well xD SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 5, 10, SEisExploAudible, SEisExploInvis, 0) wait(10) end else SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 1, 10, SEisExploAudible, SEisExploInvis, 0) end end end end function PizzaCAll() for p = 0, 31, 1 do if p ~= players.user() and ENTITY.DOES_ENTITY_EXIST(getPlayerPed(p)) then for i = 1, 10 do local cord = getEntityCoords(getPlayerPed(p)) requestModel(-930879665) wait(10) requestModel(3613262246) wait(10) requestModel(452618762) wait(10) while not hasModelLoaded(-930879665) do wait() end while not hasModelLoaded(3613262246) do wait() end while not hasModelLoaded(452618762) do wait() end local a1 = entities.create_object(-930879665, cord) wait(10) local a2 = entities.create_object(3613262246, cord) wait(10) local b1 = entities.create_object(452618762, cord) wait(10) local b2 = entities.create_object(3613262246, cord) wait(300) entities.delete_by_handle(a1) entities.delete_by_handle(a2) entities.delete_by_handle(b1) entities.delete_by_handle(b2) noNeedModel(452618762) wait(10) noNeedModel(3613262246) wait(10) noNeedModel(-930879665) wait(10) end if SE_Notifications then util.toast("Finished with player // " .. tostring(PLAYER.GET_PLAYER_NAME(p)) .. " // of index " .. p) end end end end function FreemodeDeathAll() for p = 0, 31 do if p ~= players.user() and NETWORK.NETWORK_IS_PLAYER_CONNECTED(p) then for i = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << p, {-65587051, 28, i, n}) end end for i = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << p, {1445703181, 28, i, n}) end end wait(100) util.trigger_script_event(1 << p, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) util.trigger_script_event(1 << p, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) util.trigger_script_event(1 << p, {2002459655, -1000000, -10000, -100000000}) util.trigger_script_event(1 << p, {911179316, -38, -30, -75, -59, 85, 82}) end for i = -1, 1 do for a = -1, 1 do util.trigger_script_event(1 << p, {916721383, i, a, 0, 26}) end end end end TXC_SLOW = false function AIOKickAll() menu.trigger_commands("scripthost") NETWORK.NETWORK_REQUEST_TO_BE_HOST_OF_THIS_SCRIPT() for i = 0, 31 do if i ~= players.user() and NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then util.toast("Player connected " .. tostring(PLAYER.GET_PLAYER_NAME(i) .. ", commencing AIO.")) util.trigger_script_event(1 << i, {0x37437C28, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-1308840134, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x4E0350C6, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x114C63AC, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x15F5B1D4, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x249FE11B, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x76B11968, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x9C050EC, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x3B873479, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x23F74138, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) --[[ util.trigger_script_event(1 << i, {0xAD63290E, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) ]] --[[ util.trigger_script_event(1 << i, {0x39624029, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) ]] util.trigger_script_event(1 << i, {-0x529CD6F2, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x756DBC8A, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x69532BA0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x68C5399F, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x7DE8CAC0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {0x285DDF33, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << i, {-0x177132B8, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) --util.toast("Main block done. // AIO") util.trigger_script_event(1 << i, {memory.script_global(1893548 + (1 + (i * 600) + 511)), i}) for a = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << i, {-65587051, 28, a, n}) wait(10) end end --util.toast("Second block done. // AIO") for a = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << i, {1445703181, 28, a, n}) wait(10) end end --util.toast("Third block done. // AIO") if TXC_SLOW then wait(10) util.trigger_script_event(1 << i, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) wait(10) util.trigger_script_event(1 << i, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) wait(10) util.trigger_script_event(1 << i, {2002459655, -1000000, -10000, -100000000}) wait(10) util.trigger_script_event(1 << i, {911179316, -38, -30, -75, -59, 85, 82}) wait(10) --[[ for n = -10, -7 do for a = -60, 60 do util.trigger_script_event(1 << i, {0x39624029, n, 623656, a, 73473741, -7, 856844, -51251, 856844}) wait(10) end end ]] util.trigger_script_event(1 << i, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) wait(10) util.trigger_script_event(1 << i, {-1386010354, 91645, -99683, 1788, 60877, 55085, 72028}) wait(10) util.trigger_script_event(1 << i, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) wait(10) for g = -28, 0 do for n = -1, 1 do for a = -1, 1 do util.trigger_script_event(1 << i, {1445703181, i, n, a}) end end wait(10) end --[[for a = -28, 20 do for n = -10, 2 do for b = -100, 100 do util.trigger_script_event(1 << i, {-1782442696, b, n, a}) util.log("Number 6, iteration " .. b) end util.log("Number 7, iteration " .. n) end util.log("Number 8, iteration " .. a) wait(10) end]] for a = -11, 11 do util.trigger_script_event(1 << i, {2002459655, -1000000, a, -100000000}) end for a = -10, 10 do for n = 30, -30 do util.trigger_script_event(1 << i, {911179316, a, n, -75, -59, 85, 82}) end end for a = -10, 10 do util.trigger_script_event(1 << i, {-65587051, a, -1, -1}) end util.trigger_script_event(1 << i, {951147709, i, 1000000, nil, nil}) for a = -10, 10 do util.trigger_script_event(1 << i, {-1949011582, a, 1518380048}) end for a = -10, 4 do for n = -10, 5 do util.trigger_script_event(1 << i, {1445703181, 28, a, n}) end end end util.toast("Fourth block done. // AIO") util.toast("Iteration " .. i .. " complete of AIO kick.") util.toast("Player " .. PLAYER.GET_PLAYER_NAME(i) .. " done.") end end wait(100) end function FreemodeDeathPlayer(pid) for i = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << pid, {-65587051, 28, i, n}) end end for i = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << pid, {1445703181, 28, i, n}) end end wait(100) util.trigger_script_event(1 << pid, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) util.trigger_script_event(1 << pid, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) util.trigger_script_event(1 << pid, {2002459655, -1000000, -10000, -100000000}) util.trigger_script_event(1 << pid, {911179316, -38, -30, -75, -59, 85, 82}) for i = -1, 1 do for a = -1, 1 do util.trigger_script_event(1 << pid, {916721383, i, a, 0, 26}) end end end function AIOKickPlayer(pid) if SE_Notifications then util.toast("Player connected " .. tostring(PLAYER.GET_PLAYER_NAME(pid) .. ", commencing AIO.")) end util.trigger_script_event(1 << pid, {0x37437C28, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-1308840134, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x4E0350C6, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x114C63AC, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x15F5B1D4, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x249FE11B, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x76B11968, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x9C050EC, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x3B873479, 1, 15, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x23F74138, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) --[[ util.trigger_script_event(1 << pid, {0xAD63290E, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) ]] --[[ util.trigger_script_event(1 << pid, {0x39624029, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) ]] util.trigger_script_event(1 << pid, {-0x529CD6F2, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x756DBC8A, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x69532BA0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x68C5399F, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x7DE8CAC0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {0x285DDF33, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) util.trigger_script_event(1 << pid, {-0x177132B8, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)}) wait(10) --util.toast("Main block done. // AIO") util.trigger_script_event(1 << pid, {memory.script_global(1893548 + (1 + (pid * 600) + 511)), pid}) for a = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << pid, {-65587051, 28, a, n}) wait(10) end end --util.toast("Second block done. // AIO") for a = -1, 1 do for n = -1, 1 do util.trigger_script_event(1 << pid, {1445703181, 28, a, n}) wait(10) end end --util.toast("Third block done. // AIO") if TXC_SLOW then wait(10) util.trigger_script_event(1 << pid, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) wait(10) util.trigger_script_event(1 << pid, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) wait(10) util.trigger_script_event(1 << pid, {2002459655, -1000000, -10000, -100000000}) wait(10) util.trigger_script_event(1 << pid, {911179316, -38, -30, -75, -59, 85, 82}) wait(10) --[[ for n = -10, -7 do for a = -60, 60 do util.trigger_script_event(1 << pid, {0x39624029, n, 623656, a, 73473741, -7, 856844, -51251, 856844}) wait(10) end end]] util.trigger_script_event(1 << pid, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112}) wait(10) util.trigger_script_event(1 << pid, {-1386010354, 91645, -99683, 1788, 60877, 55085, 72028}) wait(10) util.trigger_script_event(1 << pid, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000}) wait(10) for g = -28, 0 do for n = -1, 1 do for a = -1, 1 do util.trigger_script_event(1 << pid, {1445703181, g, n, a}) end end wait(10) end --[[for a = -28, 20 do for n = -10, 2 do for b = -100, 100 do util.trigger_script_event(1 << pid, {-1782442696, b, n, a}) util.log("Number 6, iteration " .. b) end util.log("Number 7, iteration " .. n) end util.log("Number 8, iteration " .. a) wait(10) end]] for a = -11, 11 do util.trigger_script_event(1 << pid, {2002459655, -1000000, a, -100000000}) end for a = -10, 10 do for n = 30, -30 do util.trigger_script_event(1 << pid, {911179316, a, n, -75, -59, 85, 82}) end end for a = -10, 10 do util.trigger_script_event(1 << pid, {-65587051, a, -1, -1}) end util.trigger_script_event(1 << pid, {951147709, pid, 1000000, nil, nil}) for a = -10, 10 do util.trigger_script_event(1 << pid, {-1949011582, a, 1518380048}) end for a = -10, 4 do for n = -10, 5 do util.trigger_script_event(1 << pid, {1445703181, 28, a, n}) end end end if SE_Notifications then util.toast("Fourth block done. // AIO") util.toast("Iteration " .. pid .. " complete of AIO kick.") util.toast("Player " .. PLAYER.GET_PLAYER_NAME(pid) .. " done.") end end function PlagueCrashPlayer(pid) for i = 1, 10 do local cord = getEntityCoords(getPlayerPed(pid)) requestModel(-930879665) wait(10) requestModel(3613262246) wait(10) requestModel(452618762) wait(10) while not hasModelLoaded(-930879665) do wait() end while not hasModelLoaded(3613262246) do wait() end while not hasModelLoaded(452618762) do wait() end local a1 = entities.create_object(-930879665, cord) wait(10) local a2 = entities.create_object(3613262246, cord) wait(10) local b1 = entities.create_object(452618762, cord) wait(10) local b2 = entities.create_object(3613262246, cord) wait(300) entities.delete_by_handle(a1) entities.delete_by_handle(a2) entities.delete_by_handle(b1) entities.delete_by_handle(b2) noNeedModel(452618762) wait(10) noNeedModel(3613262246) wait(10) noNeedModel(-930879665) wait(10) end if SE_Notifications then util.toast("Finished.") end end function BadOutfitCrash(pid) RqModel(0x705E61F2) local pc = getEntityCoords(getPlayerPed(pid)) local ped = PED.CREATE_PED(26, 0x705E61F2, pc.x, pc.y, pc.z, 0, true, false) NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(ped) PED.SET_PED_COMPONENT_VARIATION(ped, 0, 45, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 1, 197, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 2, 76, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 3, 196, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 4, 144, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 5, 99, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 6, 102, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 7, 151, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 8, 189, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 9, 56, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 10, 132, 0, 0) PED.SET_PED_COMPONENT_VARIATION(ped, 11, 393, 0, 0) wait(2000) entities.delete_by_handle(ped) end function BadNetVehicleCrash(pid) local hashes = {1492612435, 3517794615, 3889340782, 3253274834} local vehicles = {} for i = 1, 4 do util.create_thread(function() RqModel(hashes[i]) local pcoords = getEntityCoords(getPlayerPed(pid)) local veh = VEHICLE.CREATE_VEHICLE(hashes[i], pcoords.x, pcoords.y, pcoords.z, math.random(0, 360), true, true, false) for a = 1, 20 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) end VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0) for j = 0, 49 do local mod = VEHICLE.GET_NUM_VEHICLE_MODS(veh, j) - 1 VEHICLE.SET_VEHICLE_MOD(veh, j, mod, true) VEHICLE.TOGGLE_VEHICLE_MOD(veh, mod, true) end for j = 0, 20 do if VEHICLE.DOES_EXTRA_EXIST(veh, j) then VEHICLE.SET_VEHICLE_EXTRA(veh, j, true) end end VEHICLE.SET_VEHICLE_TYRES_CAN_BURST(veh, false) VEHICLE.SET_VEHICLE_WINDOW_TINT(veh, 1) VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(veh, 1) VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, " ") for ai = 1, 50 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) pcoords = getEntityCoords(getPlayerPed(pid)) ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, pcoords.x, pcoords.y, pcoords.z, false, false, false) util.yield() end vehicles[#vehicles+1] = veh end) end wait(2000) util.toast("finished.") for _, v in pairs(vehicles) do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(v) entities.delete_by_handle(v) end end function RopeCrashLobby(pid) PHYSICS.ROPE_LOAD_TEXTURES() local hashes = {2132890591, 2727244247} local pc = getEntityCoords(getPlayerPed(pid)) local veh = VEHICLE.CREATE_VEHICLE(hashes[i], pc.x + 5, pc.y, pc.z, 0, true, true, false) local ped = PED.CREATE_PED(26, hashes[2], pc.x, pc.y, pc.z + 1, 0, true, false) NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh); NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(ped) ENTITY.SET_ENTITY_INVINCIBLE(ped, true) ENTITY.SET_ENTITY_VISIBLE(ped, false, 0) ENTITY.SET_ENTITY_VISIBLE(veh, false, 0) local rope = PHYSICS.ADD_ROPE(pc.x + 5, pc.y, pc.z, 0, 0, 0, 1, 1, 0.0000000000000000000000000000000000001, 1, 1, true, true, true, 1, true, 0) local vehc = getEntityCoords(veh); local pedc = getEntityCoords(ped) PHYSICS.ATTACH_ENTITIES_TO_ROPE(rope, veh, ped, vehc.x, vehc.y, vehc.z, pedc.x, pedc.y, pedc.z, 2, 0, 0, "Center", "Center") wait(1000) NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh); NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(ped) entities.delete_by_handle(veh); entities.delete_by_handle(ped) PHYSICS.DELETE_CHILD_ROPE(rope) PHYSICS.ROPE_UNLOAD_TEXTURES() end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- TOXIC FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- OTHER LOBBY FEATURES START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function RemoveVehicleGodmodeForAll() for i = 0, 31 do if NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then local ped = getPlayerPed(i) if PED.IS_PED_IN_ANY_VEHICLE(ped, false) then local veh = PED.GET_VEHICLE_PED_IS_IN(ped, false) ENTITY.SET_ENTITY_CAN_BE_DAMAGED(veh, true) ENTITY.SET_ENTITY_INVINCIBLE(veh, false) end end end end VehTeleportLoadIterations = 20 function TeleportEveryonesVehicleToOcean() local oldcoords = getEntityCoords(GetLocalPed()) for i = 0, 31 do if NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then local ped = getPlayerPed(i) local pedCoords = getEntityCoords(ped) for c = 0, VehTeleportLoadIterations do --teleports us to them so we load their veh ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), pedCoords.x, pedCoords.y, pedCoords.z + 10, false, false, false) wait(100) end if PED.IS_PED_IN_ANY_VEHICLE(ped, false) then local veh = PED.GET_VEHICLE_PED_IS_IN(ped, false) for a = 0, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, 4500, -4400, 4, false, false, false) wait(100) end for b = 0, 10 do ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, 4500, -4400, 4, false, false, false) end end end end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), oldcoords.x, oldcoords.y, oldcoords.z, false, false, false) end function TeleportEveryonesVehicleToMazeBank() local oldcoords = getEntityCoords(GetLocalPed()) for i = 0, 31 do if NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then local pped = getPlayerPed(i) local pedCoords = getEntityCoords(pped) for c = 0, VehTeleportLoadIterations do --teleports us to them so we load their veh ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), pedCoords.x, pedCoords.y, pedCoords.z + 10, false, false, false) wait(100) end if PED.IS_PED_IN_ANY_VEHICLE(pped, false) then local veh = PED.GET_VEHICLE_PED_IS_IN(pped, false) for a = 0, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, -76, -819, 327, false, false, false) wait(100) end for b = 0, 10 do ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, -76, -819, 327, false, false, false) end end end end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), oldcoords.x, oldcoords.y, oldcoords.z, false, false, false) end function CheckLobbyForGodmode() local godcount = 0 for i = 0, 31 do if NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then local pcoords = getEntityCoords(getPlayerPed(i)) if INTERIOR.GET_INTERIOR_AT_COORDS(pcoords.x, pcoords.y, pcoords.z) == 0 then --check for non-interior. Using native for less false flags. if (not PLAYER.IS_PLAYER_READY_FOR_CUTSCENE(i)) and (not NETWORK.IS_PLAYER_IN_CUTSCENE(i)) then --check for cutscenes if players.is_godmode(i) then --check the actual god local pName = GetPlayerName_pid(i) util.toast(pName .. " is in godmode!") godcount = godcount + 1 wait(100) end end end end end util.toast(godcount .. " people in godmode!") end local join_ing = false function CheckLobbyForPlayers() local buffer = join_ing join_ing = NETWORK.NETWORK_IS_SESSION_STARTED() wait(2000) local playersTable = players.list() if buffer ~= join_ing then for i = 1, 100 do util.toast("Players in session: " .. #playersTable) util.yield(10) end end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- OTHER LOBBY FEATURES END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISSILE SPEED FEATURES START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function SetVehicleMissileSpeed(value) local offsets = {0x10D8, 0x70, 0x60, 0x58} local addr = entities.handle_to_pointer(PLAYER.PLAYER_PED_ID()) for i = 1, (#offsets - 1) do -- make sure not to read from/write to a null pointer if addr == 0 then -- got a null pointer at some point return -1.0 end addr = memory.read_long(addr + offsets[i]) end addr = addr + offsets[#offsets] if addr == 0 then return -1.0 else memory.write_float(addr, value) --memory.read_float(addr) end end function GetVehicleMissileSpeed() local offsets = {0x10D8, 0x70, 0x60, 0x58} local addr = entities.handle_to_pointer(PLAYER.PLAYER_PED_ID()) for i = 1, (#offsets - 1) do -- make sure not to read from/write to a null pointer if addr == 0 then -- got a null pointer at some point return -1.0 end addr = memory.read_long(addr + offsets[i]) end addr = addr + offsets[#offsets] if addr == 0 then return -1.0 else return memory.read_float(addr) end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISSILE SPEED FEATURES END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- VEHICLE FEATURES START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- function GetClosestVehicleNodeWithHeading(x, y, z, nodeType) local outpos = v3.new() local outHeading = memory.alloc() PATHFIND.GET_CLOSEST_VEHICLE_NODE_WITH_HEADING(x, y, z, outpos, outHeading, nodeType, 3.0, 0) local pos = GetTableFromV3Instance(outpos); local heading = memory.read_float(outHeading) memory.free(outHeading); v3.free(outpos); return pos, heading end function UpsideDownVehicleRotationWithKeys() local veh = PED.GET_VEHICLE_PED_IS_IN(GetLocalPed(), false) local vv = ENTITY.GET_ENTITY_ROTATION(veh, 2) --Pitch: X || Roll: y || Yaw: z local vvPitch = v3.getX(vv) local vvRoll = v3.getY(vv) local vvYaw = v3.getZ(vv) ENTITY.SET_ENTITY_ROTATION(veh, 10, 179.5, vvYaw, 2, true) --rotation logic (left-right || YAW) if PAD.IS_CONTROL_PRESSED(0, 63) then --63 || INPUT_VEH_MOVE_LEFT_ONLY || A local yawAfterPress = vvYaw + 3 if yawAfterPress > 180 then -- check for overflow local overFlowNeg = math.abs(vvYaw)*-1 --negative bypass overflow local toSetYaw = overFlowNeg + 3 ENTITY.SET_ENTITY_ROTATION(veh, 10 --[[10]], 179.5, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, 10 --[[10]], 179.5, yawAfterPress, 2, true) end end if PAD.IS_CONTROL_PRESSED(0, 64) then --64 ||INPUT_VEH_MOVE_RIGHT_ONLY || D local yawAfterPress = vvYaw - 3 if yawAfterPress < -180 then -- check for overflow local overFlowNeg = math.abs(vvYaw) --positive bypass overflow local toSetYaw = overFlowNeg - 3 ENTITY.SET_ENTITY_ROTATION(veh, 10 --[[10]], 179.5, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, 10 --[[10]], 179.5, yawAfterPress, 2, true) end end if PAD.IS_CONTROL_PRESSED(0, 62) then --62 || INPUT_VEH_MOVE_DOWN_ONLY || LEFT CTRL / NUM5 (NOSE UP) local pitchAfterPress = vvPitch + 5 if pitchAfterPress > 90 then --check for overflow --if pitch = 89, we add 3, we will get 88 for pitch. Distance to 90, then sub the rest. local pitchToSub = 90 - (3 - math.abs(90 - vvPitch)) ENTITY.SET_ENTITY_ROTATION(veh, pitchToSub, 179.9, vvYaw) else --if not overflowed, then we just add. ENTITY.SET_ENTITY_ROTATION(veh, pitchAfterPress, 179.9, vvYaw) end end v3.free(vv) end function FastTurnVehicleWithKeys(scale) local veh = PED.GET_VEHICLE_PED_IS_IN(GetLocalPed(), false) local vv = ENTITY.GET_ENTITY_ROTATION(veh, 2) local velocity = ENTITY.GET_ENTITY_SPEED_VECTOR(veh, true).y --Pitch: X || Roll: y || Yaw: z local vvPitch = v3.getX(vv) local vvRoll = v3.getY(vv) local vvYaw = v3.getZ(vv) if PAD.IS_CONTROL_PRESSED(0, 63) then --63 || INPUT_VEH_MOVE_LEFT_ONLY || A --OLD LOGIC || if velocity > 0 then --if velocity is greater than 0, we do usual turning logic. if PAD.IS_CONTROL_PRESSED(0, 71) or velocity > -0.1 then local yawAfterPress = vvYaw + scale if yawAfterPress > 180 then -- check for overflow local overFlowNeg = math.abs(vvYaw)*-1 --negative bypass overflow local toSetYaw = overFlowNeg + scale ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, yawAfterPress, 2, true) end elseif PAD.IS_CONTROL_PRESSED(0, 72) or velocity < -0.1 then --if not, then we do opposite turning logic. local yawAfterPress = vvYaw - scale if yawAfterPress < -180 then -- check for overflow local overFlowNeg = math.abs(vvYaw) --positive bypass overflow local toSetYaw = overFlowNeg - scale ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, yawAfterPress, 2, true) end end end if PAD.IS_CONTROL_PRESSED(0, 64) then --64 ||INPUT_VEH_MOVE_RIGHT_ONLY || D --OLD LOGIC || if velocity > 0 then --if velocity is greater than 0, we do usual turning logic. if PAD.IS_CONTROL_PRESSED(0, 71) or velocity > -0.1 then local yawAfterPress = vvYaw - scale if yawAfterPress < -180 then -- check for overflow local overFlowNeg = math.abs(vvYaw) --positive bypass overflow local toSetYaw = overFlowNeg - scale ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, yawAfterPress, 2, true) end elseif PAD.IS_CONTROL_PRESSED(0, 72) or velocity < -0.1 then --if not, then we do opposite turning logic. local yawAfterPress = vvYaw + scale if yawAfterPress > 180 then -- check for overflow local overFlowNeg = math.abs(vvYaw)*-1 --negative bypass overflow local toSetYaw = overFlowNeg + scale ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, toSetYaw, 2, true) else --if not overflow ENTITY.SET_ENTITY_ROTATION(veh, vvPitch, vvRoll, yawAfterPress, 2, true) end end end v3.free(vv) end function UnlockVehicleShoot() ::start:: local localPed = GetLocalPed() if PED.IS_PED_SHOOTING(localPed) then local pointer = memory.alloc(4) local isEntFound = PLAYER.GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(players.user(), pointer) if isEntFound then local entity = memory.read_int(pointer) if ENTITY.IS_ENTITY_A_PED(entity) and PED.IS_PED_IN_ANY_VEHICLE(entity) then local vehicle = PED.GET_VEHICLE_PED_IS_IN(entity) --------------------------------------------- NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(vehicle) if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(vehicle) then for i = 1, 20 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(vehicle) wait(100) end end if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(vehicle) then util.toast("Waited 2 secs, couldn't get control!") goto start else util.toast("Has control.") end VEHICLE.SET_VEHICLE_DOORS_LOCKED(vehicle, 1) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(vehicle, true) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(vehicle, players.user(), false) elseif ENTITY.IS_ENTITY_A_VEHICLE(entity) then NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then for i = 1, 20 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity) wait(100) end end if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then util.toast("Waited 2 secs, couldn't get control!") memory.free(pointer) goto start else if SE_Notifications then util.toast("Has control.") end end VEHICLE.SET_VEHICLE_DOORS_LOCKED(entity, 1) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(entity, false) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(entity, players.user(), false) VEHICLE.SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(veh, false) end end memory.free(pointer) end end function UnlockVehicleGetIn() ::start:: local localPed = GetLocalPed() local veh = PED.GET_VEHICLE_PED_IS_TRYING_TO_ENTER(localPed) if PED.IS_PED_IN_ANY_VEHICLE(localPed, false) then local v = PED.GET_VEHICLE_PED_IS_IN(localPed, false) VEHICLE.SET_VEHICLE_DOORS_LOCKED(v, 1) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(v, false) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(v, players.user(), false) wait() else if veh ~= 0 then NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(veh) then for i = 1, 20 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) wait(100) end end if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(veh) then util.toast("Waited 2 secs, couldn't get control!") goto start else if SE_Notifications then util.toast("Has control.") end end VEHICLE.SET_VEHICLE_DOORS_LOCKED(veh, 1) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(veh, false) VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(veh, players.user(), false) VEHICLE.SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(veh, false) end end end function TurnCarOnInstantly() local localped = GetLocalPed() if PED.IS_PED_GETTING_INTO_A_VEHICLE(localped) then local veh = PED.GET_VEHICLE_PED_IS_ENTERING(localped) if not VEHICLE.GET_IS_VEHICLE_ENGINE_RUNNING(veh) then VEHICLE.SET_VEHICLE_FIXED(veh) VEHICLE.SET_VEHICLE_ENGINE_HEALTH(veh, 1000) VEHICLE.SET_VEHICLE_ENGINE_ON(veh, true, true, false) end if VEHICLE.GET_VEHICLE_CLASS(veh) == 15 then --15 is heli VEHICLE.SET_HELI_BLADES_FULL_SPEED(veh) end end end function PlaceWallInFrontOfPlayer(pid) local ped = getPlayerPed(pid) local forwardOffset = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ped, 0, 4, 0) local pheading = ENTITY.GET_ENTITY_HEADING(ped) local hash = 309416120 requestModel(hash) while not hasModelLoaded(hash) do wait() end local a1 = OBJECT.CREATE_OBJECT(hash, forwardOffset.x, forwardOffset.y, forwardOffset.z - 1, true, true, true) ENTITY.SET_ENTITY_HEADING(a1, pheading + 90) FastNet(a1, pid) local b1 = OBJECT.CREATE_OBJECT(hash, forwardOffset.x, forwardOffset.y, forwardOffset.z + 1, true, true, true) ENTITY.SET_ENTITY_HEADING(b1, pheading + 90) FastNet(b1, pid) wait(500) entities.delete_by_handle(a1) entities.delete_by_handle(b1) end function DropVehicleOnPlayer(pid, name, invis) local ped = getPlayerPed(pid) local pc = getEntityCoords(ped) local hash = joaat(name) requestModel(hash) while not hasModelLoaded(hash) do wait() end local ourveh = VEHICLE.CREATE_VEHICLE(hash, pc.x, pc.y, pc.z + 5, 0, true, true, false) if invis then ENTITY.SET_ENTITY_VISIBLE(ourveh, false, 0) end noNeedModel(hash) wait(1200) entities.delete_by_handle(ourveh) end function TeleportPlayersVehicleToOcean(pid) local ped = getPlayerPed(pid) local pc = getEntityCoords(ped) local oldcoords = getEntityCoords(GetLocalPed()) for o = 0, 10 do ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), pc.x, pc.y, pc.z + 10, false, false, false) wait(50) end if PED.IS_PED_IN_ANY_VEHICLE(ped, false) then local veh = PED.GET_VEHICLE_PED_IS_IN(ped, false) for a = 0, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, 4500, -4400, 4, false, false, false) wait(100) end if SE_Notifications then util.toast("Teleported " .. GetPlayerName_pid(pid) .. " into the farthest ocean!") end else util.toast("Player " .. GetPlayerName_pid(pid) .. " is not in a vehicle!") end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), oldcoords.x, oldcoords.y, oldcoords.z, false, false, false) end function TeleportPlayersVehicleToMazeBank(pid) local ped = getPlayerPed(pid) local pc = getEntityCoords(ped) local oldcoords = getEntityCoords(GetLocalPed()) for o = 0, 10 do ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), pc.x, pc.y, pc.z + 10, false, false, false) wait(50) end if PED.IS_PED_IN_ANY_VEHICLE(ped, false) then local veh = PED.GET_VEHICLE_PED_IS_IN(ped, false) for a = 0, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, -76, -819, 327, false, false, false) wait(100) end if SE_Notifications then util.toast("Teleported " .. GetPlayerName_pid(pid) .. " onto the Maze Bank tower!") end else util.toast("Player " .. GetPlayerName_pid(pid) .. " is not in a vehicle!") end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(GetLocalPed(), oldcoords.x, oldcoords.y, oldcoords.z, false, false, false) end function FakeLagPlayerVehicle(pid) local ped = getPlayerPed(pid) if PED.IS_PED_IN_ANY_VEHICLE(ped) then local veh = PED.GET_VEHICLE_PED_IS_IN(ped, false) local velocity = ENTITY.GET_ENTITY_VELOCITY(veh) local oldcoords = getEntityCoords(ped) wait(500) local nowcoords = getEntityCoords(ped) for a = 1, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) wait() end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, oldcoords.x, oldcoords.y, oldcoords.z, false, false, false) wait(200) for b = 1, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) wait() end ENTITY.SET_ENTITY_VELOCITY(veh, velocity.x, velocity.y, velocity.z) for c = 1, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) wait() end ENTITY.SET_ENTITY_COORDS_NO_OFFSET(veh, nowcoords.x, nowcoords.y, nowcoords.z, false, false, false) for d = 1, 10 do NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(veh) wait() end ENTITY.SET_ENTITY_VELOCITY(veh, velocity.x, velocity.y, velocity.z) wait(500) else util.toast("Player " .. GetPlayerName_pid(pid) .. " is not in a vehicle!") end end ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- VEHICLE FEATURES END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- TOOL FEATURES START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- local function tpTableToPlayer(tbl, pid) if NETWORK.NETWORK_IS_PLAYER_CONNECTED(pid) then local c = getEntityCoords(getPlayerPed(pid)) for _, v in pairs(tbl) do if (not PED.IS_PED_A_PLAYER(v)) then ENTITY.SET_ENTITY_COORDS_NO_OFFSET(v, c.x, c.y, c.z, false, false, false) end end end end function TpAllPeds(player) local pedHandles = entities.get_all_peds_as_handles() tpTableToPlayer(pedHandles, player) end function TpAllVehs(player) local vehHandles = entities.get_all_vehicles_as_handles() tpTableToPlayer(vehHandles, player) end function TpAllObjects(player) local objHandles = entities.get_all_objects_as_handles() tpTableToPlayer(objHandles, player) end function TpAllPickups(player) local pickupHandles = entities.get_all_pickups_as_handles() tpTableToPlayer(pickupHandles, player) end
include("sh_skill.lua") function Skill:Activate( caster, cleverData ) --if (self.cast > 0) then caster:SetCasting( self.cast ) end --SETCASTING USED TWICE TODO local ent = self:CreateEntity( caster, cleverData ) if (self:GetCastUntilRelease()) then caster:SetCasting( self, true, ent ) end caster:ApplyCooldown( self, self:GetCooldown() ) end function Skill:Deactivate( ent ) if (!IsValid(ent)) then return end --todo maybe call hook ent:Remove() ent:GetCaster():ApplyCooldown( self, self:GetCooldown() ) end function Skill:CreateEntity( caster, cleverData ) local skillEnt = ents.Create("element_skill") skillEnt:SetSkill( self ) skillEnt:SetCaster( caster ) if self:GetCastUntilRelease() then skillEnt:SetMaxLive( caster:GetFuel( self ) ) else skillEnt:SetMaxLive( self.maxlive ) end skillEnt:SetName(self.name) self:Spawn( skillEnt, caster, cleverData ) skillEnt:Spawn() skill_manager.NewInstance( skillEnt ) return skillEnt end function Skill:CreateChildEntity( ent, offset, angle ) offset = offset or _VECTOR.ZERO local skillChild = ents.Create("element_skillChild") skillChild:SetName( self.name ) skillChild:SetPos( ent:GetPos() + offset ) if angle then skillChild:SetAngles(angle) end skillChild:SetParent( ent, 0 ) skillChild:Spawn() return skillChild end function Skill:Spawn( ent, caster ) end function Skill:GenerateDamageInfo(ent, damage, type, velocity) type = type or DMG_GENERIC local dmg = DamageInfo() dmg:SetDamageType(type) dmg:SetInflictor(ent) dmg:SetAttacker(ent:GetCaster()) if velocity then dmg:SetDamageForce(velocity) end dmg:SetDamage(damage) return dmg end function Skill:Hit( ent, victim, damage, type, velocity ) if !victim:IsPlayer() then return end damage = damage or 0 local dmgType = skill_manager.GetDamageType(self:GetDamageType()) if (damage < 0 ) then victim:Heal( -damage, dmgType ) return end local dmg = self:GenerateDamageInfo( ent, damage, type, velocity ) victim:TakeSkillDamage( dmg, dmgType ) end function Skill:Dot( ent, victim, time, damage, rate, start ) local dot = {} dot.rate = rate or 1 dot.start = start or CurTime() dot.stop = dot.start + time dot.nextHit = dot.start-- + dot.rate dot.damage = damage ent.dots[victim] = dot end function Skill:HandleDots( ent ) local now = CurTime() for ply, dot in next, ent.dots do if (now > dot.stop) then if (dot.stop >= dot.nextHit) then self:ApplyDotDamage(ent, ply, dot) end ent.dots[ply] = nil continue end if (now > dot.nextHit) then self:ApplyDotDamage(ent, ply, dot) end end end function Skill:ApplyDotDamage(ent, victim, dot) local now = CurTime() while (now > dot.nextHit) do self:Hit( ent, victim, dot.damage, DMG_GENERIC ) dot.nextHit = dot.nextHit + dot.rate end end
array_operation = {"Разлици", "Збиру"}
--[[ File: Ball.lua Author: Sam Triest The Ball class allows for the creation of the ball object that the players must deflect. ]] Ball = { posX, posY, sizeX = 8, sizeY = 8, launchSpeed = 300, dirX, dirY } --[[ Instantiate a new ball object and assign it a position and size. ]] function Ball:Create(posX, posY) newObject = {} setmetatable(newObject, self) self.__index = self newObject.posX = posX newObject.posY = posY return newObject end --[[ Draw the ball that calls this method to the screen. This method should be called in love.draw(). ]] function Ball:Render() love.graphics.rectangle("fill", self.posX, self.posY, self.sizeX, self.sizeY) end --[[ Set the ball's new direction. If a player scored, the ball's launch direction will be towards him on the next serve, otherwise it will be random. ]] function Ball:SetDirection(lastScoringPlayer) -- Set the horizontal direction if lastScoringPlayer == "left" then self.dirX = -self.launchSpeed elseif lastScoringPlayer == "right" then self.dirX = self.launchSpeed else -- Random direction if love.math.random(0, 1) == 1 then self.dirX = -self.launchSpeed else self.dirX = self.launchSpeed end end -- Set the vertical direction self.dirY = love.math.random(-self.launchSpeed, self.launchSpeed) / 2 end --[[ Reset the ball to the middle of the screen. ]] function Ball:ResetPos(startPos) self.posX = startPos.x self.posY = startPos.y end --[[ Move the ball's position by its direction, multiplied by delta time. This ensures its movement remains framerate independent. The speed of the ball can vary depending on its angle. It will move faster diagonally, as its movement is not normalized. This is intentional, to add some variation. Check for top and bottom collision as well. If the ball collides with the top or bottom edge, it will bounce with a small amount of random variation. ]] function Ball:Move(dt) self.posX = self.posX + self.dirX * dt self.posY = self.posY + self.dirY * dt -- Top edge collision check if self.posY < 0 then self.posY = 0 self.dirY = -self.dirY + love.math.random(-100, 100) -- Bottom edge collision check elseif self.posY > WINDOW_HEIGHT - self.sizeY then self.posY = WINDOW_HEIGHT - self.sizeY self.dirY = -self.dirY + love.math.random(-100, 100) end end --[[ Check whether or not the ball has collided with the paddle. ]] function Ball:Collide(paddle) if self.posX > paddle.posX + paddle.sizeX or self.posX + self.sizeX < paddle.posX then return false end if self.posY > paddle.posY + paddle.sizeY or self.posY + self.sizeY < paddle.posY then return false end return true end
PLUGIN.name = "FactionNPC" PLUGIN.description = "Adds NPC Relations to Factions" PLUGIN.author = "Zenolisk" ix.util.Include("sv_hooks.lua")
---@meta ---@class cc.PhysicsJoint local PhysicsJoint={ } cc.PhysicsJoint=PhysicsJoint ---* Get physics body a connected to this joint. ---@return cc.PhysicsBody function PhysicsJoint:getBodyA () end ---* Get physics body b connected to this joint. ---@return cc.PhysicsBody function PhysicsJoint:getBodyB () end ---* Get the max force setting. ---@return float function PhysicsJoint:getMaxForce () end ---* Set the max force between two bodies. ---@param force float ---@return self function PhysicsJoint:setMaxForce (force) end ---* Determines if the joint is enable. ---@return boolean function PhysicsJoint:isEnabled () end ---* Enable/Disable the joint. ---@param enable boolean ---@return self function PhysicsJoint:setEnable (enable) end ---* Enable/disable the collision between two bodies. ---@param enable boolean ---@return self function PhysicsJoint:setCollisionEnable (enable) end ---* Get the physics world. ---@return cc.PhysicsWorld function PhysicsJoint:getWorld () end ---* Set this joint's tag.<br> ---* param tag An integer number that identifies a PhysicsJoint. ---@param tag int ---@return self function PhysicsJoint:setTag (tag) end ---* Remove the joint from the world. ---@return self function PhysicsJoint:removeFormWorld () end ---* Determines if the collision is enable. ---@return boolean function PhysicsJoint:isCollisionEnabled () end ---* Get this joint's tag.<br> ---* return An integer number. ---@return int function PhysicsJoint:getTag () end
local FS = require('fs') local Timer = require('timer') local FFI = require('ffi') local Debug = require('debug') local Math = require('math') local SDL = require('./sdl') local Bit = require('bit') p("SDL", SDL) local Rect = FFI.metatype("SDL_Rect", {}) SDL.Init(Bit.bor(SDL.INIT_VIDEO,SDL.INIT_JOYSTICK)) SDL.WM_SetCaption("Luvit!", nil); local screen = SDL.SetVideoMode(1024, 768, 0, SDL.RESIZABLE) local joysticks = {} SDL.JoystickEventState(SDL.ENABLE); p("numjoysticks", SDL.NumJoysticks()) for i = 1,SDL.NumJoysticks() do p("Found ", FFI.string(SDL.JoystickName(i-1))); local joy = SDL.JoystickOpen(i-1) joysticks[i] = joy end p("Joysticks", joysticks) local function exit() SDL.stop_events() SDL.Quit(); print("Thanks for Playing!"); end SDL:on(SDL.QUIT, exit) SDL:on(SDL.KEYDOWN, function (evt) p("on_keydown", evt) local sym = evt.key.keysym.sym if sym == SDL.ffi.SDLK_ESCAPE then exit() end end) local x = screen.w / 2 local y = screen.h / 2 local mx = 0 local my = 0 SDL:on(SDL.JOYAXISMOTION, function (evt) local j = evt.jaxis p("JOYAXISMOTION", {which=j.which,axis=j.axis,value=j.value}) -- +0 right -0 left -- +1 down -1 up if j.axis == 0 then mx = j.value / 0x8000 elseif j.axis == 1 then my = j.value / 0x8000 end end) SDL:on(SDL.JOYHATMOTION, function (evt) local j = evt.jhat p("JOYHATMOTION", {which=j.which,hat=j.hat,value=j.value}) end) SDL:on(SDL.JOYBUTTONDOWN, function (evt) local j = evt.jbutton p("SDL", SDL) p("JOYBUTTONDOWN", {which=j.which,button=j.button,state=j.state}) end) SDL:on(SDL.JOYBUTTONUP, function (evt) local j = evt.jbutton p("JOYBUTTONUP", {which=j.which,button=j.button,state=j.state}) end) local fade_color = SDL.MapRGBA(screen.format, 0, 0, 0, 1) local spin = 2 local grow = 1.02 local w = FFI.new("int[1]", screen.w) local h = FFI.new("int[1]", screen.h) SDL.GFX.rotozoomSurfaceSize(screen.w, screen.h, spin, grow, w, h) w = w[0] h = h[0] SDL:on(SDL.VIDEORESIZE, function (evt) p("ON_VIDEORESIZE", {w=evt.resize.w,h=evt.resize.h}) local old = screen screen = SDL.SetVideoMode(evt.resize.w, evt.resize.h, 0, SDL.RESIZABLE) SDL.FreeSurface(old) local w = FFI.new("int[1]", screen.w) local h = FFI.new("int[1]", screen.h) SDL.GFX.rotozoomSurfaceSize(screen.w, screen.h, spin, grow, w, h) w = w[0] h = h[0] end) SDL:on('tick', function (delta) x = x + mx * delta y = y + my * delta local tmp = SDL.GFX.rotozoomSurface(screen, spin, grow, 1) SDL.ffi.SDL_UpperBlit(tmp, Rect((w - screen.w)/2,(h - screen.h)/2,screen.w,screen.h), screen, null) SDL.ffi.SDL_FreeSurface(tmp) local color = Math.random(0x100000000) SDL.GFX.filledCircleColor(screen, x, y, 50, color) -- Flush the output SDL.Flip(screen) end) p("SDL", SDL)
local substitute = require("substitute") local range = require("substitute.range") local function execute_keys(feedkeys) local keys = vim.api.nvim_replace_termcodes(feedkeys, true, false, true) vim.api.nvim_feedkeys(keys, "tm", false) end describe("Substitute range", function() before_each(function() local buf = vim.api.nvim_create_buf(false, true) vim.api.nvim_command("buffer " .. buf) vim.api.nvim_buf_set_lines(0, 0, -1, true, { "Lorem", "ipsum", "dolor", "sit", "amet", }) end) it("should prepare replace command", function() substitute.setup() range.operator() vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']s/Lorem//g<Left><Left>", true, false, true), cmd) end) it("should use abolish from global setup", function() substitute.setup({ range = { prefix = "S", }, }) range.operator() vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']S/Lorem//g<Left><Left>", true, false, true), cmd) end) it("should use abolish from override", function() substitute.setup() range.operator({ prefix = "S" }) vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']S/Lorem//g<Left><Left>", true, false, true), cmd) end) it("should prompt current text", function() substitute.setup({ range = { prompt_current_text = true, }, }) range.operator() vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']s/Lorem/Lorem/g<Left><Left>", true, false, true), cmd) end) it("should prompt current text using override", function() substitute.setup() range.operator({ prompt_current_text = true }) vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) range.selection_operator_callback() execute_keys("<cr>") local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']s/Lorem/Lorem/g<Left><Left>", true, false, true), cmd) end) it("should ask for confirmation", function() substitute.setup({ range = { confirm = true, }, }) range.operator() vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']s/Lorem//gc<Left><Left><Left>", true, false, true), cmd) end) it("should ask for confirmation using override", function() substitute.setup() range.operator({ confirm = true }) vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 1, 4, {}) range.operator_callback("char") vim.api.nvim_buf_set_mark(0, "[", 1, 0, {}) vim.api.nvim_buf_set_mark(0, "]", 5, 3, {}) local cmd = range.create_replace_command() assert.are.equal(vim.api.nvim_replace_termcodes(":'[,']s/Lorem//gc<Left><Left><Left>", true, false, true), cmd) end) end)
slot0 = class("IdolMasterMedalCollectionView", import("view.base.BaseUI")) slot0.FADE_OUT_TIME = 1 slot0.PAGE_NUM = 7 slot0.MEDAL_NUM_PER_PAGE = 2 slot0.MEDAL_STATUS_UNACTIVATED = 1 slot0.MEDAL_STATUS_ACTIVATED = 2 slot0.MEDAL_STATUS_ACTIVATABLE = 3 slot0.INDEX_CONVERT = { 1, 2, 5, 6, 7, 4, 3 } slot0.getUIName = function (slot0) return "IdolMasterMedalCollectionUI" end slot0.init = function (slot0) slot0:initData() slot0:findUI() slot0:addListener() end slot0.didEnter = function (slot0) slot0:checkAward() setText(slot0.progressText, setColorStr(tostring(#slot0.activeIDList), "#8CD5FFFF") .. "/" .. #slot0.allIDList) triggerToggle(slot0.switchBtnList[1], true) end slot0.willExit = function (slot0) if LeanTween.isTweening(go(slot0.photo)) then LeanTween.cancel(go(slot0.photo), false) end end slot0.initData = function (slot0) slot0.activityProxy = getProxy(ActivityProxy) slot0.activityData = slot0.activityProxy:getActivityById(ActivityConst.IDOL_MASTER_MEDAL_ID) slot0.allIDList = IdolMasterMedalCollectionMediator.GetPicturePuzzleIds(slot0.activityData.id) slot0.pageIDList = {} for slot4 = 1, slot0.PAGE_NUM, 1 do slot5 = slot0.INDEX_CONVERT[slot4] slot0.pageIDList[slot4] = {} for slot9 = 1, slot0.MEDAL_NUM_PER_PAGE, 1 do slot0.pageIDList[slot4][slot9] = slot0.allIDList[(slot5 - 1) * slot0.MEDAL_NUM_PER_PAGE + slot9] end end slot0.activatableIDList = slot0.activityData.data1_list slot0.activeIDList = slot0.activityData.data2_list slot0.curPage = nil slot0.newMedalID = nil end slot0.findUI = function (slot0) slot0.bg = slot0:findTF("BG") slot1 = slot0:findTF("NotchAdapt") slot0.backBtn = slot0:findTF("BackBtn", slot1) slot0.progressText = slot0:findTF("ProgressImg/ProgressText", slot1) slot0.helpBtn = slot0:findTF("HelpBtn", slot1) slot0.tplButtom = findTF(slot2, "tplButtom") slot0.imgGot = slot0:findTF("ProgressImg/got", slot1) slot0.switchBtnList = {} for slot6 = 1, slot0.PAGE_NUM, 1 do LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "icon" .. slot6, function (slot0) if slot0 then setImageSprite(findTF(slot0, "icon"), slot0, true) end end) LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "iconSelect" .. slot6, function (slot0) if slot0 then setImageSprite(findTF(slot0, "iconSelect"), slot0, true) end end) setParent(slot7, slot2) setActive(slot7, true) table.insert(slot0.switchBtnList, tf(instantiate(go(slot0.tplButtom)))) end slot0.infoNode = slot0:findTF("book/info") slot0.photoNode = slot0:findTF("book/photo") slot0.photo = slot0:findTF("got", slot0.photoNode) end slot0.addListener = function (slot0) onButton(slot0, slot0.backBtn, function () slot0:closeView() end, SFX_CANCEL) onButton(slot0, slot0.helpBtn, function () pg.MsgboxMgr.GetInstance():ShowMsgBox({ type = MSGBOX_TYPE_HELP, helps = pg.gametip.idolmaster_collection.tip }) end, SFX_PANEL) for slot4, slot5 in ipairs(slot0.switchBtnList) do onToggle(slot0, slot5, function (slot0) if slot0 == true then slot0.curPage = slot0.curPage ~= slot0:updateSwitchBtnTF() slot0:updateMedalContainerView(slot0.curPage ~= , ) end end, SFX_PANEL) end end slot0.UpdateActivity = function (slot0, slot1) slot0:checkAward() end slot0.updateMedalContainerView = function (slot0, slot1, slot2) slot0:updatePhotoNode(slot0.pageIDList[slot1][1], slot2) slot0:updateInfoNode(slot0.pageIDList[slot1][2]) end slot0.getMedalStatus = function (slot0, slot1) slot4 = not table.contains(slot0.activeIDList, slot1) and not (table.contains(slot0.activatableIDList, slot1) and not table.contains(slot0.activeIDList, slot1)) if slot2 then return slot0.MEDAL_STATUS_ACTIVATED elseif slot3 then return slot0.MEDAL_STATUS_ACTIVATABLE elseif slot4 then return slot0.MEDAL_STATUS_UNACTIVATED end end slot0.updatePhotoNode = function (slot0, slot1, slot2) slot3 = slot0:findTF("task", slot0.photoNode) slot4 = slot0:findTF("get", slot0.photoNode) slot5 = slot0:findTF("got", slot0.photoNode) slot7 = (slot0.curPage - 1) * slot0.MEDAL_NUM_PER_PAGE + 1 if slot0:getMedalStatus(slot1) == slot0.MEDAL_STATUS_UNACTIVATED then LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "task" .. slot7, function (slot0) setImageSprite(slot0, slot0, true) setActive(slot0, true) end) else setActive(slot3, false) end if slot6 == slot0.MEDAL_STATUS_ACTIVATED then if slot2 then setActive(slot0.photo, false) LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "photo" .. slot0.curPage, function (slot0) setImageSprite(slot0.photo, slot0, true) if LeanTween.isTweening(go(slot0.photo)) then LeanTween.cancel(go(slot0.photo), false) end GetComponent(slot0.photo, typeof(CanvasGroup)).alpha = 0 LeanTween.value(go(slot0.photo), 0, 1, 0.3):setOnUpdate(System.Action_float(function (slot0) GetComponent(slot0.photo, typeof(CanvasGroup)).alpha = slot0 end)) setActive(slot0.photo, true) end) else LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "photo" .. slot0.curPage, function (slot0) setImageSprite(slot0.photo, slot0, true) setActive(slot0.photo, true) end) end else setActive(slot0.photo, false) end setActive(slot4, slot6 == slot0.MEDAL_STATUS_ACTIVATABLE) if slot6 == slot0.MEDAL_STATUS_ACTIVATABLE then onButton(slot0, slot0.photoNode, function () pg.m02:sendNotification(GAME.MEMORYBOOK_UNLOCK, { id = slot0, actId = slot1.activityData.id }) end, SFX_PANEL) end end slot0.updateInfoNode = function (slot0, slot1) slot2 = slot0:findTF("task", slot0.infoNode) slot3 = slot0:findTF("get", slot0.infoNode) slot4 = slot0:findTF("got", slot0.infoNode) slot6 = (slot0.curPage - 1) * slot0.MEDAL_NUM_PER_PAGE + 2 if slot0:getMedalStatus(slot1) == slot0.MEDAL_STATUS_UNACTIVATED then LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "task" .. slot6, function (slot0) setImageSprite(slot0, slot0, true) setActive(slot0, true) end) else setActive(slot2, false) end if slot5 == slot0.MEDAL_STATUS_ACTIVATED then LoadSpriteAtlasAsync("ui/idolmastermedalcollectionui_atlas", "info" .. slot0.curPage, function (slot0) setImageSprite(slot0, slot0, true) setActive(slot0, true) end) else setActive(slot4, false) end setActive(slot3, slot5 == slot0.MEDAL_STATUS_ACTIVATABLE) if slot5 == slot0.MEDAL_STATUS_ACTIVATABLE then onButton(slot0, slot0.infoNode, function () pg.m02:sendNotification(GAME.MEMORYBOOK_UNLOCK, { id = slot0, actId = slot1.activityData.id }) end, SFX_PANEL) end end slot0.updateSwitchBtnTF = function (slot0) for slot4, slot5 in ipairs(slot0.switchBtnList) do slot6 = slot0:findTF("tip", slot5) if slot0:caculateActivatable(slot4) == 0 or slot4 == slot0.curPage then setActive(slot6, false) end if slot7 > 0 and slot4 ~= slot0.curPage then setActive(slot6, true) end setActive(slot0:findTF("icon", slot5), not (slot4 == slot0.curPage)) setActive(slot0:findTF("iconSelect", slot5), slot4 == slot0.curPage) end end slot0.updateAfterSubmit = function (slot0, slot1) slot0.activityProxy = getProxy(ActivityProxy) slot0.activityData = slot0.activityProxy:getActivityById(ActivityConst.IDOL_MASTER_MEDAL_ID) slot0.activatableIDList = slot0.activityData.data1_list slot0.activeIDList = slot0.activityData.data2_list slot0.newMedalID = slot1 triggerToggle(slot0.switchBtnList[slot0.curPage], true) setText(slot0.progressText, setColorStr(tostring(#slot0.activeIDList), COLOR_WHITE) .. "/" .. #slot0.allIDList) slot0:checkAward() end slot0.isHaveActivableMedal = function () if not getProxy(ActivityProxy):getActivityById(ActivityConst.IDOL_MASTER_MEDAL_ID) or slot0:isEnd() then return end slot1 = slot0.data1_list slot2 = slot0.data2_list for slot7, slot8 in ipairs(slot3) do slot10 = table.contains(slot1, slot8) if not table.contains(slot2, slot8) and slot10 then return true end end return false end slot0.caculateActivatable = function (slot0, slot1) slot3 = 0 for slot7, slot8 in ipairs(slot2) do slot10 = table.contains(slot0.activatableIDList, slot8) if not table.contains(slot0.activeIDList, slot8) and slot10 then slot3 = slot3 + 1 end end return slot3 end slot0.checkAward = function (slot0) setActive(slot0.imgGot, #slot0.activeIDList == #slot0.allIDList and slot0.activityData.data1 == 1) if #slot0.activeIDList == #slot0.allIDList and slot0.activityData.data1 ~= 1 then pg.m02:sendNotification(GAME.ACTIVITY_OPERATION, { cmd = 1, activity_id = ActivityConst.IDOL_MASTER_MEDAL_ID }) setActive(slot0.imgGot, true) end end return slot0
return { poses = { fr_link1__fr_jB = { p = {-1.000000, 0.000000, -0.000000}, r = {1.000000,-0.000000,0.000000,-0.000000,-0.000000,-1.000000,0.000000,1.000000,-0.00000} }, fr_link2__fr_jC = { p = {-0.000000, -0.000000, -1.000000}, r = {1.000000,0.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-0.000000,1.00000} }, fr_link3__fr_jD = { p = {-1.000000, -0.000000, -0.000000}, r = {1.000000,0.000000,0.000000,-0.000000,-0.000000,1.000000,0.000000,-1.000000,-0.00000} }, camera__fr_link2 = { p = {0.100000, 0.200000, 0.300000}, r = {-0.000000,-1.000000,0.000000,1.000000,-0.000000,-0.000000,0.000000,0.000000,1.00000} } } }
SceneConfig = { } SceneConfig[1]={id=1,remark='普通伤害陷阱',levelName='level_001',spawnPoint={10.5,0,-20}} SceneConfig[2]={id=2,remark='普通治疗陷阱',levelName='level_002',spawnPoint={10.5,0,-20}} SceneConfig[3]={id=3,remark='跟踪伤害陷阱',levelName='level_003',spawnPoint={10.5,0,-20}} SceneConfig[4]={id=4,remark='跟踪治疗陷阱',levelName='level_004',spawnPoint={10.5,0,-20}} SceneConfig[5]={id=5,remark='离开伤害陷阱',levelName='level_005',spawnPoint={10.5,0,-20}} SceneConfig[6]={id=6,remark='跟踪治疗陷阱',levelName='level_006',spawnPoint={10.5,0,-20}}
--*********************************************************** --** THE INDIE STONE ** --*********************************************************** require "ISUI/ISPanelJoypad" ---@class CoopCharacterCreation : ISPanelJoypad CoopCharacterCreation = ISPanelJoypad:derive("CoopCharacterCreation") function CoopCharacterCreation:accept1() if CoopMapSpawnSelect.instance.selectedRegion then local spawnRegion = CoopMapSpawnSelect.instance.selectedRegion print('using spawn region '..tostring(spawnRegion.name)) local spawn = spawnRegion.points[MainScreen.instance.desc:getProfession()] if not spawn then spawn = spawnRegion.points["unemployed"] end if not spawn then print("ERROR: there is no spawn point table for the player's profession, don't know where to spawn the player") return false end print(#spawn..' possible spawn points') local randSpawnPoint = spawn[(ZombRand(#spawn) + 1)] getWorld():setLuaSpawnCellX(randSpawnPoint.worldX) getWorld():setLuaSpawnCellY(randSpawnPoint.worldY) getWorld():setLuaPosX(randSpawnPoint.posX) getWorld():setLuaPosY(randSpawnPoint.posY) getWorld():setLuaPosZ(randSpawnPoint.posZ or 0) elseif getCore():isChallenge() then -- This shouldn't happen. See LastStandData.getSpawnRegion() getWorld():setLuaSpawnCellX(globalChallenge.xcell); getWorld():setLuaSpawnCellY(globalChallenge.ycell); getWorld():setLuaPosX(globalChallenge.x); getWorld():setLuaPosY(globalChallenge.y); getWorld():setLuaPosZ(globalChallenge.z); end getWorld():setLuaPlayerDesc(MainScreen.instance.desc) getWorld():getLuaTraits():clear() for i,v in pairs(self.charCreationProfession.listboxTraitSelected.items) do getWorld():addLuaTrait(v.item:getType()) end MainScreen.instance.avatar = nil return true end function CoopCharacterCreation:accept() if not self:accept1() then return end -- self:setVisible(false) self:removeFromUIManager() if UIManager.getSpeedControls() and not IsoPlayer.allPlayersDead() then setShowPausedMessage(true) UIManager.getSpeedControls():SetCurrentGameSpeed(1) if self.joypadData then self.joypadData.activeWhilePaused = nil end end CoopCharacterCreation.setVisibleAllUI(true) CoopCharacterCreation.instance = nil if ISPostDeathUI.instance[self.playerIndex] then ISPostDeathUI.instance[self.playerIndex]:removeFromUIManager() ISPostDeathUI.instance[self.playerIndex] = nil end if not self.joypadData then setPlayerMouse(nil) return end local controller = self.joypadData.controller local joypadData = JoypadState.joypads[self.playerIndex+1] JoypadState.players[self.playerIndex+1] = joypadData joypadData.player = self.playerIndex joypadData:setController(controller) joypadData:setActive(true) local username = nil if isClient() and self.playerIndex > 0 then username = CoopUserName.instance:getUserName() end setPlayerJoypad(self.playerIndex, self.joypadIndex, nil, username) self.joypadData.focus = nil self.joypadData.lastfocus = nil self.joypadData.prevfocus = nil self.joypadData.prevprevfocus = nil end function CoopCharacterCreation:cancel() self:removeFromUIManager() CoopCharacterCreation.setVisibleAllUI(true) CoopCharacterCreation.instance = nil if UIManager.getSpeedControls() and not IsoPlayer.allPlayersDead() then setShowPausedMessage(true) UIManager.getSpeedControls():SetCurrentGameSpeed(1) end if self.joypadData then self.joypadData.activeWhilePaused = nil self.joypadData.focus = nil -- self.joypadData.listBox self.joypadData.lastfocus = nil self.joypadData.prevfocus = nil self.joypadData.prevprevfocus = nil end if ISPostDeathUI.instance[self.playerIndex] then ISPostDeathUI.instance[self.playerIndex]:setVisible(true) if self.joypadData then self.joypadData.focus = ISPostDeathUI.instance[self.playerIndex] end end end function CoopCharacterCreation:createChildren() self.coopUserName = CoopUserName:new((self.width - 400) / 2, (self.height - 200) / 2, 400, 200) self.coopUserName:initialise() self.coopUserName:setVisible(false) self.coopUserName:setAnchorRight(true) self.coopUserName:setAnchorLeft(true) self.coopUserName:setAnchorBottom(true) self.coopUserName:setAnchorTop(true) self.coopUserName.backgroundColor = {r=0, g=0, b=0, a=0.8} self.coopUserName.borderColor = {r=1, g=1, b=1, a=0.5} local w = self.width * 0.5 if w < 768 then w = 768 end self.mapSpawnSelect = CoopMapSpawnSelect:new((self.width - w) / 2, 48, w, self.height - 64 - 64) self.mapSpawnSelect:initialise() self.mapSpawnSelect:setVisible(false) self.mapSpawnSelect:setAnchorRight(true) self.mapSpawnSelect:setAnchorLeft(true) self.mapSpawnSelect:setAnchorBottom(true) self.mapSpawnSelect:setAnchorTop(true) self.mapSpawnSelect.backgroundColor = {r=0, g=0, b=0, a=0.8} self.mapSpawnSelect.borderColor = {r=1, g=1, b=1, a=0.5} self.charCreationMain = CoopCharacterCreationMain:new(0, 0, self:getWidth(), self:getHeight()) self.charCreationMain:initialise() self.charCreationMain:setAnchorRight(true) self.charCreationMain:setAnchorLeft(true) self.charCreationMain:setAnchorBottom(true) self.charCreationMain:setAnchorTop(true) self.charCreationMain.backgroundColor = {r=0, g=0, b=0, a=0.0} self.charCreationMain.borderColor = {r=1, g=1, b=1, a=0.0} self.charCreationProfession = CoopCharacterCreationProfession:new(0, 0, self:getWidth(), self:getHeight()) self.charCreationProfession:initialise() self.charCreationProfession:setAnchorRight(true) self.charCreationProfession:setAnchorLeft(true) self.charCreationProfession:setAnchorBottom(true) self.charCreationProfession:setAnchorTop(true) self.charCreationProfession.backgroundColor = {r=0, g=0, b=0, a=0.0} self.charCreationProfession.borderColor = {r=1, g=1, b=1, a=0.0} self.charCreationHeader = CharacterCreationHeader:new(0, 0, 600, 200) self.charCreationHeader:initialise() self.charCreationHeader:setAnchorRight(true) self.charCreationHeader:setAnchorLeft(true) self.charCreationHeader:setAnchorBottom(false) self.charCreationHeader:setAnchorTop(true) self.charCreationHeader.backgroundColor = {r=0, g=0, b=0, a=0.0} self.charCreationHeader.borderColor = {r=1, g=1, b=1, a=0.0} self:addChild(self.coopUserName) self:addChild(self.mapSpawnSelect) self:addChild(self.charCreationMain) self:addChild(self.charCreationProfession) MainScreen.instance.desc = SurvivorFactory.CreateSurvivor() MainScreen.instance.avatar = nil MainScreen.instance.charCreationHeader = self.charCreationHeader MainScreen.instance.charCreationProfession = self.charCreationProfession self.mapSpawnSelect:create() self.charCreationHeader:create() self.charCreationMain:create() self.charCreationProfession:create() self.mapSpawnSelect:setVisible(false) self.charCreationMain:setVisible(false) self.charCreationProfession:setVisible(false) self.charCreationHeader:setVisible(true) end function CoopCharacterCreation:new(joypadIndex, joypadData, playerIndex) local o = ISPanelJoypad:new(0, 0, getCore():getScreenWidth(), getCore():getScreenHeight()) setmetatable(o, self) self.__index = self o.borderColor.a = 0 o.joypadIndex = joypadIndex o.joypadData = joypadData o.playerIndex = playerIndex o:setUIName("CoopCharacterCreation") CoopCharacterCreation.instance = o return o end CoopCharacterCreation.visibleUI = {} function CoopCharacterCreation.setVisibleAllUI(visible) local ui = UIManager.getUI() if not visible then for i=0,ui:size()-1 do if ui:get(i):isVisible() then table.insert(CoopCharacterCreation.visibleUI, ui:get(i):toString()) ui:get(i):setVisible(false) end end else for i,v in ipairs(CoopCharacterCreation.visibleUI) do for i=0,ui:size()-1 do if v == ui:get(i):toString() then ui:get(i):setVisible(true) break end end end CoopCharacterCreation.visibleUI = {} end UIManager.setVisibleAllUI(visible) end function CoopCharacterCreation.newPlayer(joypadIndex, joypadData) if CoopCharacterCreation.instance then return end if UIManager.getSpeedControls() and not IsoPlayer.allPlayersDead() then setShowPausedMessage(false) UIManager.getSpeedControls():SetCurrentGameSpeed(0) joypadData.activeWhilePaused = true end CoopCharacterCreation.setVisibleAllUI(false) local playerIndex = joypadData.player if not playerIndex then -- true when not respawning for i=0,getMaxActivePlayers()-1 do local player = getSpecificPlayer(i) if not player or player:isDead() then playerIndex = i break end end end local w = CoopCharacterCreation:new(joypadIndex, joypadData, playerIndex) w:initialise() w:addToUIManager() if w.coopUserName:shouldShow() then w.coopUserName:beforeShow() w.coopUserName:setVisible(true, joypadData) elseif w.mapSpawnSelect:hasChoices() then w.mapSpawnSelect:fillList() w.mapSpawnSelect:setVisible(true, joypadData) else w.mapSpawnSelect:useDefaultSpawnRegion() w.charCreationProfession:setVisible(true, joypadData) end end function CoopCharacterCreation:newPlayerMouse() ProfessionFactory.Reset(); BaseGameCharacterDetails.DoProfessions(); if CoopCharacterCreation.instance then return end if UIManager.getSpeedControls() and not IsoPlayer.allPlayersDead() then setShowPausedMessage(false) UIManager.getSpeedControls():SetCurrentGameSpeed(0) end CoopCharacterCreation.setVisibleAllUI(false) local w = CoopCharacterCreation:new(nil, nil, 0) w:initialise() w:addToUIManager() if w.mapSpawnSelect:hasChoices() then w.mapSpawnSelect:fillList() w.mapSpawnSelect:setVisible(true) else w.mapSpawnSelect:useDefaultSpawnRegion() w.charCreationProfession:setVisible(true) end end function CoopCharacterCreation:OnJoypadBeforeDeactivate(index) if self.joypadData and (self.joypadData.id == index) then -- Controller disconnected, cancel creation. -- Other windows are children of this ui. self:cancel() end end
--[[ Created by Grid2 original authors, modified by Michael --]] local Grid2 = Grid2 local SecureButton_GetModifiedUnit = SecureButton_GetModifiedUnit local next = next local pairs = pairs local Grid2Frame --{{{ Registered unit frames tracking local frames_of_unit = setmetatable({}, { __index = function (self, key) local result = {} self[key] = result return result end}) local unit_of_frame = {} function Grid2:SetFrameUnit(frame, unit) local prev_unit = unit_of_frame[frame] if prev_unit then frames_of_unit[prev_unit][frame] = nil end if unit then frames_of_unit[unit][frame] = true end unit_of_frame[frame] = unit end function Grid2:GetUnitFrames(unit) return frames_of_unit[unit] end --}}} -- {{ Precalculated backdrop table, shared by all frames local frameBackdrop -- }} --{{{ Grid2Frame script handlers local GridFrameEvents = {} function GridFrameEvents:OnShow() Grid2Frame:SendMessage("Grid_UpdateLayoutSize") end function GridFrameEvents:OnHide() Grid2Frame:SendMessage("Grid_UpdateLayoutSize") end function GridFrameEvents:OnAttributeChanged(name, value) if name == "unit" then if value then local unit = SecureButton_GetModifiedUnit(self) if self.unit ~= unit then Grid2Frame:Debug("updated", self:GetName(), name, value, unit) self.unit = unit Grid2:SetFrameUnit(self, unit) self:UpdateIndicators() end elseif self.unit then Grid2Frame:Debug("removed", self:GetName(), name, self.unit) self.unit = nil Grid2:SetFrameUnit(self, nil) end end end -- Dispatch OnEnter,OnLeave events to other modules local eventHooks = { OnEnter = {}, OnLeave = {} } function GridFrameEvents:OnEnter() for func in pairs(eventHooks.OnEnter) do func(self) end end function GridFrameEvents:OnLeave() for func in pairs(eventHooks.OnLeave) do func(self) end end --}}} --{{{ GridFramePrototype local GridFramePrototype = {} local function GridFrame_Init(frame, width, height) for name, value in pairs(GridFramePrototype) do frame[name] = value end for event, handler in pairs(GridFrameEvents) do frame:HookScript(event, handler) end if frame:CanChangeAttribute() then frame:SetAttribute("initial-width", width) frame:SetAttribute("initial-height", height) end frame:RegisterForClicks("AnyUp") if Clique then Clique:UpdateRegisteredClicks(frame) end frame.menu = Grid2Frame.RightClickUnitMenu frame.container = frame:CreateTexture() frame:CreateIndicators() frame:Layout() end function GridFramePrototype:Layout() local dbx = Grid2Frame.db.profile local w, h = Grid2Frame:GetFrameSize() -- external border controlled by the border indicator local r,g,b,a = self:GetBackdropBorderColor() Grid2:SetFrameBackdrop( self, frameBackdrop ) self:SetBackdropBorderColor(r, g, b, a) -- inner border color (sure that is the inner border) local cf = dbx.frameColor self:SetBackdropColor( cf.r, cf.g, cf.b, cf.a ) -- visible background local container= self.container container:SetPoint("CENTER", self, "CENTER") -- visible background color (commented because now this color is set by the background indicator) -- local cb = dbx.frameContentColor -- container:SetVertexColor(cb.r, cb.g, cb.b, cb.a) -- shrink the background, showing part of the real frame background (that is behind) as a inner border. local inset = (dbx.frameBorder+dbx.frameBorderDistance)*2 container:SetSize( w-inset, h-inset ) -- visible background texture local texture = Grid2:MediaFetch("statusbar", dbx.frameTexture, "Gradient" ) self.container:SetTexture(texture) -- set size if not InCombatLockdown() then self:SetSize(w,h) end -- highlight texture if dbx.mouseoverHighlight then self:SetHighlightTexture( Grid2:MediaFetch("background", dbx.mouseoverTexture, "Blizzard Quest Title Highlight") ) local color = dbx.mouseoverColor self:GetHighlightTexture():SetVertexColor(color.r, color.g, color.b, color.a) else self:SetHighlightTexture(nil) end -- Adjust indicators position to the new size local indicators = Grid2:GetIndicatorsEnabled() for i=1,#indicators do indicators[i]:Layout(self) end end function GridFramePrototype:UpdateIndicators() local unit = self.unit if unit then local indicators = Grid2:GetIndicatorsEnabled() for i=1,#indicators do indicators[i]:Update(self, unit) end end end function GridFramePrototype:CreateIndicators() local indicators = Grid2:GetIndicatorsSorted() for i=1,#indicators do indicators[i]:Create(self) end end --}}} --{{{ Grid2Frame Grid2Frame = Grid2:NewModule("Grid2Frame") Grid2Frame.defaultDB = { profile = { -- theme options ( active theme options in: self.db.profile, first theme options in: self.dba.profile, extra themes in: self.dba.profile.extraThemes[] ) frameHeight = 48, frameWidth = 48, frameBorder = 2, frameBorderColor = {r=0, g=0, b=0, a=0}, frameBorderTexture = "Grid2 Flat", frameBorderDistance= 1, frameTexture = "Gradient", frameColor = { r=0, g=0, b=0, a=1 }, frameContentColor= { r=0, g=0, b=0, a=1 }, mouseoverHighlight = false, mouseoverColor = { r=1, g=1, b=1, a=1 }, mouseoverTexture = "Blizzard Quest Title Highlight", frameWidths = {}, frameHeights = {}, -- default values for indicators orientation = "VERTICAL", barTexture = "Gradient", font = nil, fontSize = 11, iconSize = 14, -- profile options shared by all themes, but stored on default/first theme blinkType = "Flash", blinkFrequency = 2, } } function Grid2Frame:OnModuleInitialize() self.dba = self.db self.db = { global = self.dba.global, profile = self.dba.profile, shared = self.dba.profile } self.registeredFrames = {} end function Grid2Frame:OnModuleEnable() if not Grid2.isClassic then self:RegisterEvent("UNIT_ENTERED_VEHICLE") self:RegisterEvent("UNIT_EXITED_VEHICLE") end self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateFrameUnits") self:RegisterMessage("Grid_UnitUpdate") self:CreateIndicators() self:RefreshIndicators() self:LayoutFrames() self:UpdateFrameUnits() self:UpdateIndicators() end function Grid2Frame:OnModuleDisable() if not Grid2.isClassic then self:UnregisterEvent("UNIT_ENTERED_VEHICLE") self:UnregisterEvent("UNIT_EXITED_VEHICLE") end self:UnregisterEvent("PLAYER_ENTERING_WORLD") self:UnregisterMessage("Grid_UnitUpdate") end function Grid2Frame:OnModuleUpdate() self:CreateIndicators() self:RefreshTheme() end function Grid2Frame:UpdateTheme() local themes = self.dba.profile.extraThemes self.db.profile = themes and themes[Grid2.currentTheme] or self.dba.profile self.db.shared = self.dba.profile end function Grid2Frame:RefreshTheme() self:RefreshIndicators(true) self:LayoutFrames() self:UpdateIndicators() end -- wakeup/suspend indicators according to the current theme function Grid2Frame:RefreshIndicators(update) local _, _, suspended = Grid2:GetCurrentTheme() for _,indicator in ipairs(Grid2.indicatorSorted) do if not indicator.parentName then local s1 = indicator.suspended local s2 = suspended[indicator.name] if s1~=s2 then if s2 then Grid2:SuspendIndicator(indicator) else Grid2:WakeUpIndicator(indicator) end elseif not s1 and update and indicator.UpdateDB then indicator:UpdateDB() end end end end function Grid2Frame:RegisterFrame(frame) GridFrame_Init(frame, self:GetFrameSize()) self.registeredFrames[frame:GetName()] = frame end function Grid2Frame:CreateIndicators() for _, frame in next, self.registeredFrames do frame:CreateIndicators() end end function Grid2Frame:UpdateIndicators() for _, frame in next, self.registeredFrames do frame:UpdateIndicators() end end function Grid2Frame:UpdateBackdrop() local dbx = self.db.profile frameBackdrop = Grid2:GetBackdropTable( Grid2:MediaFetch("border", dbx.frameBorderTexture, "Grid2 Flat"), dbx.frameBorder, "Interface\\Addons\\Grid2\\media\\white16x16", true, 16 ) end function Grid2Frame:LayoutFrames(notify) self:UpdateBackdrop() for name, frame in next, self.registeredFrames do frame:Layout() end if notify then self:SendMessage("Grid_UpdateLayoutSize") end end function Grid2Frame:GetFrameSize() local _, _, m = Grid2:GetGroupType() local p = self.db.profile return p.frameWidths[m] or p.frameWidth, p.frameHeights[m] or p.frameHeight end function Grid2Frame:SetFrameSize(w, h) self.db.profile.frameWidth = w or self.db.profile.frameWidth self.db.profile.frameHeight = h or self.db.profile.frameHeight Grid2Layout:UpdateDisplay() end -- Grid2Frame:WithAllFrames() do local type, with = type, {} with["table"] = function(self, object, func, ...) if type(func) == "string" then func = object[func] end for _, frame in next, self.registeredFrames do func(object, frame, ...) end end with["function"] = function(self, func, ...) for _, frame in next, self.registeredFrames do func(frame, ...) end end function Grid2Frame:WithAllFrames( param , ... ) with[type(param)](self, param, ...) end end -- Alow other modules to hook unit frames OnEnter, OnExit events function Grid2Frame:SetEventHook( event, func, enabled ) eventHooks[event][func] = enabled or nil end -- Event handlers function Grid2Frame:UpdateFrameUnits() for _, frame in next, self.registeredFrames do local old_unit = frame.unit local unit = SecureButton_GetModifiedUnit(frame) if old_unit ~= unit then Grid2:SetFrameUnit(frame, unit) frame.unit = unit frame:UpdateIndicators() end end end function Grid2Frame:UNIT_ENTERED_VEHICLE(_, unit) for frame in next, Grid2:GetUnitFrames(unit) do local old, new = frame.unit, SecureButton_GetModifiedUnit(frame) if old ~= new then Grid2:SetFrameUnit(frame, new) frame.unit = new frame:UpdateIndicators() end end end function Grid2Frame:UNIT_EXITED_VEHICLE(_, unit) local pet = Grid2:GetPetUnitByUnit(unit) or unit for frame in next, Grid2:GetUnitFrames(pet) do local old, new = frame.unit, SecureButton_GetModifiedUnit(frame) if old ~= new then Grid2:SetFrameUnit(frame, new) frame.unit = new frame:UpdateIndicators() end end end function Grid2Frame:Grid_UnitUpdate(_, unit) for frame in next, Grid2:GetUnitFrames(unit) do local old, new = frame.unit, SecureButton_GetModifiedUnit(frame) if old ~= new then Grid2:SetFrameUnit(frame, new) frame.unit = new end frame:UpdateIndicators() end end --}}} _G.Grid2Frame = Grid2Frame -- Allow other modules/addons to easily modify the grid unit frames Grid2Frame.Prototype = GridFramePrototype -- Allow other modules to access the variable for speed optimization Grid2.frames_of_unit = frames_of_unit
function Mob.vanish(mob) local pc = mob:getObjectsInArea(BL_PC) mob.look = 433 for i = 1, #pc do pc[i]:updateState() end mob:delete() end function Mob.vanish2(mob) local pc = mob:getObjectsInArea(BL_PC) mob.look = 433 for i = 1, #pc do pc[i]:updateState() end mob:removeHealthWithoutDamageNumbers(mob.maxHealth) end function Mob.canPK(player, target) return true end
-- Normalizes a bearing to (-180, 180]. function NormalizeBearing(Bearing) Bearing = Bearing % 360 if Bearing > 180 then Bearing = Bearing - 360 end return Bearing end
local function runString (commandstring) -- some stuff we might need vehicle = getPedOccupiedVehicle(getLocalPlayer()) or getPedContactElement(getLocalPlayer()) car = vehicle p = getPlayerFromName c = getPedOccupiedVehicle set = setElementData get = getElementData outputChatBoxR("Executing client-side command: "..commandstring) local notReturned --First we test with return local commandFunction,errorMsg = loadstring("return "..commandstring) if errorMsg then --It failed. Lets try without "return" notReturned = true commandFunction, errorMsg = loadstring(commandstring) end if errorMsg then --It still failed. Print the error message and stop the function outputChatBoxR("Error: "..errorMsg) return end --Finally, lets execute our function results = { pcall(commandFunction) } if not results[1] then --It failed. outputChatBoxR("Error: "..results[2]) return end if not notReturned then local resultsString = "" local first = true for i = 2, #results do if first then first = false else resultsString = resultsString..", " end local resultType = type(results[i]) if isElement(results[i]) then resultType = "element:"..getElementType(results[i]) end resultsString = resultsString..tostring(results[i]).." ["..resultType.."]" end outputChatBoxR("Command results: "..resultsString) elseif not errorMsg then outputChatBoxR("Command executed!") end end addEvent("doCrun", true) addEventHandler("doCrun", getRootElement(), runString) local function loadScripts() if exports.global:isPlayerScripter(getLocalPlayer()) then setElementData( getLocalPlayer(), "runcode:hideoutput", true ) local client = xmlLoadFile( "autoload.lua" ) if client then local children = xmlNodeGetChildren( client ) if children then for k, v in ipairs( children ) do if xmlNodeGetName( v ) == "c" then triggerEvent("doCrun", getLocalPlayer(), xmlNodeGetValue( v )) elseif xmlNodeGetName( v ) == "s" then triggerServerEvent("doSrun", getLocalPlayer(), xmlNodeGetValue( v )) elseif xmlNodeGetName( v ) == "f" then injectScript( xmlNodeGetValue( v ) ) end end end end setElementData( getLocalPlayer(), "runcode:hideoutput", false ) end end addEvent("runcode:loadScripts", true) addEventHandler("runcode:loadScripts", getLocalPlayer(), loadScripts) addEventHandler("onClientResourceStart", getResourceRootElement(), loadScripts)
--data.raw.recipe["chromium-synthesis"].enabled = false data:extend({ { type = "technology", name = "chromium-synthesis", icon_size = 128, icons = { { icon = get_icon_path("advanced-cracking-background",DIR.icon_size), icon_size = DIR.icon_size}, { icon = get_icon_path("chromium-pure",DIR.icon_size), icon_size = DIR.icon_size, scale = 0.6} }, effects = { { type = "unlock-recipe", recipe = "chromium-synthesis", }, }, prerequisites = {"space-science-pack"}, unit = { count = 1500, ingredients = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, time = 10, } }, { name = "chromium-synthesis", type = "recipe", category = "chemistry", enabled = false, energy_required = 12, icons = { { icon = get_icon_path("advanced-cracking-background",DIR.icon_size), icon_size = DIR.icon_size}, { icon = get_icon_path("chromium-pure",DIR.icon_size), icon_size = DIR.icon_size, scale = 0.4}, }, --crafting_machine_tint = data.raw.recipe["heavy-oil-cracking"].crafting_machine_tint, ingredients = { { name = "sulfuric-acid", amount = 30, type = "fluid" }, { name = "iron-pure", amount = 4, type = "item", }, { name = "gold-pure", amount = 2, type = "item", }, { name = "platinum-pure", amount = 1, type = "item", catalyst_amount = 1, }, }, results = { { name = "chromium-pure", amount = 1, probability = 0.90, type = "item", }, { name = "platinum-pure", amount = 1, probability = 0.99, type = "item", catalyst_amount = 1, }, }, emissions_multiplier = 2, allow_decomposition = false, main_product = "", subgroup = "fluid-recipes", order = "h", } })
--function update (elapsed) --print("THE FUCKING Y COORDINATE IS " .. _G['defaultStrum0Y']) --end function beatHit (beat) -- if beat == 64 or beat == 96 or beat == 192 or beat == 256 or beat == 288 then -- if difficulty == 1 then healthDrain(4, 11.64) -- else healthDrain(2.5, 11.64) -- end -- end -- GUYS IM SORRY I FORGOT TO ADD DOWNSCROLL SUPPORT ON RELEASE AUHSDWHDDEYGDSGG QwQ if (beat > 159 and beat < 220) or (beat > 255 and beat < 320) then if difficulty == 1 then if beat - math.floor(beat/4)*4 == 1 then -- simply beat % 4 == 1 for i = 0, 7 do tweenPos(i, _G['defaultStrum'..i..'X'] - 20, _G['defaultStrum'..i..'Y'] + 10, 0.1) end end if beat - math.floor(beat/4)*4 == 3 then -- simply beat % 4 == 3 for i = 0, 7 do tweenPos(i, _G['defaultStrum'..i..'X'] + 20, _G['defaultStrum'..i..'Y'] + 10, 0.1) end end else if beat - math.floor(beat/4)*4 == 1 then -- simply beat % 4 == 1 for i = 0, 7 do tweenPos(i, _G['defaultStrum'..i..'X'] - 7, _G['defaultStrum'..i..'Y'] + 10, 0.1) end end if beat - math.floor(beat/4)*4 == 3 then -- simply beat % 4 == 3 for i = 0, 7 do tweenPos(i, _G['defaultStrum'..i..'X'] + 7, _G['defaultStrum'..i..'Y'] + 10, 0.1) end end end end end
pg = pg or {} pg.Protocol = class("Protocol") pg.Protocol.Ctor = function (slot0, slot1, slot2, slot3) slot0._id = slot1 slot0._name = slot2 slot0._object = slot3 end pg.Protocol.GetMessage = function (slot0) return slot0._object[slot0._name]() end pg.Protocol.GetId = function (slot0) return slot0._id end pg.Protocol.GetName = function (slot0) return slot0._name end return
--- Cloze uses [LDoc](https://github.com/stevedonovan/ldoc) for the -- source code documentation. The supported tags are described on in -- the [wiki](https://github.com/stevedonovan/LDoc/wiki). -- -- <h3>Naming conventions</h3> -- -- * _Variable_ names for _nodes_ are suffixed with `_node`, for example -- `head_node`. -- * _Variable_ names for _lengths_ (dimensions) are suffixed with -- `_length`, for example `width`. -- -- @module cloze -- luacheck: globals node tex modules luatexbase callback -- __cloze.lua__ -- __Initialisation of the function tables__ -- It is good form to provide some background informations about this Lua -- module. if not modules then modules = { } end modules ['cloze'] = { version = '1.6', comment = 'cloze', author = 'Josef Friedrich, R.-M. Huber', copyright = 'Josef Friedrich, R.-M. Huber', license = 'The LaTeX Project Public License Version 1.3c 2008-05-04' } local lpeg = require('lpeg') --- See [lpeg.P](http://www.inf.puc-rio.br/~roberto/lpeg#op-p) -- -- Like `"literal"` in peg.js. local Pattern = lpeg.P --- See [lpeg.R](http://www.inf.puc-rio.br/~roberto/lpeg#op-r) -- -- Like `[a-z]` in peg.js. local Range = lpeg.R --- See [lpeg.S](http://www.inf.puc-rio.br/~roberto/lpeg#op-s) -- -- Like `[characters]` in peg.js. local Set = lpeg.S --- See [lpeg.C](http://www.inf.puc-rio.br/~roberto/lpeg#cap-c) local capture = lpeg.C --- See [lpeg.Ct](http://www.inf.puc-rio.br/~roberto/lpeg#cap-t) local capture_table = lpeg.Ct --- See [lpeg.Cf](http://www.inf.puc-rio.br/~roberto/lpeg#cap-f) local capture_fold = lpeg.Cf --- See [lpeg.Cg](http://www.inf.puc-rio.br/~roberto/lpeg#cap-g) local capture_group = lpeg.Cg --- See [lpeg.Cg](http://www.inf.puc-rio.br/~roberto/lpeg#cap-cc) local capture_constant = lpeg.Cc --- A naive key value parser written with Lpeg to get rid of kvoptions. -- -- * `patt^0` = `expression *` (peg.js) -- * `patt^1` = `expression +` (peg.js) -- * `patt^-1` = `expression ?` (peg.js) -- * `patt1 * patt2` = `expression1 expression2` (peg.js) -> Sequence -- * `patt1 + patt2` = `expression1 / expression2` (peg.js) -> Ordered choice -- -- * [TUGboat article: Parsing complex data formats in LuaTEX with LPEG](https://tug.org/TUGboat/tb40-2/tb125menke-lpeg.pdf) -- * [Dimension handling in lualibs](https://github.com/lualatex/lualibs/blob/master/lualibs-util-dim.lua) -- -- @tparam string input The key value options in a unparsed fashion as a -- string. -- -- @treturn table The key value options as a table. local function key_value_parser(input) local white_space = Set(' \t\r\n')^0 --- Define data type boolean. -- -- @return Lpeg patterns local function data_type_boolean () local boolean_true = ( Pattern('true') + Pattern('TRUE') + Pattern('yes') + Pattern('YES') ) * capture_constant(true) local boolean_false = ( Pattern('false') + Pattern('FALSE') + Pattern('no') + Pattern('NO') ) * capture_constant(false) return boolean_true + boolean_false end --- Define data type integer. -- -- @return Lpeg patterns local function data_type_integer() -- patt / function -- Creates a function capture. It calls the given function passing -- all captures made b nby patt as arguments, or the whole match if -- patt made no capture. The values returned by the function are the -- final values of the capture. In particular, if function returns -- no value, there is no captured value return Range('09')^1 / tonumber end --- Define data type dimension. -- -- @return Lpeg patterns local function data_type_dimension() local sign = Set('-+') local integer = Range('09')^1 local number = integer^1 * Pattern('.')^0 * integer^0 local unit = Pattern('pt') + Pattern('cm') + Pattern('mm') + Pattern('sp') + Pattern('bp') + Pattern('in') + Pattern('pc') + Pattern('dd') + Pattern('cc') -- patt / function -> function capture return (sign^0 * number * unit) / tex.sp end --- Define data type string. -- -- @return Lpeg patterns local data_type_string = function() return capture(Range('az', 'AZ', '09')^1) end local data_type = { boolean = data_type_boolean(), integer = data_type_integer(), dimension = data_type_dimension(), string = data_type_string(), } local minimun_lines = (Pattern('minimumlines') + Pattern('minlines')) * capture_constant('minimum lines') local generic_key = capture(Range('az')^1) local key = white_space * (minimun_lines + generic_key) * white_space local value = white_space * (data_type.dimension + data_type.integer + data_type.boolean + data_type.string) * white_space -- For example: hide -> hide = true local key_only = key * capture_constant(true) local key_value = key * Pattern('=') * value local keyval_groups = capture_group( (key_value + key_only) * Pattern(',')^-1 ) -- rawset (table, index, value) -- Sets the real value of table[index] to value, without invoking the -- __newindex metamethod. table must be a table, index any value -- different from nil and NaN, and value any Lua value. local kvlist = capture_fold(capture_table('') * keyval_groups^0, rawset) return kvlist:match(input) end --- `nodex` is a abbreviation for __node eXtended__. local nodex = {} --- All values and functions, which are related to the option -- management, are stored in a table called `registry`. local registry = {} --- I didn’t know what value I should take as `user_id`. Therefore I -- took my birthday and transformed it into a large number. registry.user_id = 3121978 --- Store all local options of the markers. -- -- <code><pre> -- registry.storage = { -- { -- mode = "basic", -- position = "start", -- values = { -- distance = "3mm" -- } -- }, -- { -- mode = "basic", -- position = "stop" -- } -- }</pre></code> registry.storage = {} --- The default options. registry.defaults = { ['align'] = 'l', ['boxheight'] = false, ['boxrule'] = '0.4pt', ['boxwidth'] = '\\linewidth', ['distance'] = '1.5pt', ['hide'] = false, ['linecolor_name'] = 'black', ['linecolor'] = '0 0 0 rg 0 0 0 RG', -- black ['margin'] = '3pt', ['minlines'] = 0, ['resetcolor_name'] = 'black', ['resetcolor'] = '0 0 0 rg 0 0 0 RG', -- black ['show_text'] = true, ['show'] = true, ['spacing'] = '1.6', ['textcolor_name'] = 'blue', -- blue ['textcolor'] = '0 0 1 rg 0 0 1 RG', -- blue ['thickness'] = '0.4pt', ['width'] = '2cm', } --- The global options set by the user. registry.global_options = {} --- The local options. registry.local_options = {} --- Node precessing (nodex) -- @section nodex -- All functions in this section are stored in a table called `nodex`. -- `nodex` is a abbreviation for __node eXtended__. The `nodex` table -- bundles all functions, which extend the built-in `node` library. -- __Color handling (color)__ -- __create_colorstack__ -- Create a whatsit node of the subtype `pdf_colorstack`. `data` is a PDF -- colorstack string like `0 0 0 rg 0 0 0 RG`. function nodex.create_colorstack(data) if not data then data = '0 0 0 rg 0 0 0 RG' -- black end local whatsit = node.new('whatsit', 'pdf_colorstack') whatsit.stack = 0 whatsit.data = data return whatsit end --- -- `nodex.create_color()` is a wrapper for the function -- `nodex.create_colorstack()`. It queries the current values of the -- options `linecolor` and `textcolor`. The argument `option` accepts the -- strings `line`, `text` and `reset`. function nodex.create_color(option) local data if option == 'line' then data = registry.get_value('linecolor') elseif option == 'text' then data = registry.get_value('textcolor') elseif option == 'reset' then data = nil else data = nil end return nodex.create_colorstack(data) end -- __Line handling (line)__ --- Create a rule node, which is used as a line for the cloze texts. The -- `depth` and the `height` of the rule are calculated form the options -- `thickness` and `distance`. The argument `width` must have the length -- unit __scaled points__. function nodex.create_line(width) local rule = node.new(node.id('rule')) local thickness = tex.sp(registry.get_value('thickness')) local distance = tex.sp(registry.get_value('distance')) rule.depth = distance + thickness rule.height = - distance rule.width = width return rule end --- Insert a `list` of nodes after or before the `current`. The `head` -- argument is optional. In some edge cases it is unfortately necessary. -- if `head` is omitted the `current` node is used. The argument -- `position` can take the values `'after'` or `'before'`. function nodex.insert_list(position, current, list, head_node) if not head_node then head_node = current end for _, insert in ipairs(list) do if position == 'after' then head_node, current = node.insert_after(head_node, current, insert) elseif position == 'before' then head_node, current = node.insert_before(head_node, current, insert) end end return current end --- Enclose a rule node (cloze line) with two PDF colorstack whatsits. -- The first colorstack node dyes the line, the seccond resets the -- color. -- -- __Node list__ -- -- <table> -- <thead> -- <tr> -- <th>`color_line_node`</th> -- <th>`whatsit`</th> -- <th>`pdf_colorstack`</th> -- <th>Line color</th> -- </tr> -- </thead> -- <tbody> -- <tr> -- <td>`line_node`</td> -- <td>`rule`</td> -- <td></td> -- <td>`width`</td> -- </tr> -- <tr> -- <td>`color_reset_node`</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Reset color</td> -- </tr> -- </tbody> -- </table> function nodex.insert_line(current, width) return nodex.insert_list( 'after', current, { nodex.create_color('line'), nodex.create_line(width), nodex.create_color('reset') } ) end --- This function enclozes a rule node with color nodes as it the -- function `nodex.insert_line` does. In contrast to -- `nodex.insert_line` the three nodes are appended to TeX’s ‘current -- list’. They are not inserted in a node list, which is accessed by a -- Lua callback. -- -- __Node list__ -- -- <table> -- <thead> -- <tr> -- <th>-</th> -- <th>`whatsit`</th> -- <th>`pdf_colorstack`</th> -- <th>Line color</th> -- </tr> -- </thead> -- <tbody> -- <tr> -- <td>-</td> -- <td>`rule`</td> -- <td></td> -- <td>`width`</td> -- </tr> -- <tr> -- <td>-</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Reset color</td> -- </tr> -- </tbody> -- </table> local function write_line_nodes() node.write(nodex.create_color('line')) node.write(nodex.create_line(tex.sp(registry.get_value('width')))) node.write(nodex.create_color('reset')) end -- __Handling of extendable lines (linefil)__ --- This function creates a line which stretchs indefinitely in the -- horizontal direction. function nodex.create_linefil() local glue = node.new('glue') glue.subtype = 100 glue.stretch = 65536 glue.stretch_order = 3 local rule = nodex.create_line(0) rule.dir = 'TLT' glue.leader = rule return glue end --- Surround a indefinitely strechable line with color whatsits and puts -- it to TeX’s ‘current (node) list’ (write). local function write_linefil_nodes() node.write(nodex.create_color('line')) node.write(nodex.create_linefil()) node.write(nodex.create_color('reset')) end -- __Kern handling (kern)__ --- This function creates a kern node with a given width. The argument -- `width` had to be specified in scaled points. local function create_kern_node(width) local kern_node = node.new(node.id('kern')) kern_node.kern = width return kern_node end --- Add at the beginning of each `hlist` node list a strut (a invisible -- character). -- -- Now we can add line, color etc. nodes after the first node of a hlist -- not before - after is much more easier. -- -- @tparam node hlist_node -- -- @treturn node hlist_node -- @treturn node strut_node -- @treturn node prev_head_node local function insert_strut_into_hlist(hlist_node) local prev_head_node = hlist_node.head local kern_node = create_kern_node(0) local strut_node = node.insert_before(hlist_node.head, prev_head_node, kern_node) hlist_node.head = prev_head_node.prev return hlist_node, strut_node, prev_head_node end --- Write a kern node to the current node list. This kern node can be -- used to build a margin. function write_margin_node() node.write(create_kern_node(tex.sp(registry.get_value('margin')))) end --- Search for a `hlist` (subtype `line`) and nsert a strut node into -- the list if a hlist is found. -- -- @tparam node head_node The head of a node list. -- -- @treturn node hlist_node -- @treturn node strut_node -- @treturn node prev_head_node local function search_hlist(head_node) while head_node do if head_node.id == node.id('hlist') and head_node.subtype == 1 then return insert_strut_into_hlist(head_node) end head_node = head_node.next end end --- Option handling. -- -- The table `registry` bundles functions that deal with the option -- handling. -- -- <h2>Marker processing (marker)</h2> -- -- A marker is a whatsit node of the subtype `user_defined`. A marker -- has two purposes: -- -- * Mark the begin and the end of a gap. -- * Store a index number, that points to a Lua table, which holds some -- additional data like the local options. -- -- @section registry --- We create a user defined whatsit node that can store a number (type -- = 100). -- -- In order to distinguish this node from other user defined whatsit -- nodes we set the `user_id` to a large number. We call this whatsit -- node a marker. The argument `index` is a number, which is associated -- to values in the `registry.storage` table. function registry.create_marker(index) local marker = node.new('whatsit', 'user_defined') marker.type = 100 -- number marker.user_id = registry.user_id marker.value = index return marker end --- Write a marker node to TeX's current node list. -- -- The argument `mode` accepts the string values `basic`, `fix` and -- `par`. The argument `position`. The argument `position` is either set -- to `start` or to `stop`. function registry.write_marker(mode, position) local index = registry.set_storage(mode, position) local marker = registry.create_marker(index) node.write(marker) end --- This functions checks if the given node `item` is a marker. function registry.is_marker(item) if item.id == node.id('whatsit') and item.subtype == node.subtype('user_defined') and item.user_id == registry.user_id then return true end return false end --- This functions tests, whether the given node `item` is a marker. -- -- @tparam node head_node The current node. -- @tparam string mode The argument `mode` accepts the string values -- `basic`, `fix` and `par`. -- @tparam string position The argument `position` is either set -- to `start` or to `stop`. function registry.check_marker(head_node, mode, position) local data = registry.get_marker_data(head_node) if data and data.mode == mode and data.position == position then return true end return false end --- `registry.get_marker` returns the given marker. -- -- @tparam node head_node The current node. -- @tparam string mode The argument `mode` accepts the string values -- `basic`, `fix` and `par`. -- @tparam string position The argument `position` is either set -- to `start` or to `stop`. -- -- @treturn mixed The node if `head_node` is a marker node. function registry.get_marker(head_node, mode, position) local out if registry.check_marker(head_node, mode, position) then out = head_node else out = false end if out and position == 'start' then registry.get_marker_values(head_node) end return out end --- Test whether the node `item` is a marker and retrieve the -- the corresponding registry data. -- -- @tparam node item The argument `item` is a node of unspecified type. -- -- @treturn table The marker data. function registry.get_marker_data(item) if item.id == node.id('whatsit') and item.subtype == node.subtype('user_defined') and item.user_id == registry.user_id then return registry.get_storage(item.value) else return false end end --- First this function saves the associatied values of a marker to the -- local options table. Second it returns this values. The argument -- `marker` is a whatsit node. function registry.get_marker_values(marker) local data = registry.get_marker_data(marker) registry.local_options = data.values return data.values end --- This function removes a given whatsit marker. -- -- It only deletes a node, if a marker is given. -- -- @treturn node head -- @treturn node current function registry.remove_marker(marker) if registry.is_marker(marker) then return node.remove(marker, marker) end end -- __Storage functions (storage)__ --- `registry.index` is a counter. The functions `registry.get_index()` -- increases the counter by one and then returns it. -- -- @treturn int The index number of the corresponding table in -- `registry.storage`. function registry.get_index() if not registry.index then registry.index = 0 end registry.index = registry.index + 1 return registry.index end --- `registry.set_storage()` stores the local options in the Lua table -- `registry.storage`. -- -- It returns a numeric index number. This index number is the key, -- where the local options in the Lua table are stored. -- -- @tparam string mode The argument `mode` accepts the string values -- `basic`, `fix` and `par`. -- @tparam string position The argument `position` is either set -- to `start` or to `stop`. -- -- @treturn int The index number of the corresponding table in -- `registry.storage`. function registry.set_storage(mode, position) local index = registry.get_index() local data = { ['mode'] = mode, ['position'] = position } if position == 'start' then data.values = {} for key, value in pairs(registry.local_options) do data.values[key] = value end end registry.storage[index] = data return index end --- The function `registry.get_storage()` retrieves values which belong -- to a whatsit marker. -- -- The argument `index` is a numeric value. function registry.get_storage(index) return registry.storage[index] end -- __Option processing (option)__ --- This function stores a value `value` and his associated key `key` -- either to the global (`registry.global_options`) or to the local -- (`registry.local_options`) option table. -- -- The global boolean variable `registry.local_options` controls in -- which table the values are stored. -- -- @tparam string key The option key. -- @tparam mixed value The value that is stored under the options key. function registry.set_option(key, value) if value == '' or value == '\\color@ ' then return false end if registry.is_global == true then registry.global_options[key] = value else registry.local_options[key] = value end end --- Set the variable `registry.is_global`. -- -- @tparam boolean is_global function registry.set_is_global(is_global) registry.is_global = is_global end --- This function unsets the local options. function registry.unset_local_options() registry.local_options = {} end --- `registry.unset_global_options` empties the global options storage. function registry.unset_global_options() registry.global_options = {} end --- Retrieve a value from a given key. First search for the value in the -- local options, then in the global options. If both option storages are -- empty, the default value will be returned. -- -- @tparam string key The name of the options key. -- -- @treturn mixed The value of the corresponding option key. function registry.get_value(key) if registry.has_value(registry.local_options[key]) then return registry.local_options[key] end if registry.has_value(registry.global_options[key]) then return registry.global_options[key] end return registry.defaults[key] end --- The function `registry.get_value_show()` returns the boolean value -- `true` if the option `show` is true. In contrast to the function -- `registry.get_value()` it converts the string value `true' to a -- boolean value. function registry.get_value_show() if registry.get_value('show') == true or registry.get_value('show') == 'true' then return true else return false end end --- This function tests whether the value `value` is not empty and has a -- value. -- -- @tparam mixed value A value of different types. -- -- @treturn boolean True is the value is set otherwise false. function registry.has_value(value) if value == nil or value == '' or value == '\\color@ ' then return false else return true end end --- Return the default value of the given option. -- -- @tparam string key The name of the options key. -- -- @treturn mixed The corresponding value of the options key. function registry.get_defaults(key) return registry.defaults[key] end --- Assembly to cloze texts. -- @section cloze_functions --- Assemble a possibly multiline cloze. -- -- The corresponding LaTeX command to this Lua function is `\cloze`. -- This function is used by other cloze TeX macros too: `\clozenol`, -- `\clozefil` -- -- @tparam node head_node_input The head of a node list. -- -- @treturn node The head of the node list. local function make_basic(head_node_input) -- This local variables are overloaded by function who -- call each other. local continue_cloze, search_stop --- The function `make_single()` makes one gap. The argument -- `start_node` is the node where the gap begins. The argument -- `stop_node` is the node where the gap ends. -- -- @tparam node start_node The node to start / begin a new cloze. -- @tparam node stop_node The node to stop / end a new cloze. -- @tparam node parent_node The parent node (hlist) of the start and -- the stop node. -- -- @treturn node stop_node The stop node. -- @treturn parent_node The parent node (hlist) of the stop node. local function make_single(start_node, stop_node, parent_node) local node_head = start_node local line_width = node.dimensions( parent_node.glue_set, parent_node.glue_sign, parent_node.glue_order, start_node, stop_node ) local line_node = nodex.insert_line(start_node, line_width) local color_text_node = nodex.insert_list('after', line_node, {nodex.create_color('text')}) if registry.get_value_show() then nodex.insert_list('after', color_text_node, {create_kern_node(-line_width)}) nodex.insert_list('before', stop_node, {nodex.create_color('reset')}, node_head) else line_node.next = stop_node.next stop_node.prev = line_node -- not line_node.prev -> line color leaks out end -- In some edge cases the lua callbacks get fired up twice. After the -- cloze has been created, the start and stop whatsit markers can be -- deleted. registry.remove_marker(start_node) return registry.remove_marker(stop_node), parent_node end --- Search for a stop marker or make a cloze up to the end of the node -- list. -- -- @tparam node start_node The node to start a new cloze. -- @tparam node parent_node The parent node (hlist) of the start node. -- -- @treturn head_node The fast forwarded new head of the node list. -- @treturn parent_node The parent node (hlist) of the head node. function search_stop(start_node, parent_node) local head_node = start_node local last_node while head_node do if registry.check_marker(head_node, 'basic', 'stop') then return make_single(start_node, head_node, parent_node) end last_node = head_node head_node = head_node.next end -- Make a cloze until the end of the node list. head_node = make_single(start_node, last_node, parent_node) if parent_node.next then return continue_cloze(parent_node.next) else return head_node, parent_node end end --- Continue a multiline cloze. -- -- @tparam node parent_node A parent node to search for a hlist node. -- -- @treturn head_node The fast forwarded new head of the node list. -- @treturn parent_node The parent node (hlist) of the head node. function continue_cloze(parent_node) local hlist_node = search_hlist(parent_node) if hlist_node then local start_node = hlist_node.head return search_stop(start_node, hlist_node) end end --- Search for a start marker. -- -- @tparam node head_node The head of a node list. -- @tparam node parent_node The parent node (hlist) of the head node. local function search_start(head_node, parent_node) while head_node do if head_node.head then search_start(head_node.head, head_node) elseif registry.check_marker(head_node, 'basic', 'start') and parent_node and parent_node.id == node.id('hlist') then -- Adds also a strut at the first position. It prepars the -- hlist and makes it ready to build a cloze. search_hlist(parent_node) head_node, parent_node = search_stop(head_node, parent_node) end if head_node then head_node = head_node.next else break end end end search_start(head_node_input) return head_node_input end --- The corresponding LaTeX command to this Lua function is `\clozefix`. -- -- @tparam node head_node_input The head of a node list. local function make_fix(head_node_input) --- Calculate the length of the whitespace before (`kern_start_length`) and -- after (`kern_stop_length`) the text. local function calculate_length(start, stop) local width, kern_start_length, kern_stop_length, text_width, half_length, align width = tex.sp(registry.get_value('width')) text_width = node.dimensions(start, stop) align = registry.get_value('align') if align == 'right' then kern_start_length = - text_width kern_stop_length = 0 elseif align == 'center' then half_length = (width - text_width) / 2 kern_start_length = - half_length - text_width kern_stop_length = half_length else kern_start_length = - width kern_stop_length = width - text_width end return width, kern_start_length, kern_stop_length end --- The function `make_single` generates a gap of fixed width. -- -- __Node lists__ -- -- __Show text:__ -- -- <table> -- <tbody> -- <tr> -- <td>`start_node`</td> -- <td>`whatsit`</td> -- <td>`user_definded`</td> -- <td>`index`</td> -- </tr> -- <tr> -- <td>`line_node`</td> -- <td>`rule`</td> -- <td></td> -- <td>`width`</td> -- </tr> -- <tr> -- <td>`kern_start_node`</td> -- <td>`kern`</td> -- <td>&amp; Depends on `align`</td> -- <td></td> -- </tr> -- <tr> -- <td>`color_text_node`</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Text color</td> -- </tr> -- <tr> -- <td></td> -- <td>`glyphs`</td> -- <td>&amp; Text to show</td> -- <td></td> -- </tr> -- <tr> -- <td>`color_reset_node`</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Reset color</td> -- </tr> -- <tr> -- <td>`kern_stop_node`</td> -- <td>`kern`</td> -- <td>&amp; Depends on `align`</td> -- <td></td> -- </tr> -- <tr> -- <td>`stop_node`</td> -- <td>`whatsit`</td> -- <td>`user_definded`</td> -- <td>`index`</td> -- </tr> -- </tbody> -- </table> -- -- __Hide text:__ -- -- <table> -- <thead> -- <tr> -- <th>`start_node`</th> -- <th>`whatsit`</th> -- <th>`user_definded`</th> -- <th>`index`</th> -- </tr> -- </thead> -- <tbody> -- <tr> -- <td>`line_node`</td> -- <td>`rule`</td> -- <td></td> -- <td>`width`</td> -- </tr> -- <tr> -- <td>`stop_node`</td> -- <td>`whatsit`</td> -- <td>`user_definded`</td> -- <td>`index`</td> -- </tr> -- </tbody> -- </table> -- -- Make fixed size cloze. -- -- @param start The node, where the gap begins -- @param stop The node, where the gap ends local function make_single(start, stop) local width, kern_start_length, kern_stop_length, line_node width, kern_start_length, kern_stop_length = calculate_length(start, stop) line_node = nodex.insert_line(start, width) if registry.get_value_show() then nodex.insert_list( 'after', line_node, { create_kern_node(kern_start_length), nodex.create_color('text') } ) nodex.insert_list( 'before', stop, { nodex.create_color('reset'), create_kern_node(kern_stop_length) }, start ) else line_node.next = stop.next end registry.remove_marker(start) registry.remove_marker(stop) end --- Function to recurse the node list and search after marker. -- -- @tparam node head_node The head of a node list. local function make_fix_recursion(head_node) local start_node, stop_node = false, false while head_node do if head_node.head then make_fix_recursion(head_node.head) else if not start_node then start_node = registry.get_marker(head_node, 'fix', 'start') end if not stop_node then stop_node = registry.get_marker(head_node, 'fix', 'stop') end if start_node and stop_node then make_single(start_node, stop_node) start_node, stop_node = false, false end end head_node = head_node.next end end make_fix_recursion(head_node_input) return head_node_input end --- The corresponding LaTeX environment to this lua function is -- `clozepar`. -- -- __Node lists__ -- -- __Show text:__ -- -- <table> -- <thead> -- <tr> -- <th>`strut_node`</th> -- <th>`kern`</th> -- <th></th> -- <th>width = 0</th> -- </tr> -- </thead> -- <tbody> -- <tr> -- <td>`line_node`</td> -- <td>`rule`</td> -- <td></td> -- <td>`width` (Width from hlist)</td> -- </tr> -- <tr> -- <td>`kern_node`</td> -- <td>`kern`</td> -- <td></td> -- <td>`-width`</td> -- </tr> -- <tr> -- <td>`color_text_node`</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Text color</td> -- </tr> -- <tr> -- <td></td> -- <td>`glyphs`</td> -- <td></td> -- <td>Text to show</td> -- </tr> -- <tr> -- <td>`tail_node`</td> -- <td>`glyph`</td> -- <td></td> -- <td>Last glyph in hlist</td> -- </tr> -- <tr> -- <td>`color_reset_node`</td> -- <td>`whatsit`</td> -- <td>`pdf_colorstack`</td> -- <td>Reset color</td> -- </tr> -- </tbody> -- </table> -- -- __Hide text:__ -- -- <table> -- <thead> -- <tr> -- <th>`strut_node`</th> -- <th>`kern`</th> -- <th></th> -- <th>width = 0</th> -- </tr> -- </thead> -- <tbody> -- <tr> -- <td>`line_node`</td> -- <td>`rule`</td> -- <td></td> -- <td>`width` (Width from hlist)</td> -- </tr> -- </tbody> -- </table> -- -- @tparam node head_node The head of a node list. local function make_par(head_node) --- Add one additional empty line at the end of a paragraph. -- -- All fields from the last hlist node are copied to the created -- hlist. -- -- @tparam node last_hlist_node The last hlist node of a paragraph. -- -- @treturn node The created new hlist node containing the line. local function add_additional_line(last_hlist_node) local hlist_node = node.new(node.id('hlist')) hlist_node.subtype = 1 local fields = { 'width', 'depth', 'height', 'shift', 'glue_order', 'glue_set', 'glue_sign', 'dir' } for _, field in ipairs(fields) do if last_hlist_node[field] then hlist_node[field] = last_hlist_node[field] end end local kern_node = create_kern_node(0) hlist_node.head = kern_node nodex.insert_line(kern_node, last_hlist_node.width) last_hlist_node.next = hlist_node hlist_node.prev = last_hlist_node hlist_node.next = nil return hlist_node end --- Add multiple empty lines at the end of a paragraph. -- -- @tparam node last_hlist_node The last hlist node of a paragraph. -- @tparam number count Count of the lines to add at the end. local function add_additional_lines(last_hlist_node, count) local i = 0 while i < count do last_hlist_node = add_additional_line(last_hlist_node) i = i + 1 end end local strut_node, line_node, width, last_hlist_node, hlist_node local line_count = 0 while head_node do if head_node.id == node.id('hlist') then hlist_node = head_node line_count = line_count + 1 last_hlist_node = hlist_node width = hlist_node.width hlist_node, strut_node, _ = insert_strut_into_hlist(hlist_node) line_node = nodex.insert_line(strut_node, width) if registry.get_value_show() then nodex.insert_list( 'after', line_node, { create_kern_node(-width), nodex.create_color('text') } ) nodex.insert_list( 'after', node.tail(head_node), {nodex.create_color('reset')} ) else line_node.next = nil end end head_node = head_node.next end local minlines = registry.get_value('minlines') local additional_lines = minlines - line_count if additional_lines > 0 then add_additional_lines(last_hlist_node, additional_lines) end return true end --- -- @tparam string callback_name The name of a callback -- @tparam function func A function to register for the callback -- @tparam string description Only used in LuaLatex local function register_callback(callback_name, func, description) if luatexbase then luatexbase.add_to_callback( callback_name, func, description ) else callback.register(callback_name, func) end end --- -- @tparam string callback_name The name of a callback -- @tparam string description Only used in LuaLatex local function unregister_callback(callback_name, description) if luatexbase then luatexbase.remove_from_callback( callback_name, description ) else callback.register(callback_name, nil) end end --- Exported functions. -- -- The `export` table contains functions which are published to the -- `cloze.lua` and `cloze.sty` file. -- -- @section export --- The `export` table contains some basic functions. `export` is the -- only table of this Lua module that will be exported. local export = {} --- Store informations if the callbacks are already registered for -- a certain mode (`basic`, `fix`, `par`). -- -- <code><pre> -- is_registered = { -- fix = true, -- basic = false, -- par = false, -- }</pre></code> -- export.is_registered = {} --- This function registers the functions `make_par`, `make_basic` and -- `make_fix` the Lua callbacks. -- -- `make_par` and `make_basic` are registered to the callback -- `post_linebreak_filter` and `make_fix` to the callback -- `pre_linebreak_filter`. The argument `mode` accepts the string values -- `basic`, `fix` and `par`. A special treatment is needed for clozes in -- display math mode. The `post_linebreak_filter` is not called on -- display math formulas. I’m not sure if the `pre_output_filter` is the -- right choice to capture the display math formulas. function export.register_callback(mode) if mode == 'par' then register_callback( 'post_linebreak_filter', make_par, mode ) return true end if not export.is_registered[mode] then if mode == 'basic' then register_callback( 'post_linebreak_filter', make_basic, mode ) register_callback( 'pre_output_filter', make_basic, mode ) elseif mode == 'fix' then register_callback( 'pre_linebreak_filter', make_fix, mode ) else return false end export.is_registered[mode] = true end end --- Delete the registered functions from the Lua callbacks. -- -- @tparam string mode The argument `mode` accepts the string values -- `basic`, `fix` and `par`. function export.unregister_callback(mode) if mode == 'basic' then unregister_callback('post_linebreak_filter', mode) unregister_callback('pre_output_filter', mode) elseif mode == 'fix' then unregister_callback('pre_linebreak_filter', mode) else unregister_callback('post_linebreak_filter', mode) end end -- Export some functions and values. --- Variable that can be used to store the previous fbox rule thickness -- to be able to restore the previous thickness. export.fboxrule_restore = nil export.write_linefil_nodes = write_linefil_nodes export.write_line_nodes = write_line_nodes export.write_margin_node = write_margin_node export.set_option = registry.set_option export.set_is_global = registry.set_is_global export.unset_local_options = registry.unset_local_options export.reset = registry.unset_global_options export.get_defaults = registry.get_defaults export.get_value = registry.get_value export.marker = registry.write_marker export.key_value_parser = key_value_parser return export
----------------------------------- -- Area: Al'Taieu -- NPC: Crystalline Field -- !pos .1 -10 -464 33 ----------------------------------- local ID = require("scripts/zones/AlTaieu/IDs") require("scripts/globals/missions") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) -- Set the PromathiaStatus to 3 if they did all 3 towers for GARDEN_OF_ANTIQUITY if (player:getCharVar("[SEA][AlTieu]SouthTowerCS") == 1 and player:getCharVar("[SEA][AlTieu]WestTowerCS") == 1 and player:getCharVar("[SEA][AlTieu]EastTowerCS") == 1 and player:getCharVar("PromathiaStatus") == 2) then player:setCharVar("[SEA][AlTieu]SouthTowerCS", 0) player:setCharVar("[SEA][AlTieu]WestTowerCS", 0) player:setCharVar("[SEA][AlTieu]EastTowerCS", 0) player:setCharVar("PromathiaStatus", 3) end if (player:getCurrentMission(COP) == tpz.mission.id.cop.GARDEN_OF_ANTIQUITY and player:getCharVar("PromathiaStatus") == 1) then player:startEvent(164) elseif (player:getCurrentMission(COP) > tpz.mission.id.cop.GARDEN_OF_ANTIQUITY or (player:getCurrentMission(COP) == tpz.mission.id.cop.GARDEN_OF_ANTIQUITY and player:getCharVar("PromathiaStatus") == 3)) then player:startEvent(100) -- Teleport inside else player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) -- Access should be restricted if below requirements. Message is probably wrong, though. end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if (csid == 100 and option == 1) then player:setPos(-20, 0.624, -355, 191, 34) -- {R} elseif (csid == 164) then player:setCharVar("PromathiaStatus", 2) end end
slot0 = class("EventFinishCommand", pm.SimpleCommand) slot0.execute = function (slot0, slot1) slot2 = slot1:getBody() slot4 = slot2.callback slot5 = slot2.onConfirm slot6 = getProxy(EventProxy) slot8, slot9 = slot6:CanFinishEvent(slot6:findInfoById(slot3)) if not slot8 then if slot9 then pg.TipsMgr.GetInstance():ShowTips(slot9) end if slot4 then slot4() end return end if slot7:IsActivityType() then slot0:sendNotification(GAME.ACT_COLLECTION_EVENT_OP, { arg2 = 0, cmd = ActivityConst.COLLETION_EVENT_OP_SUBMIT, arg1 = slot3, arg_list = {}, callBack = slot4, onConfirm = slot5 }) else pg.ConnectionMgr.GetInstance():Send(13005, { id = slot3 }, 13006, function (slot0) if slot0.result == 0 then slot1 = getProxy(EventProxy) slot1:findInfoById(slot0):SavePrevFormation() slot1.OnFinish(slot0, slot0, slot1.OnFinish) if slot0 then slot3() end else pg.TipsMgr.GetInstance():ShowTips(errorTip("event_finish_fail", slot0.result)) if errorTip then slot3() end end end) end end slot0.OnFinish = function (slot0, slot1, slot2) pg.TipsMgr.GetInstance():ShowTips(i18n("event_finish_success")) slot3 = getProxy(EventProxy) slot4 = {} slot5 = {} if slot1.exp > 0 then slot6 = getProxy(BayProxy) for slot11, slot12 in ipairs(slot7) do if slot6:getShipById(slot12) then slot14 = Clone(slot13) slot14:addExp(slot1.exp) slot6:updateShip(slot14) table.insert(slot4, slot13) table.insert(slot5, slot14) end end end slot7 = getProxy(PlayerProxy) slot8 = slot7:getData() slot8.collect_attack_count = slot8.collect_attack_count + 1 slot7:updatePlayer(slot8) slot9, slot13 = slot3:findInfoById(slot0) table.remove(slot3.eventList, slot10) _.each(slot1.new_collection, function (slot0) table.insert(slot0.eventList, EventInfo.New(slot0)) end) pg.ShipFlagMgr.GetInstance().UpdateFlagShips(slot11, "inEvent") pg.m02:sendNotification(GAME.EVENT_LIST_UPDATE) pg.m02:sendNotification(GAME.EVENT_SHOW_AWARDS, { eventId = slot0, oldShips = slot4, newShips = slot5, awards = PlayerConst.addTranDrop(slot1.drop_list), isCri = slot1.is_cri > 0, onConfirm = slot2 }) end return slot0
local timer = { list = {} } timer.new = function (key, delay) timer.list[key] = { delay = delay, timerCount = 0, enabled = true } end timer.isTimeTo = function (key, dt) local t = timer.list[key] if not t or not t.enabled then return false end t.timerCount = t.timerCount + dt if t.timerCount >= t.delay then t.timerCount = 0 t.enabled = false return true end end timer.completeIteration = function (key) local t = timer.list[key] if t then t.timerCount = t.delay end end timer.setDelay = function (key, delay) local t = timer.list[key] if t then t.delay = delay end end return timer
vim.g.tokyonight_style = "storm" vim.g.tokyonight_italic_comments = true vim.g.tokyonight_sidebars = { "qf", "vista_kind", "terminal", "packer" } vim.cmd[[colorscheme tokyonight]] require('lualine').setup { options = { -- ... your lualine config theme = 'tokyonight' -- ... your lualine config } }
function ToggleScoreboard(player, toggle) CallRemoteEvent(player, 'scorebork:ToggleScoreboard', toggle) end function InsertPlayer(player, other, name, level, ping) CallRemoteEvent(player, 'scorebork:InsertPlayer', other, name, level, ping) end function UpdatePlayer(player, value, newvalue) CallRemoteEvent(player, 'scorebork:UpdatePlayer', player, value, newvalue) end AddFunctionExport('ToggleScoreboard', ToggleScoreboard) AddFunctionExport('InsertPlayer', InsertPlayer) AddFunctionExport('UpdatePlayer', UpdatePlayer) AddRemoteEvent("scorebork:updateScoreboard", function (playerid) local players = GetAllPlayers() table.sort(players) for _, v in pairs(players) do --[[ if PlayerData[v] ~= nil then InsertPlayer(playerid, v, GetPlayerName(v), PlayerData[v].level, GetPlayerPing(v)) end ]]-- InsertPlayer(playerid, v, GetPlayerName(v), 1, GetPlayerPing(v)) end end)
local t = Def.ActorFrame{}; t[#t+1] = Def.ActorFrame{ LoadActor("bnrframe")..{ InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-138); }; }; t[#t+1] = Def.ActorFrame{ InitCommand=cmd(CenterX;y,SCREEN_CENTER_Y+130); OffCommand=cmd(sleep,0.15;linear,0.15;diffusealpha,0); Def.Sprite{ Texture="arrow"; InitCommand=cmd(x,224;rotationy,180;pause;setstate,0); }; Def.Sprite{ Texture="arrow"; InitCommand=cmd(x,224;rotationy,180;pause;diffusealpha,0;SetAllStateDelays,0.025); NextSongMessageCommand=cmd(stoptweening;pause;setstate,0;diffusealpha,1;play;sleep,0.4;diffusealpha,0;queuecommand,"end"); EndCommand=cmd(pause;setstate,0); }; Def.Sprite{ Texture="arrow"; InitCommand=cmd(x,-224;pause;setstate,0); }; Def.Sprite{ Texture="arrow"; InitCommand=cmd(x,-224;pause;diffusealpha,0;SetAllStateDelays,0.025); PreviousSongMessageCommand=cmd(stoptweening;pause;setstate,0;diffusealpha,1;play;sleep,0.4;diffusealpha,0;queuecommand,"end"); EndCommand=cmd(pause;setstate,0); }; }; --Stage t[#t+1] = Def.Sprite{ InitCommand=cmd(pause;y,SCREEN_CENTER_Y-244;x,SCREEN_CENTER_X+296;halign,1;queuecommand,"Set"); SetCommand=function(self) self:Load(THEME:GetPathG("","_shared2ndMIX/Stages 1x9")); local GetStage = GAMESTATE:GetCurrentStage(); if GetStage == 'Stage_1st' then self:setstate(0); elseif GetStage == 'Stage_2nd' then self:setstate(1); elseif GetStage == 'Stage_3rd' then self:setstate(2); elseif GetStage == 'Stage_4th' then self:setstate(3); elseif GetStage == 'Stage_5th' then self:setstate(4); elseif GetStage == 'Stage_Final' then self:setstate(5); elseif GetStage == 'Stage_Extra1' then self:setstate(6); elseif GetStage == 'Stage_Extra2' then self:setstate(7); elseif GetStage == 'Stage_Event' then self:setstate(8); else self:visible(false) end; end; }; t[#t+1] = Def.Sprite{ InitCommand=cmd(pause;y,SCREEN_CENTER_Y-244;x,SCREEN_CENTER_X-296;halign,0;queuecommand,"Set"); SetCommand=function(self) self:Load(THEME:GetPathG("","_shared2ndMIX/Difficulty 1x3.png")); if getenv("TWOMIXEASY") then self:setstate(0); elseif getenv("TWOMIXNORM") then self:setstate(1); elseif getenv("TWOMIXHARD") then self:setstate(2); else self:visible(false) end; end; }; --Style t[#t+1] = Def.Sprite{ InitCommand=cmd(CenterX;y,SCREEN_CENTER_Y-16;queuecommand,"Set"); SetCommand=function(s) local style = GAMESTATE:GetCurrentStyle():GetStyleType() if style == 'StyleType_OnePlayerOneSide' then s:Load(THEME:GetPathG("","_shared2ndMIX/Styles/single")); elseif style == 'StyleType_TwoPlayersTwoSides' then s:Load(THEME:GetPathG("","_shared2ndMIX/Styles/versus")); elseif style == 'StyleType_OnePlayerTwoSides' then s:Load(THEME:GetPathG("","_shared2ndMIX/Styles/double")); elseif style == 'StyleType_TwoPlayersSharedSides' then s:Load(THEME:GetPathB("","_shared2ndMIX/Styles/couple")); end; end; }; --Since we lock difficulty changes to Screen2ndMIXSelectGameMode, we just get the master player. local PLAYER = GAMESTATE:GetMasterPlayerNumber() t[#t+1] = Def.Sprite{ Texture = "Basic"; InitCommand=cmd(pause;visible,false;CenterX;y,SCREEN_BOTTOM-170;queuecommand,"Set"); CurrentSongChangedMessageCommand=cmd(queuecommand,"Set"); CurrentCourseChangedMessageCommand=cmd(queuecommand,"Set"); CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set"); CurrentStepsP2ChangedMessageCommand=cmd(queuecommand,"Set"); SetCommand=function(self,params) local song = GAMESTATE:GetCurrentSong(); local st = GAMESTATE:GetCurrentStyle():GetStepsType(); local diff = GAMESTATE:GetCurrentSteps(PLAYER):GetDifficulty(); if song then if diff == 'Difficulty_Beginner' then self:visible(true); self:Load(THEME:GetPathB("","Screen2ndMIXSelectMusic decorations/Beginner")); elseif diff == 'Difficulty_Easy' then self:visible(true); self:Load(THEME:GetPathB("","Screen2ndMIXSelectMusic decorations/basic")); elseif diff == 'Difficulty_Medium' then self:visible(true); self:Load(THEME:GetPathB("","Screen2ndMIXSelectMusic decorations/another")); elseif diff == 'Difficulty_Hard' then self:visible(true); self:Load(THEME:GetPathB("","Screen2ndMIXSelectMusic decorations/maniac")); elseif diff == 'Difficulty_Challenge' then self:visible(true); self:Load(THEME:GetPathB("","Screen2ndMIXSelectMusic decorations/Challenge")); else self:visible(false) end; local steps = song:GetOneSteps(GAMESTATE:GetCurrentStyle():GetStepsType(), diff) local meter = steps:GetMeter(); self:setstate(math.min(meter-1, 9)); else self:visible(false) end; end; }; t[#t+1] = Def.Sprite{ InitCommand=cmd(pause;visible,false;CenterX;y,SCREEN_BOTTOM-120;queuecommand,"Set"); CurrentSongChangedMessageCommand=cmd(queuecommand,"Set"); CurrentCourseChangedMessageCommand=cmd(queuecommand,"Set"); CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set"); CurrentStepsP2ChangedMessageCommand=cmd(queuecommand,"Set"); SetCommand=function(self,params) local song = GAMESTATE:GetCurrentSong(); local st = GAMESTATE:GetCurrentStyle():GetStepsType(); local diff = GAMESTATE:GetCurrentSteps(PLAYER):GetDifficulty(); if song then local songtit = song:GetDisplayMainTitle(); if diff == 'Difficulty_Beginner' then self:visible(true); self:Load(THEME:GetPathG("","_shared2ndMIX/FootDiffBasic 1x10")); if SongDiffTitleBasic[songtit] ~= nil then self:setstate(SongDiffTitleBasic[songtit]) self:visible(true) else local randomnum = math.random(0,9); self:setstate(randomnum) self:visible(true) end; elseif diff == 'Difficulty_Easy' then self:visible(true); self:Load(THEME:GetPathG("","_shared2ndMIX/FootDiffBasic 1x10")); if SongDiffTitleBasic[songtit] ~= nil then self:setstate(SongDiffTitleBasic[songtit]) self:visible(true) else local randomnum = math.random(0,9); self:setstate(randomnum) self:visible(true) end; elseif diff == 'Difficulty_Medium' then self:visible(true); self:Load(THEME:GetPathG("","_shared2ndMIX/FootDiffAnother 1x10")); if SongDiffTitleAnother[songtit] ~= nil then self:setstate(SongDiffTitleAnother[songtit]) self:visible(true) else local randomnum = math.random(0,9); self:setstate(randomnum) self:visible(true) end; elseif diff == 'Difficulty_Hard' then self:visible(true); self:Load(THEME:GetPathG("","_shared2ndMIX/FootDiffManiac 1x10")); if SongDiffTitleManiac[songtit] ~= nil then self:setstate(SongDiffTitleManiac[songtit]) self:visible(true) else local randomnum = math.random(0,9); self:setstate(randomnum) self:visible(true) end; elseif diff == 'Difficulty_Challenge' then self:visible(true); self:Load(THEME:GetPathG("","_shared2ndMIX/FootDiffManiac 1x10")); if SongDiffTitleManiac[songtit] ~= nil then self:setstate(SongDiffTitleManiac[songtit]) self:visible(true) else local randomnum = math.random(0,9); self:setstate(randomnum) self:visible(true) end; else self:visible(false) end; else self:visible(false) end; end; }; t[#t+1] = LoadActor("bottom")..{ InitCommand=cmd(CenterX;y,SCREEN_BOTTOM-64); }; -- Dancer 1P t[#t+1]=Def.Sprite{ InitCommand = cmd(player,PLAYER_1;vertalign,bottom;diffusealpha,0.75;x,SCREEN_CENTER_X-380;y,SCREEN_CENTER_Y+190;blend,Blend.Add); OnCommand =function(self) self:Load(THEME:GetPathG("","_Dancer/1Pdancer 24x1.png")); self:playcommand("Set"); end; -- SetCommand base from DDR 5th MIX by AJ 187 SetCommand=function(self) self:SetAllStateDelays(0.05); end; CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); PlayerJoinedMessageCommand=function(self, params) if params.Player == PLAYER_1 then self:visible(true); (cmd(zoom,0;bounceend,0.3;zoom,1))(self); end; end; PlayerUnjoinedMessageCommand=function(self, params) if params.Player == PLAYER_1 then self:visible(true); (cmd(bouncebegin,0.3;zoom,0))(self); end; end; OffCommand=cmd(diffusealpha,0); }; -- Dancer 2P t[#t+1]=Def.Sprite{ InitCommand = cmd(player,PLAYER_2;vertalign,bottom;zoom,1.5;diffuse,PlayerColor(PLAYER_2);diffusealpha,0.75;x,SCREEN_CENTER_X+240;y,SCREEN_CENTER_Y+43;blend,Blend.Add); OnCommand =function(self) local Ramdoms = {"A","B","C","D"} local RamdomDancer = Ramdoms[math.random(#Ramdoms)]; self:Load(THEME:GetPathG("","_Dancer/2Pdancer"..RamdomDancer)); self:playcommand("Set"); end; SetCommand=function(self) local song = GAMESTATE:GetCurrentSong() if song then local dispBpms = song:GetDisplayBpms() local bpmLimited = clamp(math.abs(dispBpms[2]),1,9999) local bps = (1/bpmLimited)*5; self:SetAllStateDelays(bps); else self:SetAllStateDelays(0.042); end; end; CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); PlayerJoinedMessageCommand=function(self, params) if params.Player == PLAYER_2 then self:visible(true); (cmd(zoom,0;bounceend,0.3;zoom,1.5))(self); end; end; PlayerUnjoinedMessageCommand=function(self, params) if params.Player == PLAYER_2 then self:visible(true); (cmd(bouncebegin,0.3;zoom,0))(self); end; end; OffCommand=cmd(diffusealpha,0); }; t[#t+1] = Def.ActorFrame{ LoadActor(THEME:GetPathG("","_shared2ndMIX/1P.png"))..{ InitCommand=cmd(xy,SCREEN_CENTER_X-415,SCREEN_CENTER_Y+176;visible,false); OnCommand=function(s) if GAMESTATE:IsPlayerEnabled(PLAYER_1) then s:visible(true) else s:visible(false) end; end; }; }; t[#t+1] = Def.ActorFrame{ LoadActor(THEME:GetPathG("","_shared2ndMIX/2P.png"))..{ InitCommand=cmd(xy,SCREEN_CENTER_X+415,SCREEN_CENTER_Y+176;visible,false); OnCommand=function(s) if GAMESTATE:IsPlayerEnabled(PLAYER_2) then s:visible(true) else s:visible(false) end; end; }; }; t[#t+1] = Def.Sprite{ InitCommand=function(self) self:Load(THEME:GetPathG("","_shared2ndMIX/CDTitles 4x3")); self:pause() self:xy(SCREEN_CENTER_X+220,SCREEN_CENTER_Y+30) end; SetCommand=function(self) local song = GAMESTATE:GetCurrentSong() if song then local songtit = song:GetDisplayMainTitle(); if CDTitles[songtit] ~= nil then self:setstate(CDTitles[songtit]) self:visible(true) else self:setstate(3) self:visible(true) end; else self:setstate(0) self:visible(false) end; end; CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); }; return t
-- include useful files u_execDependencyScript("ohvrvanilla", "base", "vittorio romeo", "utils.lua") u_execDependencyScript("ohvrvanilla", "base", "vittorio romeo", "common.lua") u_execDependencyScript("ohvrvanilla", "base", "vittorio romeo", "commonpatterns.lua") u_execDependencyScript("ohvrvanilla", "base", "vittorio romeo", "nextpatterns.lua") u_execDependencyScript("ohvrvanilla", "base", "vittorio romeo", "evolutionpatterns.lua") -- this function adds a pattern to the timeline based on a key function addPattern(mKey) if mKey == 0 then cBarrage(0) elseif mKey == 1 then hmcBarrageN(0, 0, 0, 0.05, -3.8, 2.7, true); t_wait(55) elseif mKey == 2 then hmcBarrageN(0, 0, 0, -0.05, -2.7, 3.8, true); t_wait(55) end end -- shuffle the keys, and then call them to add all the patterns -- shuffling is better than randomizing - it guarantees all the patterns will be called keys = { 1, 1, 2, 2 } shuffle(keys) index = 0 achievementUnlocked = false -- onInit is an hardcoded function that is called when the level is first loaded function onInit() l_setSpeedMult(1.1) l_setSpeedInc(0.045) l_setRotationSpeed(0.1) l_setRotationSpeedMax(0.4) l_setRotationSpeedInc(0.045) l_setDelayMult(1.0) l_setDelayInc(0.0) l_setFastSpin(71.0) l_setSides(6) l_setSidesMin(5) l_setSidesMax(7) l_setIncTime(0) l_setWallSkewLeft(18) l_setPulseMin(64) l_setPulseMax(84) l_setPulseSpeed(1.05) l_setPulseSpeedR(1.35) l_setPulseDelayMax(7) l_setBeatPulseMax(15) l_setBeatPulseDelayMax(110) l_setSwapEnabled(true) l_setTutorialMode(true) l_setIncEnabled(false) end swappedOnce = false swapTime = false -- onCursorSwap is executed whenever the player executes a successful 180° swap function onCursorSwap() if (swapTime and not swappedOnce) then swappedOnce = true e_clearMessages() end end -- onLoad is an hardcoded function that is called when the level is started/restarted function onLoad() e_waitS(1) e_messageAddImportant("Welcome to the evolution tutorial", 150) e_messageAddImportant("Today you'll be introduced to...", 120) e_messageAddImportant("swapping, accelerating walls, and curving walls!", 300) e_wait(570 + 120) e_messageAddImportant("Swapping allows you to instantly rotate 180 degrees!", 200) e_messageAddImportant("You can only swap when your player\nblinks red and yellow!", 250) e_wait(450) e_eval([[swapTime = true]]) e_messageAddImportant("Try swapping now!\nPress space or middle mouse button to swap", 10000) end function partTwo() e_messageAddImportant("Awesome!", 120) e_messageAddImportant("After swapping, you must wait before\nswapping again!", 250) e_messageAddImportant("Let's introduce a swap pattern.", 180); e_messageAddImportant("For this pattern, you must swap to survive", 180) e_messageAddImportant("Swap at the right moment!", 180) e_wait(180 * 3 + 120 + 250 + 120) e_messageAddImportant("Excellent! You know how to swap!", 120) t_wait(610) pSwapBarrage(getRandomSide(), 2) e_messageAddImportant("Let's talk about accelerating walls", 180); e_messageAddImportant("These walls can change speed over time", 180); e_messageAddImportant("They can either accelerate...", 180); e_messageAddImportant("Decelerate...", 180); e_messageAddImportant("Or go completely backwards to trick you!", 180); e_wait(180 * 5 + 120 + 120) t_wait(760); pACBarrageAccelerate(); t_wait(120); pACBarrageDecelerate(); t_wait(100); pACBarrageDeception(3, 1); e_messageAddImportant("But wait, it gets crazier!", 120); e_messageAddImportant("Let's focus on curving walls", 120) e_messageAddImportant("they can be simple...", 120) e_wait(300 + 410) t_wait(300) hmcSimpleBarrage(0, 1) t_wait(100) hmcSimpleBarrage(0, -1) t_wait(50) hmcSimpleBarrage(0, math.random(1, 6)) t_wait(100) hmcSimpleBarrage(0, -math.random(1, 6)) t_wait(80) hmcSimpleBarrage(0, math.random(1, 6)) t_wait(80) hmcSimpleBarrage(0, math.random(-6, 6)) t_wait(50) e_messageAddImportant("...in various patterns...", 130) e_wait(100 + 120 * 5 + 80) t_wait(130) hmcSimpleTwirl(5, math.random(-3, 3), 0) t_wait(50) hmcSimpleTwirl(5, -2, 1) e_messageAddImportant("...or can accelerate!", 130) e_wait(130 + 340) t_wait(130) hmcBarrage(0, 0.05, -1.5, 3, true) t_wait(80) hmcBarrage(0, -0.05, -3, 3, true) t_wait(100) hmcBarrage(0, 0.1, -2, 2, true) t_wait(100) hmcBarrage(0, 0.1, -3, 3, true) t_wait(200) e_messageAddImportant("they can also do crazy stuff!", 180) e_wait(120 * 9) hmcSimpleCage(2, 1) t_wait(80) hmcSimpleCage(2, -1) t_wait(100) hmcSimpleCage(2, 1) hmcSimpleCage(2, 1) t_wait(100) hmcSimpleCage(2, 1) hmcSimpleCage(2, -1) t_wait(100) hmcSimpleSpinner(getRandomSide(), 1) t_wait(100) hmcGrowBarrage(getRandomSide(), 0) t_wait(100) hmcGrowBarrage(getRandomSide(), 3) t_wait(100) hmcGrowBarrage(getRandomSide(), 6) t_wait(100) hmcAssembleBarrage(getRandomSide()) t_wait(100) hmcAssembleBarrage(getRandomSide()) t_wait(100) hmcAssembleBarrage(getRandomSide()) t_wait(700) e_messageAddImportant("Well done!", 130) e_messageAddImportant("You should be prepared to take on Hypercube!", 300) e_messageAddImportant("Have fun!", 1000) e_wait(340) e_kill() end -- onStep is an hardcoded function that is called when the level timeline is empty -- onStep should contain your pattern spawning logic function onStep() end -- onIncrement is an hardcoded function that is called when the level difficulty is incremented function onIncrement() end -- onUnload is an hardcoded function that is called when the level is closed/restarted function onUnload() end -- continuous direction change (even if not on level increment) dirChangeTime = 600 -- onUpdate is an hardcoded function that is called every frame function onUpdate(mFrameTime) --print(l_getPulse()); if (swappedOnce and swapTime) then partTwo() swapTime = false end dirChangeTime = dirChangeTime - mFrameTime; if dirChangeTime < 0 then -- do not change direction while fast spinning if u_isFastSpinning() == false then l_setRotationSpeed(l_getRotationSpeed() * -1.0) dirChangeTime = 400 end end if not achievementUnlocked and l_getLevelTime() > 69 then steam_unlockAchievement("a11_evotutorial") achievementUnlocked = true end end
return { "icons/dwarf_skill/skill_psy1-1", "icons/dwarf_skill/skill_psy1-2", "icons/dwarf_skill/skill_psy10-1", "icons/dwarf_skill/skill_psy12-1", "icons/dwarf_skill/skill_psy14-1", "icons/dwarf_skill/skill_psy16-1", "icons/dwarf_skill/skill_psy16-2", "icons/dwarf_skill/skill_psy18-1", "icons/dwarf_skill/skill_psy18-2", "icons/dwarf_skill/skill_psy2-1", "icons/dwarf_skill/skill_psy20-1", "icons/dwarf_skill/skill_psy22-1", "icons/dwarf_skill/skill_psy24-1", "icons/dwarf_skill/skill_psy26-1", "icons/dwarf_skill/skill_psy28-1", "icons/dwarf_skill/skill_psy30-1", "icons/dwarf_skill/skill_psy32-1", "icons/dwarf_skill/skill_psy34-1", "icons/dwarf_skill/skill_psy36-1", "icons/dwarf_skill/skill_psy36-2", "icons/dwarf_skill/skill_psy38-1", "icons/dwarf_skill/skill_psy4-1", "icons/dwarf_skill/skill_psy4-2", "icons/dwarf_skill/skill_psy40-1", "icons/dwarf_skill/skill_psy6-1", "icons/dwarf_skill/skill_psy8-1", "icons/dwarf_skill/skill_psy_har60-1", "icons/dwarf_skill/skill_psy_har70-1", "icons/dwarf_skill/skill_psy_mag60-1", "icons/dwarf_skill/skill_psy_mag70-1", "icons/dwarf_skill/skill_psy_pri15-1", "icons/dwarf_skill/skill_psy_pri20-1", "icons/dwarf_skill/skill_psy_pri25-1", "icons/dwarf_skill/skill_psy_pri30-1", "icons/dwarf_skill/skill_psy_pri35-1", "icons/dwarf_skill/skill_psy_pri40-1", "icons/dwarf_skill/skill_psy_pri45-1", "icons/dwarf_skill/skill_psy_pri50-1", "icons/dwarf_skill/skill_psy_pri60-1", "icons/dwarf_skill/skill_psy_pri70-1", "icons/dwarf_skill/skill_psy_thi15-1", "icons/dwarf_skill/skill_psy_thi20-1", "icons/dwarf_skill/skill_psy_thi25-1", "icons/dwarf_skill/skill_psy_thi30-1", "icons/dwarf_skill/skill_psy_thi35-1", "icons/dwarf_skill/skill_psy_thi40-1", "icons/dwarf_skill/skill_psy_thi45-1", "icons/dwarf_skill/skill_psy_thi50-1", "icons/dwarf_skill/skill_psy_thi60-1", "icons/dwarf_skill/skill_psy_thi70-1", "icons/dwarf_skill/skill_psy_war60-1", "icons/dwarf_skill/skill_psy_war70-1", }
shibb_gnarled_rancor = Creature:new { objectName = "@mob/creature_names:thug", randomNameType = NAME_GENERIC, randomNameTag = true, socialGroup = "brigand", faction = "", level = 17, chanceHit = 0.32, damageMin = 180, damageMax = 190, baseXp = 1257, baseHAM = 3500, baseHAMmax = 4300, armor = 0, resists = {0,0,0,0,0,0,0,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0, ferocity = 0, pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY, creatureBitmask = PACK + KILLER + STALKER, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/rancor_hue.iff"}, controlDeviceTemplate = "object/intangible/pet/rancor_hue.iff", scale = 1.1, lootGroups = {}, weapons = {}, attacks = { {"stunattack",""}, {"intimidationattack",""} } } CreatureTemplates:addCreatureTemplate(shibb_gnarled_rancor, "shibb_gnarled_rancor")
CreateThread(function() while (not NetworkIsSessionStarted()) do Wait(50) end TriggerServerEvent("dl-core:playerJoined") end) CreateThread(function() while (true) do if (isLoggedIn) then Wait((1000 * 60) * 30) TriggerServerEvent("dl-core:server:updatePlayerSalary") TriggerEvent("dl-phone:client:NotifySalary", DLCore.Functions.GetPlayerData().job.payment, DLCore.Functions.GetPlayerData().money["bank"] + DLCore.Functions.GetPlayerData().job.payment) else Wait(2000) end Wait(0) end end) CreateThread(function() while (true) do if (isLoggedIn) then Wait((1000 * 60) * 1) TriggerServerEvent("dl-core:server:updatePlayer") else Wait(2000) end Wait(0) end end) CreateThread(function() while true do Wait(7) if isLoggedIn then Wait(30000) TriggerEvent("dl-core:client:updatePlayerPosition") else Wait(5000) end end end) local playerPed, playerHealth, playerData CreateThread(function() while (true) do playerPed = PlayerPedId() SetPedSuffersCriticalHits(playerPed, false) if (isLoggedIn) then playerData = DLCore.Functions.GetPlayerData() if (playerData.metadata["hunger"] <= 0 or playerData.metadata["thirst"] <= 0) then playerHealth = GetEntityHealth(playerPed) SetEntityHealth(playerPed, playerHealth - 20) end end Wait(5000) end end)
function Client_PresentSettingsUI(rootParent) root = rootParent; UI.CreateLabel(rootParent).SetText('AI Settings'); CreateLine('AIs are allowed to declare war on player : ', Mod.Settings.AllowAIDeclaration,false,true,'With this enabled, AIs will declare war on players(players turned into AI are excluded). This happens pretty much like they normaly attack --> they will declare war mainly on their surrounding players but also on those that they try to play cards on. If this is disabled and you are in war with an AI(e.g. since a player got booted and turned into AI, it will continue to fight you.'); CreateLine('AIs are allowed to declare war on AIs : ', Mod.Settings.AIsdeclearAIs,false,true,'With this enabled, AIs will declare war on other AIs or players turned into AI. This happens pretty much like they normaly attack --> they will declare war mainly on their surrounding players but also on those that they try to play cards on.'); UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Alliance Settings'); if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then CreateLine('Allied players can see your territories : ', Mod.Settings.SeeAllyTerritories,true,true,'If spycards are in the game and this feature is enabled, the mod automaticaly plays a spycard on all your allies so you can see their territories, this does not effect the lower setting that effects the normal playing of spycards on allies. For that it will not use your spycards.'); CreateLine('Allies are visible to everyone : ', Mod.Settings.PublicAllies,true,true,'This setting makes alliances be announced to everyone and visible in everyones history if set to true, otherwise it will only be visible for the players that made the alliance'); else UI.CreateLabel(root).SetText("Alliances are disabled").SetColor('#FF0000'); end UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Card Settings'); UI.CreateLabel(rootParent).SetText('Sanction Card'); if(AlwaysPlayable(Mod.Settings.SanctionCardRequireWar,Mod.Settings.SanctionCardRequirePeace,Mod.Settings.SanctionCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Sanction Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.SanctionCardRequireWar,Mod.Settings.SanctionCardRequirePeace,Mod.Settings.SanctionCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Sanction Cards are unplayable').SetColor('#FF0000'); else CreateLine('Sanction Cards can be played on players you are in war with : ', Mod.Settings.SanctionCardRequireWar,true,false); CreateLine('Sanction Cards can be played on players you are in peace with : ', Mod.Settings.SanctionCardRequirePeace,false,false); if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then CreateLine('Sanction Cards can be played on players you are allied with : ', Mod.Settings.SanctionCardRequireAlly,false,false); end end end UI.CreateLabel(rootParent).SetText('Bomb Card'); if(AlwaysPlayable(Mod.Settings.BombCardRequireWar,Mod.Settings.BombCardRequirePeace,Mod.Settings.BombCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Bomb Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.BombCardRequireWar,Mod.Settings.BombCardRequirePeace,Mod.Settings.BombCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Bomb Cards are unplayable').SetColor('#FF0000'); else CreateLine('Bomb Cards can be played on players you are in war with : ', Mod.Settings.BombCardRequireWar,true,false); CreateLine('Bomb Cards can be played on players you are in peace with : ', Mod.Settings.BombCardRequirePeace,false,false); if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then CreateLine('Bomb Cards can be played on players you are allied with : ', Mod.Settings.BombCardRequireAlly,false,false); end end end UI.CreateLabel(rootParent).SetText('Spy Card'); if(AlwaysPlayable(Mod.Settings.SpyCardRequireWar,Mod.Settings.SpyCardRequirePeace,Mod.Settings.SpyCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Spy Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.SpyCardRequireWar,Mod.Settings.SpyCardRequirePeace,Mod.Settings.SpyCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Spy Cards are unplayable').SetColor('#FF0000'); else CreateLine('Spy Cards can be played on players you are in war with : ', Mod.Settings.SpyCardRequireWar,true,false); CreateLine('Spy Cards can be played on players you are in peace with : ', Mod.Settings.SpyCardRequirePeace,false,false); if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then CreateLine('Spy Cards can be played on players you are allied with : ', Mod.Settings.SpyCardRequireAlly,false,false); end end end UI.CreateLabel(rootParent).SetText('Gift Card'); if(AlwaysPlayable(Mod.Settings.GiftCardRequireWar,Mod.Settings.GiftCardRequirePeace,Mod.Settings.GiftCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Gift Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.GiftCardRequireWar,Mod.Settings.GiftCardRequirePeace,Mod.Settings.GiftCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Gift Cards are unplayable').SetColor('#FF0000'); else CreateLine('Gift Cards can be played on players you are in war with : ', Mod.Settings.GiftCardRequireWar,false,false); CreateLine('Gift Cards can be played on players you are in peace with : ', Mod.Settings.GiftCardRequirePeace,true,false); if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then CreateLine('Gift Cards can be played on players you are allied with : ', Mod.Settings.GiftCardRequireAlly,true,false); end end end if(Mod.Settings.SeePeaceTerritories ~= nil)then UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Other Settings'); CreateLine('Players in peace to each other can see each others territories : ', Mod.Settings.SeePeaceTerritories,true,true,'If spycards are in the game and this feature is enabled, the mod automaticaly plays a spycard on all players you are in peace with so you can see their territories, this does not effect the lower setting that effects the normal playing of spycards. For that it will not use your spycards. Usefull in games with fog'); end end function CreateLine(settingname,variable,default,important, help) local horz = UI.CreateHorizontalLayoutGroup(root); local lab = UI.CreateLabel(horz); if(default == true or default == false)then if(help ~= null)then lab.SetText(settingname); UI.CreateButton(horz).SetText('?').SetColor('#4FC5FF').SetOnClick(function() UI.Alert(help); end); lab = UI.CreateLabel(horz); lab.SetText(booltostring(variable,default)); else lab.SetText(settingname .. booltostring(variable,default)); end else if(variable == nil)then if(help ~= null)then lab.SetText(settingname); UI.CreateButton(horz).SetText('?').SetColor('#4FC5FF').SetOnClick(function() UI.Alert(help); end); lab = UI.CreateLabel(horz); lab.SetText(default); else lab.SetText(settingname .. default); end else lab.SetText(settingname .. variable); end end if(variable ~= nil and variable ~= default)then if(important == true)then lab.SetColor('#FF0000'); else lab.SetColor('#FFFF00'); end end end function booltostring(variable,default) if(variable == nil)then if(default)then return "Yes"; else return "No"; end end if(variable)then return "Yes"; else return "No"; end end function AlwaysPlayable(warsetting,peacesetting,allysetting) if(peacesetting == nil and allysetting == nil)then if(warsetting == nil)then return true; else if(warsetting)then return false; else return true; end end end if(peacesetting and allysetting and warsetting)then return true; end return false; end function NeverPlayable(warsetting,peacesetting,allysetting) if(peacesetting == nil and allysetting == nil)then return false; end if(Mod.Settings.DisableAllies == nil or Mod.Settings.DisableAllies == false)then if(peacesetting == false and allysetting == false and warsetting == false)then return true; end else if(peacesetting == false and warsetting == false)then return true; end end return false; end
_ENV=namespace "ui" using_namespace "luaClass" using_namespace "container" class("CardUI"){ super(cc.DrawNode); super(LUIObject); SINGAL.touched("touch","event","CardUI"); property "onTouch" {WRITE.onCardTouch}; public{ FUNCTION.CardUI(function(self,size,color) self=self:__super() self:LUIObject() self:setCascadeOpacityEnabled(true) local pointArray={ cc.p(0,0), cc.p(size.width,0), cc.p(size.width,size.height), cc.p(size.width/5,size.height), cc.p(0,size.height*0.8) } local fill=color or cc.c4f(0,0,0,0.6) self:drawPolygon(pointArray,5,fill,2,fill) self:setContentSize(size) end); FUNCTION.setText(function(self,text,fontSize) if self._label==nil then fontSize=fontSize or 20 self._label=createLabel(text,fontSize) :setAnchorPoint(0,0) :setPosition(0,0) :setTag(10) :addTo(self) else self._label:setString(text) end return self end); FUNCTION.onCardTouch(function(self,swall) local onBegin=function(touch,event) self:setOpacity(128) end local move=function() self:setOpacity(255) end local onEnd=function(touch,event,inRect) self:setOpacity(255) if inRect and self:isVisible()==true then self:touched(touch,event,self) end end onNodeTouchIn(self,onBegin,move,onEnd,swall) end); }; protected{ MEMBER._label; }; }
--------------------------------------------------------------------------------------------------- -- Description: Resumption of subscription for MEDIA app service data after unexpected disconnect -- Precondition: -- 1) Application with <appID> is registered on SDL. -- 2) Specific permissions are assigned for <appID> with OnAppServiceData -- 3) HMI has published a MEDIA service -- 4) Application is subscribed to MEDIA app service data -- 5) Transport reconnection is performed -- Sequence: -- 1. Mobile app registers with actual hashID --   a. SDL starts data resumption -- 2. SDL resumes subscription for MEDIA app service data sends AppService.GetAppServiceData request to HMI --   a. HMI responds with success resultCode -- 3. After success response from HMI SDL resumes the subscription -- 4. HMI sends OnAppServiceData notification --   a. SDL resend OnAppServiceData notification to mobile app --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/AppServices/commonAppServices') local test = require("user_modules/dummy_connecttest") local events = require('events') local utils = require('user_modules/utils') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false -- [[Local Variable]] local hashID --[[ Local Functions ]] local function PTUfunc(tbl) tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); end local manifest = { serviceName = "HMI_MEDIA_SERVICE", serviceType = "MEDIA", allowAppConsumers = true, rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, mediaServiceManifest = {} } local rpc = { name = "OnAppServiceData", hmiName = "AppService.OnAppServiceData" } local appServiceData = { serviceType = manifest.serviceType, mediaServiceData = { mediaType = "MUSIC", mediaTitle = "Song name", mediaArtist = "Band name", mediaAlbum = "Album name", playlistName = "Good music", isExplicit = false, trackPlaybackProgress = 200, trackPlaybackDuration = 300, queuePlaybackProgress = 2200, queuePlaybackDuration = 4000, queueCurrentTrackNumber = 12, queueTotalTrackCount = 20 } } local expectedNotification = { serviceData = appServiceData } local function processRPCSuccess() local mobileSession = common.getMobileSession() local service_id = common.getAppServiceID(0) local notificationParams = expectedNotification notificationParams.serviceData.serviceID = service_id common.getHMIConnection():SendNotification(rpc.hmiName, notificationParams) mobileSession:ExpectNotification(rpc.name, notificationParams) end local function checkResumption(pAppId) common.getHMIConnection():ExpectRequest("BasicCommunication.ActivateApp", {}) :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) common.getMobileSession(pAppId):ExpectNotification("OnHMIStatus", { hmiLevel = "NONE" }, { hmiLevel = "FULL" }) :Times(2) end local function reRegisterApp(pAppId) if not pAppId then pAppId = 1 end common.getMobileSession():StartService(7) :Do(function() local params = utils.cloneTable(common.getConfigAppParams(pAppId)) params.hashID = hashID local corId = common.getMobileSession():SendRPC("RegisterAppInterface", params) common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered", { application = { appName = common.getConfigAppParams(pAppId).appName } }) common.getMobileSession():ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) :Do(function() common.getMobileSession(pAppId):ExpectNotification("OnPermissionsChange") end) end) checkResumption(pAppId) end local function unexpectedDisconnect() test.mobileConnection:Close() common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = true }) :Do(function() for i = 1, common.getAppsCount() do test.mobileSession[i] = nil end end) end local function connectMobile() test.mobileConnection:Connect() common.getMobileSession():ExpectEvent(events.connectedEvent, "Connected") :Do(function() utils.cprint(35, "Mobile connected") end) end local function mobileSubscribeAppServiceData(pAppId) if not pAppId then pAppId = 1 end common.getMobileSession(pAppId):ExpectNotification("OnHashChange") :Do(function(_, data) hashID = data.payload.hashID end) common.mobileSubscribeAppServiceData(0) end -- [[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("App registration", common.registerApp) runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) runner.Step("App activation", common.activateApp) runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) runner.Step("Subscribe App Service Data", mobileSubscribeAppServiceData) runner.Title("Test") runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) runner.Step("Unexpected disconnect", unexpectedDisconnect) runner.Step("Connect mobile", connectMobile) runner.Step("App Reregistration", reRegisterApp) runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
_AMD_SAMPLE_NAME = "CrossfireSample" dofile ("../../premake/amd_premake_util.lua") workspace (_AMD_SAMPLE_NAME) configurations { "Debug", "Release" } platforms { "x64" } location "../build" filename (_AMD_SAMPLE_NAME .. _AMD_VS_SUFFIX) startproject (_AMD_SAMPLE_NAME) filter "platforms:x64" system "Windows" architecture "x64" project (_AMD_SAMPLE_NAME) kind "ConsoleApp" language "C++" characterset "Unicode" location "../build" filename (_AMD_SAMPLE_NAME .. _AMD_VS_SUFFIX) uuid "4C0AC3AC-57E7-4DCD-8B36-7074CA208B3B" targetdir "../bin" objdir "../build/%{_AMD_SAMPLE_DIR_LAYOUT}" warnings "Extra" floatingpoint "Fast" symbols "On" -- Specify WindowsTargetPlatformVersion here for VS2015 systemversion (_AMD_WIN_SDK_VERSION) -- Copy DLLs to the local bin directory postbuildcommands { amdAgsSamplePostbuildCommands(true) } postbuildmessage "Copying dependencies..." files { "../src/**.h", "../src/**.cpp", "../src/**.hlsl", "../../%{_AMD_AGS_DIRECTORY_NAME}/inc/*.h" } includedirs { "../../%{_AMD_AGS_DIRECTORY_NAME}/inc" } libdirs { "../../%{_AMD_AGS_DIRECTORY_NAME}/lib" } links { "amd_ags_x64", "d3dcompiler", "d3d11" } filter "configurations:Debug" defines { "WIN32", "_DEBUG", "_CONSOLE", "_WIN32_WINNT=0x0601" } flags { "FatalWarnings" } targetsuffix ("_Debug" .. _AMD_VS_SUFFIX) filter "configurations:Release" defines { "WIN32", "NDEBUG", "_CONSOLE", "_WIN32_WINNT=0x0601" } flags { "LinkTimeOptimization", "FatalWarnings" } targetsuffix ("_Release" .. _AMD_VS_SUFFIX) optimize "On"
UI.Label("vBot v4.0 \n Vithrax#5814") UI.Button("Official OTCv8 Discord!", function() g_platform.openUrl("https://discord.gg/yhqBE4A") end) UI.Separator()
local bgNPC = bgNPC local CLIENT = CLIENT local table = table local pairs = pairs local IsValid = IsValid -- if CLIENT then snet.Callback('bgm_update_death_actors_on_client', function(ply, npc) if npc then bgNPC:RemoveNPC(npc) end bgNPC:ClearRemovedNPCs() end).Register() snet.Callback('bgn_add_actor_from_client', function(ply, npc, npc_type, uid, info) if bgNPC:GetActor(npc) ~= nil then return end local actor = BGN_ACTOR:Instance(npc, npc_type, uid) actor.info = info end).Validator(SNET_ENTITY_VALIDATOR).Register() end function bgNPC:AddNPC(actor) local npc = actor:GetNPC() if table.HasValueBySeq(self.npcs, npc) then return end table.insert(self.actors, actor) table.insert(self.npcs, npc) local npc_type = actor:GetType() self.factors[npc_type] = self.factors[npc_type] or {} table.insert(self.factors[npc_type], actor) self.fnpcs[npc_type] = self.fnpcs[npc_type] or {} table.insert(self.fnpcs[npc_type], npc) end function bgNPC:RemoveNPC(npc) snet.Request('bgm_update_death_actors_on_client', npc).InvokeAll() for i = #self.actors, 1, -1 do if self.actors[i]:GetNPC() == npc then table.remove(self.actors, i) break end end for i = #self.npcs, 1, -1 do if self.npcs[i] == npc then table.remove(self.npcs, i) break end end for key, data in pairs(self.factors) do for i = #data, 1, -1 do if data[i]:GetNPC() == npc then table.remove(self.factors[key], i) break end end end for key, data in pairs(self.fnpcs) do for i = #data, 1, -1 do if data[i] == npc then table.remove(self.fnpcs[key], i) break end end end end function bgNPC:ClearRemovedNPCs() for i = #self.actors, 1, -1 do local npc = self.actors[i]:GetNPC() if not IsValid(npc) then table.remove(self.actors, i) end end for i = #self.npcs, 1, -1 do local npc = self.npcs[i] if not IsValid(npc) then table.remove(self.npcs, i) end end for key, data in pairs(self.factors) do for i = #data, 1, -1 do local npc = data[i]:GetNPC() if not IsValid(npc) then table.remove(self.factors[key], i) end end end for key, data in pairs(self.fnpcs) do for i = #data, 1, -1 do local npc = data[i] if not IsValid(npc) then table.remove(self.fnpcs[key], i) end end end end
self = {} -------------------------------------------------------------------------------- function OnCreated( keys ) self.target = keys.target:GetAbsOrigin() self.ring_radius = keys.ability:GetSpecialValueFor( "ring_radius" ) self.ring_duration = keys.ability:GetSpecialValueFor( "ring_duration" ) self.stun_duration = keys.ability:GetSpecialValueFor( "stun_duration" ) self.thickness = keys.ability:GetSpecialValueFor( "edge_thickness" ) self.thickness = 50 self.hitList = {} AddFOWViewer(keys.caster:GetTeamNumber(), self.target, self.ring_duration, self.ring_radius, false) DebugDrawCircle(self.target, Vector(0, 255, 0), 1.0, self.ring_radius, true, self.ring_duration) DebugDrawCircle(self.target, Vector(0, 255, 0), 1.0, self.ring_radius - self.thickness, true, self.ring_duration) OnIntervalThink( keys ) end -------------------------------------------------------------------------------- function OnIntervalThink( keys ) local units = FindUnitsInRadius(keys.caster:GetTeamNumber(), self.target, nil, self.ring_radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false) for _,unit in pairs(units) do local pos = unit:GetAbsOrigin() local displacement = pos - self.target local distance = displacement:Length2D() if distance >= self.ring_radius - self.thickness and self.hitList[unit] == nil then keys.ability:ApplyDataDrivenModifier(keys.caster, unit, "modifier_veigar_event_horizon", {}) self.hitList[unit] = true end end end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------- -- Precondition: -- 1) Application with <appID> is registered on SDL. -- 2) AppServiceConsumer permissions are assigned for <appID> -- 3) Application sends a PutFile Request with a given file name -- -- Steps: -- 1) Application sends a GetFile Request with the same file name -- -- Expected: -- 1) GetFile will return SUCCESS -- 2) The CRC value returned in the GetFile response will be the same as the crc32 hash of the file binary data --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/AppServices/commonAppServices') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false --[[ Local functions ]] local function PTUfunc(tbl) tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); end --[[ Local variables ]] local putFileParams = { syncFileName = "icon.png", fileType ="GRAPHIC_PNG", } local getFileParams = { fileName = "icon.png", fileType = "GRAPHIC_PNG", } local result = { success = true, resultCode = "SUCCESS"} --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("RAI", common.registerApp) runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) runner.Step("Activate App", common.activateApp) runner.Step("Putfile", common.putFileInStorage, {1, putFileParams, result}) runner.Title("Test") runner.Step("Getfile", common.getFileFromStorage, {1, getFileParams, result}) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
local SingleLinePokerBackView = class(Node); local pokerScale = 0.82; SingleLinePokerBackView.defaultConfig = { totalWidth = System.getScreenScaleWidth() - 30; --n张扑克牌所占的总宽度 pokerWidth = 202*pokerScale; --每张扑克牌的宽度 pokerHeight = 272*pokerScale;--每张扑克牌的高度 maxSpace = 120 * pokerScale;--牌与牌之间的最大间隔 file = "games/common/poker/poker_back_big.png";--绘制牌背被使用的图片 }; SingleLinePokerBackView.ctor = function(self,config) self.m_config = self:_parseConfig(config); self:setSize(self.m_config.totalWidth,self.m_config.pokerHeight); self.m_cards = {}; end SingleLinePokerBackView.dtor = function(self) end ---------------------------------------------------------------------------------------------- --添加牌 SingleLinePokerBackView.addPokers = function(self,pokerCount) pokerCount = number.valueOf(pokerCount); if pokerCount <= 0 then return; end for i = 1,pokerCount do local poker = self:_createPoker(); table.insert(self.m_cards,poker); self:addChild(poker); poker:setSize(self.m_config.pokerWidth, self.m_config.pokerHeight); end self:_updatePoker(); end --移除牌 SingleLinePokerBackView.removePokers = function(self, pokerCount) pokerCount = number.valueOf(pokerCount); if pokerCount <= 0 then return; end for i = 1,pokerCount do local poker = table.remove(self.m_cards); self:removeChild(poker,true); poker = nil; end self:_updatePoker(); end --移除所有牌 SingleLinePokerBackView.removeAllPokers = function(self) for k, v in pairs(self.m_cards) do self:removeChild(v); delete(v); end self.m_cards = {}; end ---------------------------------------------------------------------------------------------- SingleLinePokerBackView._createPoker = function(self) local img = UIFactory.createImage(self.m_config.file); return img; end SingleLinePokerBackView._updatePoker = function(self) local visibleCards = self.m_cards; local cardW = self.m_config.pokerWidth; local cardH = self.m_config.pokerHeight; local totalW,totalH = self:getSize(); local x = 0; local space = self.m_config.maxSpace; local maxWidth = (#visibleCards - 1) * space + cardW; if totalW > maxWidth then x = (totalW - maxWidth) / 2; else space = (totalW - cardW) / (#visibleCards - 1); end for _, v in ipairs(visibleCards) do v:setPos(x, 0); x = x + space; end end SingleLinePokerBackView._parseConfig = function(self,config) config = table.verify(config); local data = {}; data.totalWidth = config.totalWidth or self.defaultConfig.totalWidth; data.pokerWidth = config.pokerWidth or self.defaultConfig.pokerWidth; data.pokerHeight = config.pokerHeight or self.defaultConfig.pokerHeight; data.maxSpace = config.maxSpace or self.defaultConfig.maxSpace; data.file = config.file or self.defaultConfig.file; return data; end return SingleLinePokerBackView;
require("options") -- require("plugins.telescope") -- require("plugins.bufferline") require("plugins.toggleterm") require("plugins.nvimtree") require("plugins.treesitter") -- require("plugins.galaxyline") require("plugins.lualine") require("plugins.lsp") require("plugins.compe") require("plugins.others") -- require("plugins.trouble") -- require("plugins.dap") require("mappings")
local ffi = require("ffi") -- Constants DoubleSolenoidValue = { Off = 0, Forward = 1, Reverse = 2, } -- Solenoid Solenoid = {} function Solenoid:new(channel) o = { solenoid = ffi.C.Solenoid_new(channel), } setmetatable(o, self) self.__index = self return o end function Solenoid:get() return ffi.C.Solenoid_Get(self.solenoid) end function Solenoid:set(on) ffi.C.Solenoid_Set(self.solenoid, on) end -- Double Solenoid DoubleSolenoid = {} function DoubleSolenoid:new(forwardChannel, reverseChannel) local o = { solenoid = ffi.C.DoubleSolenoid_new(forwardChannel, reverseChannel), } setmetatable(o, self) self.__index = self return o end function DoubleSolenoid:set(value) ffi.C.DoubleSolenoid_Set(self.solenoid, value) end
StageAPI.LogMinor("Loading Reimplementation Data") do -- Base Game Doors, Door Spawns -- Base Game Custom State Doors StageAPI.BaseDoorOpenState = { StartAnim = "Open", Anim = "Opened", StartSound = SoundEffect.SOUND_DOOR_HEAVY_OPEN, Triggers = { Unclear = "Closed" }, Passable = true } StageAPI.BaseDoorClosedState = { StartAnim = "Close", Anim = "Closed", StartSound = SoundEffect.SOUND_DOOR_HEAVY_CLOSE, Triggers = { Clear = "Opened", Bomb = "BrokenOpen" } } StageAPI.BaseDoorBrokenOpenState = { StartAnim = "Break", Anim = "BrokenOpen", Passable = true, NoMemory = true } StageAPI.SpecialDoorClosedState = { StartAnim = "Close", Anim = "Closed", StartSound = SoundEffect.SOUND_DOOR_HEAVY_CLOSE, Triggers = { Clear = "Opened" } } StageAPI.SecretDoorHiddenState = { Anim = "Hidden", Triggers = { EnteredThrough = { State = "Opened", Anim = "Opened" }, Bomb = { State = "Opened", Anim = "Opened", Jingle = Music.MUSIC_JINGLE_SECRETROOM_FIND, Particles = { {Variant = EffectVariant.ROCK_PARTICLE}, {Variant = EffectVariant.DUST_CLOUD, Timeout = 40, LifeSpan = 40, Rotation = -3, Count = 2, Velocity = 2} } } } } StageAPI.SecretDoorClosedState = { Anim = "Close", StartAnim = "Close", Triggers = { Clear = "Opened" } } StageAPI.SecretDoorOpenedState = { Anim = "Opened", StartAnim = "Open", Triggers = { Unclear = "Closed" }, Passable = true } StageAPI.BaseDoorStates = { Default = { Default = "Opened", Closed = StageAPI.BaseDoorClosedState, Opened = StageAPI.BaseDoorOpenState, BrokenOpen = StageAPI.BaseDoorBrokenOpenState }, SpecialInterior = { Default = "Opened", Opened = StageAPI.BaseDoorOpenState, Closed = StageAPI.SpecialDoorClosedState }, Vault = { Default = "TwoChains", TwoChains = { Anim = "Closed", OverlayAnim = "TwoChains", Triggers = { GoldKey = { State = "AwaitChain", OverlayAnim = "GoldenKeyOpenChain1" }, Key = { State = "AwaitChain", OverlayAnim = "KeyOpenChain1" } } }, AwaitChain = { Anim = "Closed", OverlayAnim = "OneChain", Triggers = { FinishOverlayTrigger = "OneChain" }, RememberAs = "OneChain" }, OneChain = { Anim = "Closed", OverlayAnim = "OneChain", Triggers = { GoldKey = { State = "Opened", OverlayAnim = "GoldenKeyOpenChain2" }, Key = { State = "Opened", OverlayAnim = "KeyOpenChain2" } } }, Closed = StageAPI.SpecialDoorClosedState, Opened = StageAPI.BaseDoorOpenState }, Bedroom = { Default = "TwoBombs", TwoBombs = { Anim = "Closed", OverlayAnim = "Idle", Triggers = { Bomb = { State = "OneBomb", Particle = { Variant = EffectVariant.WOOD_PARTICLE, } } } }, OneBomb = { Anim = "Closed", OverlayAnim = "Damaged", Triggers = { Bomb = { State = "Opened", Particle = { Variant = EffectVariant.WOOD_PARTICLE, } } } }, Closed = StageAPI.SpecialDoorClosedState, Opened = StageAPI.BaseDoorOpenState }, Key = { Default = "Locked", Locked = { Anim = "KeyClosed", Triggers = { GoldKey = { State = "Opened", Anim = "GoldenKeyOpen" }, Key = { State = "Opened", Anim = "KeyOpen" } } }, Closed = StageAPI.SpecialDoorClosedState, Opened = StageAPI.BaseDoorOpenState }, Arcade = { Default = "Locked", Locked = { Anim = "KeyClosed", Triggers = { Coin = { State = "Opened", Anim = "KeyOpen" } } }, Closed = StageAPI.SpecialDoorClosedState, Opened = StageAPI.BaseDoorOpenState }, Secret = { Default = "Hidden", Hidden = StageAPI.SecretDoorHiddenState, Closed = StageAPI.SecretDoorClosedState, Opened = StageAPI.SecretDoorOpenedState }, Miniboss = { Default = "Barred", Barred = { Anim = "Closed", OverlayAnim = "Appear", Triggers = { Clear = { State = "Opened", OverlayAnim = "Vanish" } } }, Closed = StageAPI.SpecialDoorClosedState, Opened = StageAPI.BaseDoorOpenState }, MinibossSecret = { Default = "Barred", Barred = { Anim = "Close", StartAnim = "Close", OverlayAnim = "Appear", Triggers = { Clear = { State = "Opened", OverlayAnim = "Vanish" } } }, Closed = StageAPI.SecretDoorClosedState, Opened = StageAPI.SecretDoorOpenedState }, CurseInterior = { Default = "Opened", Opened = { StartAnim = "Open", Anim = "Opened", StartSound = SoundEffect.SOUND_DOOR_HEAVY_OPEN, Triggers = { Unclear = "Closed", Function = function(door, data, sprite, doorData, gridData) for _, player in ipairs(StageAPI.Players) do if player.Position:DistanceSquared(door.Position) < (player.Size) ^ 2 then player:TakeDamage(1, DamageFlag.DAMAGE_CURSED_DOOR, EntityRef(player), 0) end end end }, Passable = true }, Closed = StageAPI.SpecialDoorClosedState, }, Curse = { Default = "Opened", Opened = { StartAnim = "Open", Anim = "Opened", StartSound = SoundEffect.SOUND_DOOR_HEAVY_OPEN, Triggers = { Unclear = "Closed", Function = function(door, data, sprite, doorData, gridData) for _, player in ipairs(StageAPI.Players) do if not player.CanFly and player.Position:DistanceSquared(door.Position) < (player.Size) ^ 2 then player:TakeDamage(1, DamageFlag.DAMAGE_CURSED_DOOR, EntityRef(player), 0) end end end }, Passable = true }, Closed = StageAPI.SpecialDoorClosedState, }, Ambush = { Default = "Closed", Opened = { StartAnim = "Open", Anim = "Opened", StartSound = SoundEffect.SOUND_DOOR_HEAVY_OPEN, Triggers = { Unclear = "Closed", Function = function(door, data, sprite, doorData, gridData) local p1 = StageAPI.Players[1] if (p1:GetHearts() + p1:GetSoulHearts()) < p1:GetMaxHearts() then return "Closed" end end }, Passable = true }, Closed = { StartAnim = "Close", Anim = "Closed", StartSound = SoundEffect.SOUND_DOOR_HEAVY_CLOSE, Triggers = { Function = function(door, data, sprite, doorData, gridData) if not StageAPI.Room:IsClear() then return end local p1 = StageAPI.Players[1] if (p1:GetHearts() + p1:GetSoulHearts()) >= p1:GetMaxHearts() then return "Opened" end end } } }, BossAmbush = { Default = "Closed", Opened = { StartAnim = "Open", Anim = "Opened", StartSound = SoundEffect.SOUND_DOOR_HEAVY_OPEN, Triggers = { Unclear = "Closed", Function = function(door, data, sprite, doorData, gridData) local p1 = StageAPI.Players[1] if p1:GetHearts() > 2 then return "Closed" end end }, Passable = true }, Closed = { StartAnim = "Close", Anim = "Closed", StartSound = SoundEffect.SOUND_DOOR_HEAVY_CLOSE, Triggers = { Function = function(door, data, sprite, doorData, gridData) if not StageAPI.Room:IsClear() then return end local p1 = StageAPI.Players[1] if p1:GetHearts() <= 2 then return "Opened" end end } } } } StageAPI.BaseDoors = { Default = StageAPI.CustomStateDoor("DefaultDoor", nil, StageAPI.BaseDoorStates.Default), SpecialInterior = StageAPI.CustomStateDoor("SpecialDoor", nil, StageAPI.BaseDoorStates.SpecialInterior), Shop = StageAPI.CustomStateDoor("ShopDoor", nil, StageAPI.BaseDoorStates.Key), Treasure = StageAPI.CustomStateDoor("TreasureDoor", "gfx/grid/door_02_treasureroomdoor.anm2", StageAPI.BaseDoorStates.Key), Boss = StageAPI.CustomStateDoor("BossDoor", "gfx/grid/door_10_bossroomdoor.anm2", StageAPI.BaseDoorStates.SpecialInterior), Secret = StageAPI.CustomStateDoor("SecretDoor", "gfx/grid/door_08_holeinwall.anm2", StageAPI.BaseDoorStates.Secret, nil, nil, StageAPI.SecretDoorOffsetsByDirection), Arcade = StageAPI.CustomStateDoor("ArcadeDoor", "gfx/grid/door_05_arcaderoomdoor.anm2", StageAPI.BaseDoorStates.Arcade), Bedroom = StageAPI.CustomStateDoor("BedroomDoor", nil, StageAPI.BaseDoorStates.Bedroom, nil, "gfx/grid/door_18_crackeddoor.anm2"), Vault = StageAPI.CustomStateDoor("VaultDoor", nil, StageAPI.BaseDoorStates.Vault, nil, "gfx/grid/door_16_doublelock.anm2"), Miniboss = StageAPI.CustomStateDoor("MinibossDoor", nil, StageAPI.BaseDoorStates.Miniboss, nil, "gfx/grid/door_17_bardoor.anm2"), MinibossSecret = StageAPI.CustomStateDoor("MinibossSecretDoor", "gfx/grid/door_08_holeinwall.anm2", StageAPI.BaseDoorStates.MinibossSecret, nil, "gfx/grid/door_17_bardoor.anm2", StageAPI.SecretDoorOffsetsByDirection), Devil = StageAPI.CustomStateDoor("DevilDoor", "gfx/grid/door_07_devilroomdoor.anm2", StageAPI.BaseDoorStates.SpecialInterior), Angel = StageAPI.CustomStateDoor("AngelDoor", "gfx/grid/door_07_holyroomdoor.anm2", StageAPI.BaseDoorStates.SpecialInterior), Curse = StageAPI.CustomStateDoor("CurseDoor", "gfx/grid/door_04_selfsacrificeroomdoor.anm2", StageAPI.BaseDoorStates.Curse), CurseInterior = StageAPI.CustomStateDoor("CurseInteriorDoor", "gfx/grid/door_04_selfsacrificeroomdoor.anm2", StageAPI.BaseDoorStates.CurseInterior), Ambush = StageAPI.CustomStateDoor("AmbushDoor", "gfx/grid/door_03_ambushroomdoor.anm2", StageAPI.BaseDoorStates.Ambush), BossAmbush = StageAPI.CustomStateDoor("BossAmbushDoor", "gfx/grid/door_09_bossambushroomdoor.anm2", StageAPI.BaseDoorStates.BossAmbush) } -- these two are redundant but being kept for now since they are used in the old door system StageAPI.DefaultDoorSpawn = { RequireCurrent = {RoomType.ROOM_DEFAULT, RoomType.ROOM_MINIBOSS, RoomType.ROOM_SACRIFICE, RoomType.ROOM_SHOP, RoomType.ROOM_LIBRARY, RoomType.ROOM_BARREN, RoomType.ROOM_ISAACS, RoomType.ROOM_DICE, RoomType.ROOM_CHEST}, RequireTarget = {RoomType.ROOM_DEFAULT, RoomType.ROOM_MINIBOSS, RoomType.ROOM_SACRIFICE, RoomType.ROOM_SHOP, RoomType.ROOM_LIBRARY, RoomType.ROOM_BARREN, RoomType.ROOM_ISAACS, RoomType.ROOM_DICE, RoomType.ROOM_CHEST} } StageAPI.SecretDoorSpawn = { RequireTarget = {RoomType.ROOM_SECRET, RoomType.ROOM_SUPERSECRET}, NotCurrent = {RoomType.ROOM_SECRET, RoomType.ROOM_SUPERSECRET} } StageAPI.DefaultDoorEntrances = {RoomType.ROOM_DEFAULT, RoomType.ROOM_MINIBOSS, RoomType.ROOM_SACRIFICE} StageAPI.BaseDoorSpawns = { Default = { Sprite = "Default", StateDoor = "DefaultDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = StageAPI.DefaultDoorEntrances }, SpecialInterior = { -- same as default door, but cannot be blown up Sprite = "Default", StateDoor = "SpecialDoor", NotCurrent = {RoomType.ROOM_DEFAULT, RoomType.ROOM_CURSE}, RequireTarget = StageAPI.DefaultDoorEntrances }, Miniboss = { Sprite = "Default", StateDoor = "MinibossDoor", RequireCurrent = {RoomType.ROOM_MINIBOSS}, RequireTarget = StageAPI.DefaultDoorEntrances }, MinibossSecret = { Sprite = "Secret", StateDoor = "MinibossSecretDoor", RequireCurrent = {RoomType.ROOM_SECRET}, IsSurpriseMiniboss = true }, MinibossSurprise = { Sprite = "Default", StateDoor = "MinibossDoor", IsSurpriseMiniboss = true, NotCurrent = {RoomType.ROOM_DEFAULT} }, Secret = { Sprite = "Secret", StateDoor = "SecretDoor", RequireEither = {RoomType.ROOM_SECRET, RoomType.ROOM_SUPERSECRET} }, Lock = { Sprite = "Default", StateDoor = "ShopDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_SHOP, RoomType.ROOM_LIBRARY} }, Treasure = { Sprite = "Treasure", StateDoor = "TreasureDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_TREASURE} }, Boss = { Sprite = "Boss", StateDoor = "BossDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_BOSS} }, BossInterior = { Sprite = "Boss", StateDoor = "BossDoor", RequireCurrent = {RoomType.ROOM_BOSS}, RequireTarget = StageAPI.DefaultDoorEntrances }, Ambush = { Sprite = "Ambush", StateDoor = "AmbushDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_CHALLENGE}, IsBossAmbush = false }, BossAmbush = { Sprite = "BossAmbush", StateDoor = "BossAmbushDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_CHALLENGE}, IsBossAmbush = true }, Boarded = { Sprite = "Boarded", StateDoor = "BedroomDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_BARREN, RoomType.ROOM_ISAACS} }, DoubleLock = { Sprite = "DoubleLock", StateDoor = "VaultDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_CHEST, RoomType.ROOM_DICE} }, CurseInterior = { Sprite = "Default", StateDoor = "CurseInteriorDoor", RequireCurrent = {RoomType.ROOM_CURSE}, RequireTarget = StageAPI.DefaultDoorEntrances }, Curse = { Sprite = "Curse", StateDoor = "CurseDoor", RequireCurrent = {RoomType.ROOM_DEFAULT}, RequireTarget = {RoomType.ROOM_CURSE} }, Devil = { Sprite = "Devil", StateDoor = "DevilDoor", RequireTarget = {RoomType.ROOM_DEVIL} }, Angel = { Sprite = "Angel", StateDoor = "AngelDoor", RequireTarget = {RoomType.ROOM_ANGEL} }, PayToPlay = { Sprite = "PayToPlay", StateDoor = "ArcadeDoor", IsPayToPlay = true } } StageAPI.BaseDoorSpawnList = {StageAPI.BaseDoorSpawns.PayToPlay, StageAPI.BaseDoorSpawns.Devil, StageAPI.BaseDoorSpawns.Angel, StageAPI.BaseDoorSpawns.MinibossSecret, StageAPI.BaseDoorSpawns.Secret, StageAPI.BaseDoorSpawns.CurseInterior, StageAPI.BaseDoorSpawns.Curse, StageAPI.BaseDoorSpawns.BossInterior, StageAPI.BaseDoorSpawns.MinibossSurprise, StageAPI.BaseDoorSpawns.Miniboss, StageAPI.BaseDoorSpawns.SpecialInterior} -- in priority order for k, v in pairs(StageAPI.BaseDoorSpawns) do if not StageAPI.IsIn(StageAPI.BaseDoorSpawnList, v) and k ~= "Default" then StageAPI.BaseDoorSpawnList[#StageAPI.BaseDoorSpawnList + 1] = v end end StageAPI.BaseDoorSpawnList[#StageAPI.BaseDoorSpawnList + 1] = StageAPI.BaseDoorSpawns.Default end do -- Reimplementation of most base game GridGfx, Backdrops, RoomGfx -- Base Game GridGfx StageAPI.BaseGridGfx = {} StageAPI.BaseGridGfx.Basement = StageAPI.GridGfx() StageAPI.BaseGridGfx.Basement:SetRocks("gfx/grid/rocks_basement.png") StageAPI.BaseGridGfx.Basement:SetDecorations("gfx/grid/props_01_basement.png", "gfx/grid/props_01_basement.anm2", 43) StageAPI.BaseGridGfx.Basement:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_01_normaldoor.png", }, Secret = "gfx/grid/door_08_holeinwall.png" } StageAPI.BaseGridGfx.Basement:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.Cellar = StageAPI.GridGfx() StageAPI.BaseGridGfx.Cellar:SetRocks("gfx/grid/rocks_cellar.png") StageAPI.BaseGridGfx.Cellar:SetDecorations("gfx/grid/props_01_basement.png", "gfx/grid/props_01_basement.anm2", 43) StageAPI.BaseGridGfx.Cellar:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_12_cellardoor.png", }, Secret = "gfx/grid/door_08_holeinwall.png" } StageAPI.BaseGridGfx.Cellar:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.BurningBasement = StageAPI.GridGfx() StageAPI.BaseGridGfx.BurningBasement:SetRocks("gfx/grid/rocks_burningbasement.png") StageAPI.BaseGridGfx.BurningBasement:SetDecorations("gfx/grid/props_01_basement.png", "gfx/grid/props_01_basement.anm2", 43) StageAPI.BaseGridGfx.BurningBasement:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_01_burningbasement.png", }, Secret = "gfx/grid/door_08_holeinwall.png" } StageAPI.BaseGridGfx.BurningBasement:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.Caves = StageAPI.GridGfx() StageAPI.BaseGridGfx.Caves:SetRocks("gfx/grid/rocks_caves.png") StageAPI.BaseGridGfx.Caves:SetPits("gfx/grid/grid_pit.png", "gfx/grid/grid_pit_water.png") StageAPI.BaseGridGfx.Caves:SetBridges("gfx/grid/grid_bridge.png") StageAPI.BaseGridGfx.Caves:SetDecorations("gfx/grid/props_03_caves.png") StageAPI.BaseGridGfx.Caves:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_01_normaldoor.png", }, Secret = "gfx/grid/door_08_holeinwall_caves.png" } StageAPI.BaseGridGfx.Caves:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.Secret = StageAPI.GridGfx() StageAPI.BaseGridGfx.Secret:SetRocks("gfx/grid/rocks_secretroom.png") StageAPI.BaseGridGfx.Secret:SetPits("gfx/grid/grid_pit.png", "gfx/grid/grid_pit_water.png") StageAPI.BaseGridGfx.Secret:SetBridges("gfx/grid/grid_bridge.png") StageAPI.BaseGridGfx.Secret:SetDecorations("gfx/grid/props_03_caves.png") StageAPI.BaseGridGfx.Secret:SetDoorSprites{ Default = "gfx/grid/door_08_holeinwall.png", Secret = "gfx/grid/door_08_holeinwall.png" } StageAPI.BaseGridGfx.Secret:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.Catacombs = StageAPI.GridGfx() StageAPI.BaseGridGfx.Catacombs:SetRocks("gfx/grid/rocks_catacombs.png") StageAPI.BaseGridGfx.Catacombs:SetPits("gfx/grid/grid_pit_catacombs.png", "gfx/grid/grid_pit_water_catacombs.png") StageAPI.BaseGridGfx.Catacombs:SetBridges("stageapi/floors/catacombs/grid_bridge_catacombs.png") StageAPI.BaseGridGfx.Catacombs:SetDecorations("gfx/grid/props_03_caves.png") StageAPI.BaseGridGfx.Catacombs:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_01_normaldoor.png", }, Secret = "gfx/grid/door_08_holeinwall.png" } StageAPI.BaseGridGfx.Catacombs:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.FloodedCaves = StageAPI.GridGfx() StageAPI.BaseGridGfx.FloodedCaves:SetRocks("gfx/grid/rocks_drownedcaves.png") StageAPI.BaseGridGfx.FloodedCaves:SetPits("gfx/grid/grid_pit_water_drownedcaves.png", "gfx/grid/grid_pit_water_drownedcaves.png") StageAPI.BaseGridGfx.FloodedCaves:SetBridges("gfx/grid/grid_bridge_drownedcaves.png") StageAPI.BaseGridGfx.FloodedCaves:SetDecorations("gfx/grid/props_03_caves.png") StageAPI.BaseGridGfx.FloodedCaves:SetDoorSprites{ Default = { [RoomType.ROOM_DEFAULT] = "gfx/grid/door_27_drownedcaves.png", }, Secret = "gfx/grid/door_08_holeinwall_cathedral.png" } StageAPI.BaseGridGfx.FloodedCaves:SetDoorSpawns(StageAPI.BaseDoorSpawnList) StageAPI.BaseGridGfx.Depths = StageAPI.GridGfx() StageAPI.BaseGridGfx.Depths:SetRocks("gfx/grid/rocks_depths.png") StageAPI.BaseGridGfx.Depths:SetPits("gfx/grid/grid_pit_depths.png") StageAPI.BaseGridGfx.Depths:SetBridges("gfx/grid/grid_bridge_depths.png") StageAPI.BaseGridGfx.Depths:SetDecorations("gfx/grid/props_05_depths.png", "gfx/grid/props_05_depths.anm2", 43) StageAPI.BaseGridGfx.Necropolis = StageAPI.GridGfx() StageAPI.BaseGridGfx.Necropolis:SetRocks("gfx/grid/rocks_depths.png") StageAPI.BaseGridGfx.Necropolis:SetPits("gfx/grid/grid_pit_necropolis.png") StageAPI.BaseGridGfx.Necropolis:SetBridges("stageapi/floors/necropolis/grid_bridge_necropolis.png") StageAPI.BaseGridGfx.Necropolis:SetDecorations("gfx/grid/props_05_depths.png", "gfx/grid/props_05_depths.anm2", 43) StageAPI.BaseGridGfx.DankDepths = StageAPI.GridGfx() StageAPI.BaseGridGfx.DankDepths:SetRocks("gfx/grid/rocks_depths.png") StageAPI.BaseGridGfx.DankDepths:SetPits("gfx/grid/grid_pit_dankdepths.png","gfx/grid/grid_pit_water_dankdepths.png") StageAPI.BaseGridGfx.DankDepths:SetBridges("gfx/grid/grid_bridge_dankdepths.png") StageAPI.BaseGridGfx.DankDepths:SetDecorations("gfx/grid/props_05_depths.png", "gfx/grid/props_05_depths.anm2", 43) StageAPI.BaseGridGfx.Womb = StageAPI.GridGfx() StageAPI.BaseGridGfx.Womb:SetRocks("gfx/grid/rocks_womb.png") StageAPI.BaseGridGfx.Womb:SetPits("gfx/grid/grid_pit_womb.png", { { File = "gfx/grid/grid_pit_blood_womb.png" }, { File = "gfx/grid/grid_pit_acid_womb.png" }, }) StageAPI.BaseGridGfx.Womb:SetBridges("stageapi/floors/utero/grid_bridge_womb.png") StageAPI.BaseGridGfx.Womb:SetDecorations("gfx/grid/props_07_the womb.png", "gfx/grid/props_07_the womb.anm2", 43) StageAPI.BaseGridGfx.Utero = StageAPI.GridGfx() StageAPI.BaseGridGfx.Utero:SetRocks("gfx/grid/rocks_womb.png") StageAPI.BaseGridGfx.Utero:SetPits("gfx/grid/grid_pit_womb.png", { { File = "gfx/grid/grid_pit_blood_womb.png" }, { File = "gfx/grid/grid_pit_acid_womb.png" }, }) StageAPI.BaseGridGfx.Utero:SetBridges("stageapi/floors/utero/grid_bridge_womb.png") StageAPI.BaseGridGfx.Utero:SetDecorations("gfx/grid/props_07_the womb.png", "gfx/grid/props_07_the womb.anm2", 43) StageAPI.BaseGridGfx.ScarredWomb = StageAPI.GridGfx() StageAPI.BaseGridGfx.ScarredWomb:SetRocks("gfx/grid/rocks_scarredwomb.png") StageAPI.BaseGridGfx.ScarredWomb:SetPits("gfx/grid/grid_pit_blood_scarredwomb.png") StageAPI.BaseGridGfx.ScarredWomb:SetBridges("gfx/grid/grid_bridge_scarredwomb.png") StageAPI.BaseGridGfx.ScarredWomb:SetDecorations("gfx/grid/props_07_the womb.png", "gfx/grid/props_07_the womb.anm2", 43) StageAPI.BaseGridGfx.BlueWomb = StageAPI.GridGfx() StageAPI.BaseGridGfx.BlueWomb:SetRocks("gfx/grid/rocks_bluewomb.png") StageAPI.BaseGridGfx.BlueWomb:SetDecorations("gfx/grid/props_07_the womb_blue.png", "gfx/grid/props_07_the womb.anm2", 43) StageAPI.BaseGridGfx.Cathedral = StageAPI.GridGfx() StageAPI.BaseGridGfx.Cathedral:SetRocks("gfx/grid/rocks_cathedral.png") StageAPI.BaseGridGfx.Cathedral:SetPits("gfx/grid/grid_pit_cathedral.png") StageAPI.BaseGridGfx.Cathedral:SetBridges("gfx/grid/grid_bridge_cathedral.png") StageAPI.BaseGridGfx.Cathedral:SetDecorations("gfx/grid/props_10_cathedral.png", "gfx/grid/props_10_cathedral.anm2", 43) StageAPI.BaseGridGfx.Sheol = StageAPI.GridGfx() StageAPI.BaseGridGfx.Sheol:SetRocks("gfx/grid/rocks_sheol.png") StageAPI.BaseGridGfx.Sheol:SetPits("gfx/grid/grid_pit_depths.png") StageAPI.BaseGridGfx.Sheol:SetBridges("gfx/grid/grid_bridge_depths.png") StageAPI.BaseGridGfx.Sheol:SetDecorations("gfx/grid/props_09_sheol.png", "gfx/grid/props_09_sheol.anm2", 43) StageAPI.BaseGridGfx.Chest = StageAPI.GridGfx() StageAPI.BaseGridGfx.Chest:SetDecorations("gfx/grid/props_11_chest.png", "gfx/grid/props_11_the chest.anm2", 43) StageAPI.BaseGridGfx.DarkRoom = StageAPI.GridGfx() StageAPI.BaseGridGfx.DarkRoom:SetPits("gfx/grid/grid_pit_darkroom.png") StageAPI.BaseGridGfx.DarkRoom:SetDecorations("stageapi/none.png") StageAPI.BaseGridGfx.Downpour = StageAPI.GridGfx() StageAPI.BaseGridGfx.Downpour:SetRocks("gfx/grid/rocks_downpour.png") StageAPI.BaseGridGfx.Downpour:SetPits("gfx/grid/grid_pit_downpour.png") StageAPI.BaseGridGfx.Downpour:SetDecorations("gfx/grid/props_01x_downpour.png", "gfx/grid/props_01x_downpour.anm2", 20) StageAPI.BaseGridGfx.Dross = StageAPI.GridGfx() StageAPI.BaseGridGfx.Dross:SetRocks("gfx/grid/rocks_dross.png") StageAPI.BaseGridGfx.Dross:SetPits("gfx/grid/grid_pit_dross.png") StageAPI.BaseGridGfx.Dross:SetDecorations("gfx/grid/props_02x_dross.png", "gfx/grid/props_02x_dross.anm2", 30) StageAPI.BaseGridGfx.Mines = StageAPI.GridGfx() StageAPI.BaseGridGfx.Mines:SetRocks("gfx/grid/rocks_secretroom.png") StageAPI.BaseGridGfx.Mines:SetPits("gfx/grid/grid_pit_mines.png") StageAPI.BaseGridGfx.Mines:SetDecorations("gfx/grid/props_03x_mines.png", "gfx/grid/props_03x_mines.anm2", 42) StageAPI.BaseGridGfx.Ashpit = StageAPI.GridGfx() StageAPI.BaseGridGfx.Ashpit:SetRocks("gfx/grid/rocks_ashpit.png") StageAPI.BaseGridGfx.Ashpit:SetPits("gfx/grid/grid_pit_ashpit.png", "gfx/grid/grid_pit_ashpit_ash.png") StageAPI.BaseGridGfx.Ashpit:SetDecorations("gfx/grid/props_03x_mines.png", "gfx/grid/props_03x_mines.anm2", 42) StageAPI.BaseGridGfx.Mausoleum = StageAPI.GridGfx() StageAPI.BaseGridGfx.Mausoleum:SetRocks("gfx/grid/rocks_mausoleum.png") StageAPI.BaseGridGfx.Mausoleum:SetPits("gfx/grid/grid_pit_mausoleum.png") StageAPI.BaseGridGfx.Mausoleum:SetDecorations("gfx/grid/props_03x_mines.png", "gfx/grid/props_03x_mines.anm2", 42) StageAPI.BaseGridGfx.Gehenna = StageAPI.GridGfx() StageAPI.BaseGridGfx.Gehenna:SetRocks("gfx/grid/rocks_gehenna.png") StageAPI.BaseGridGfx.Gehenna:SetPits("gfx/grid/grid_pit_gehenna.png") StageAPI.BaseGridGfx.Gehenna:SetDecorations("gfx/grid/props_03x_mines.png", "gfx/grid/props_03x_mines.anm2", 42) StageAPI.BaseGridGfx.Corpse = StageAPI.GridGfx() StageAPI.BaseGridGfx.Corpse:SetRocks("gfx/grid/rocks_corpse.png") StageAPI.BaseGridGfx.Corpse:SetPits("gfx/grid/grid_pit_corpse.png") StageAPI.BaseGridGfx.Corpse:SetDecorations("gfx/grid/props_07_the corpse.png", "gfx/grid/props_07_the corpse.anm2", 42) StageAPI.BaseRoomGfx = { Basement = StageAPI.RoomGfx(BackdropType.BASEMENT, StageAPI.BaseGridGfx.Basement, "_default"), Cellar = StageAPI.RoomGfx(BackdropType.CELLAR, StageAPI.BaseGridGfx.Cellar, "_default"), BurningBasement = StageAPI.RoomGfx(BackdropType.BURNT_BASEMENT, StageAPI.BaseGridGfx.BurningBasement, "_default"), Caves = StageAPI.RoomGfx(BackdropType.CAVES, StageAPI.BaseGridGfx.Caves, "_default"), Catacombs = StageAPI.RoomGfx(BackdropType.CATACOMBS, StageAPI.BaseGridGfx.Catacombs, "_default"), FloodedCaves = StageAPI.RoomGfx(BackdropType.FLOODED_CAVES, StageAPI.BaseGridGfx.FloodedCaves, "_default"), Depths = StageAPI.RoomGfx(BackdropType.DEPTHS, StageAPI.BaseGridGfx.Depths, "_default"), Necropolis = StageAPI.RoomGfx(BackdropType.NECROPOLIS, StageAPI.BaseGridGfx.Necropolis, "_default"), DankDepths = StageAPI.RoomGfx(BackdropType.DANK_DEPTHS, StageAPI.BaseGridGfx.DankDepths, "_default"), Womb = StageAPI.RoomGfx(BackdropType.WOMB, StageAPI.BaseGridGfx.Womb, "_default"), Utero = StageAPI.RoomGfx(BackdropType.UTERO, StageAPI.BaseGridGfx.Utero, "_default"), ScarredWomb = StageAPI.RoomGfx(BackdropType.SCARRED_WOMB, StageAPI.BaseGridGfx.ScarredWomb, "_default"), BlueWomb = StageAPI.RoomGfx(BackdropType.BLUE_WOMB, StageAPI.BaseGridGfx.BlueWomb, "_default"), Sheol = StageAPI.RoomGfx(BackdropType.SHEOL, StageAPI.BaseGridGfx.Sheol, "_default"), Cathedral = StageAPI.RoomGfx(BackdropType.CATHEDRAL, StageAPI.BaseGridGfx.Cathedral, "_default"), DarkRoom = StageAPI.RoomGfx(BackdropType.DARKROOM, StageAPI.BaseGridGfx.DarkRoom, "_default"), Chest = StageAPI.RoomGfx(BackdropType.CHEST, StageAPI.BaseGridGfx.Chest, "_default"), Downpour = StageAPI.RoomGfx(BackdropType.DOWNPOUR, StageAPI.BaseGridGfx.Downpour, "_default"), Dross = StageAPI.RoomGfx(BackdropType.DROSS, StageAPI.BaseGridGfx.Dross, "_default"), Mines = StageAPI.RoomGfx(BackdropType.MINES, StageAPI.BaseGridGfx.Mines, "_default"), Ashpit = StageAPI.RoomGfx(BackdropType.ASHPIT, StageAPI.BaseGridGfx.Ashpit, "_default"), Mausoleum = StageAPI.RoomGfx(BackdropType.MAUSOLEUM, StageAPI.BaseGridGfx.Mausoleum, "_default"), Gehenna = StageAPI.RoomGfx(BackdropType.GEHENNA, StageAPI.BaseGridGfx.Gehenna, "_default"), Corpse = StageAPI.RoomGfx(BackdropType.CORPSE, StageAPI.BaseGridGfx.Corpse, "_default"), -- Special Rooms Shop = StageAPI.RoomGfx(BackdropType.SHOP, StageAPI.BaseGridGfx.Basement, "_default"), Library = StageAPI.RoomGfx(BackdropType.LIBRARY, StageAPI.BaseGridGfx.Basement, "_default"), Secret = StageAPI.RoomGfx(BackdropType.SECRET, StageAPI.BaseGridGfx.Secret, "_default"), Barren = StageAPI.RoomGfx(BackdropType.BARREN, StageAPI.BaseGridGfx.Basement, "_default"), Isaacs = StageAPI.RoomGfx(BackdropType.ISAAC, StageAPI.BaseGridGfx.Basement, "_default"), Arcade = StageAPI.RoomGfx(BackdropType.ARCADE, StageAPI.BaseGridGfx.Basement, "_default"), Dice = StageAPI.RoomGfx(BackdropType.DICE, StageAPI.BaseGridGfx.Basement, "_default"), BlueSecret = StageAPI.RoomGfx(BackdropType.BLUE_WOMB_PASS, nil, "_default") } end do -- Overriden Stages Reimplementation -- Catacombs -- StageAPI.Catacombs = StageAPI.CustomStage("Catacombs", nil, true) StageAPI.Catacombs:SetStageMusic(Music.MUSIC_CATACOMBS) StageAPI.Catacombs:SetBossMusic({Music.MUSIC_BOSS, Music.MUSIC_BOSS2}, Music.MUSIC_BOSS_OVER) StageAPI.Catacombs.GenerateLevel = StageAPI.GenerateBaseLevel StageAPI.Catacombs.DisplayName = "Catacombs I" StageAPI.CatacombsTwo = StageAPI.Catacombs("Catacombs 2") StageAPI.CatacombsTwo.DisplayName = "Catacombs II" StageAPI.CatacombsXL = StageAPI.Catacombs("Catacombs XL") StageAPI.CatacombsXL.DisplayName = "Catacombs XL" StageAPI.Catacombs:SetXLStage(StageAPI.CatacombsXL) StageAPI.CatacombsGreed = StageAPI.Catacombs("Catacombs Greed") StageAPI.CatacombsGreed.DisplayName = "Catacombs" StageAPI.AddOverrideStage("CatacombsOne", LevelStage.STAGE2_1, StageType.STAGETYPE_WOTL, StageAPI.Catacombs) StageAPI.AddOverrideStage("CatacombsTwo", LevelStage.STAGE2_2, StageType.STAGETYPE_WOTL, StageAPI.CatacombsTwo) StageAPI.AddOverrideStage("CatacombsGreed", LevelStage.STAGE2_GREED, StageType.STAGETYPE_WOTL, StageAPI.CatacombsGreed, true) StageAPI.Catacombs:SetReplace(StageAPI.StageOverride.CatacombsOne) StageAPI.CatacombsTwo:SetReplace(StageAPI.StageOverride.CatacombsTwo) -- Necropolis -- StageAPI.NecropolisOverlays = { StageAPI.Overlay("stageapi/floors/necropolis/overlay.anm2", Vector(0.33, -0.15), nil, nil, 0.5), StageAPI.Overlay("stageapi/floors/necropolis/overlay.anm2", Vector(-0.33, -0.15), Vector(128, 128), nil, 0.5), StageAPI.Overlay("stageapi/floors/necropolis/overlay.anm2", Vector(0.33, 0.1), nil, nil, 0.5), } StageAPI.Necropolis = StageAPI.CustomStage("Necropolis", nil, true) StageAPI.Necropolis:SetStageMusic(Music.MUSIC_NECROPOLIS) StageAPI.Necropolis:SetBossMusic({Music.MUSIC_BOSS, Music.MUSIC_BOSS2}, Music.MUSIC_BOSS_OVER) StageAPI.Necropolis.GenerateLevel = StageAPI.GenerateBaseLevel StageAPI.Necropolis.DisplayName = "Necropolis I" StageAPI.NecropolisTwo = StageAPI.Necropolis("Necropolis 2") StageAPI.NecropolisTwo.DisplayName = "Necropolis II" StageAPI.NecropolisXL = StageAPI.Necropolis("Necropolis XL") StageAPI.NecropolisXL.DisplayName = "Necropolis XL" StageAPI.Necropolis:SetXLStage(StageAPI.NecropolisXL) StageAPI.NecropolisGreed = StageAPI.Necropolis("Necropolis Greed") StageAPI.NecropolisGreed.DisplayName = "Necropolis" StageAPI.AddOverrideStage("NecropolisOne", LevelStage.STAGE3_1, StageType.STAGETYPE_WOTL, StageAPI.Necropolis) StageAPI.AddOverrideStage("NecropolisTwo", LevelStage.STAGE3_2, StageType.STAGETYPE_WOTL, StageAPI.NecropolisTwo) StageAPI.AddOverrideStage("NecropolisGreed", LevelStage.STAGE3_GREED, StageType.STAGETYPE_WOTL, StageAPI.NecropolisGreed, true) -- Utero -- StageAPI.Utero = StageAPI.CustomStage("Utero", nil, true) StageAPI.Utero:SetStageMusic(Music.MUSIC_UTERO) StageAPI.Utero:SetBossMusic({Music.MUSIC_BOSS, Music.MUSIC_BOSS2}, Music.MUSIC_BOSS_OVER) StageAPI.Utero.GenerateLevel = StageAPI.GenerateBaseLevel StageAPI.Utero.DisplayName = "Utero I" StageAPI.UteroTwo = StageAPI.Utero("Utero 2") StageAPI.UteroTwo.DisplayName = "Utero II" StageAPI.UteroXL = StageAPI.Utero("Utero XL") StageAPI.UteroXL.DisplayName = "Utero XL" StageAPI.Utero:SetXLStage(StageAPI.UteroXL) StageAPI.UteroGreed = StageAPI.Utero("Utero Greed") StageAPI.UteroGreed.DisplayName = "Utero" StageAPI.AddOverrideStage("UteroOne", LevelStage.STAGE4_1, StageType.STAGETYPE_WOTL, StageAPI.Utero) StageAPI.AddOverrideStage("UteroTwo", LevelStage.STAGE4_2, StageType.STAGETYPE_WOTL, StageAPI.UteroTwo) StageAPI.AddOverrideStage("UteroGreed", LevelStage.STAGE4_GREED, StageType.STAGETYPE_WOTL, StageAPI.UteroGreed, true) end do -- Boss Animation Data end do -- Boss Data local function quickBossData(name, entity, ignoreEntity, mergeInAfter, filesName) local prefix = "gfx/ui/boss/" local midfix = "" if entity then if #entity > 0 then entity = { Type = entity[1], Variant = entity[2], SubType = entity[3] } end if not ignoreEntity then midfix = tostring(entity.Type) .. "." .. tostring(entity.Variant) .. "_" end end local cleanName = string.lower(filesName or name) cleanName = string.gsub(cleanName, " ", "") cleanName = string.gsub(cleanName, "%.", "") cleanName = string.gsub(cleanName, "'", "") cleanName = string.gsub(cleanName, "%-", "") local bossData = { Entity = entity, Portrait = prefix .. "portrait_" .. midfix .. cleanName .. ".png", Bossname = prefix .. "bossname_" .. midfix .. cleanName .. ".png", BaseGameBoss = true } if mergeInAfter then bossData = StageAPI.Merged(bossData, mergeInAfter) end return name, bossData end StageAPI.AddBossData(quickBossData("Larry Jr", {19, 0})) StageAPI.AddBossData(quickBossData("The Hollow", {19, 1})) StageAPI.AddBossData(quickBossData("Monstro", {20, 0})) StageAPI.AddBossData(quickBossData("Chub", {28, 0})) StageAPI.AddBossData(quickBossData("Chad", {28, 1})) StageAPI.AddBossData(quickBossData("Carrion Queen", {28, 2})) StageAPI.AddBossData(quickBossData("Gurdy", {36, 0})) StageAPI.AddBossData(quickBossData("Monstro 2", {43, 0})) StageAPI.AddBossData(quickBossData("Gish", {43, 1})) StageAPI.AddBossData(quickBossData("Mom", {45, 0})) StageAPI.AddBossData(quickBossData("Pin", {62, 0})) StageAPI.AddBossData(quickBossData("Scolex", {62, 1})) StageAPI.AddBossData(quickBossData("The Frail", {62, 2}, true)) StageAPI.AddBossData(quickBossData("Famine", {63, 0}, nil, {Horseman = true})) StageAPI.AddBossData(quickBossData("Pestilence", {64, 0}, nil, {Horseman = true})) StageAPI.AddBossData(quickBossData("War", {65, 0}, nil, {Horseman = true})) StageAPI.AddBossData(quickBossData("Conquest", {65, 1}, nil, {Horseman = true})) StageAPI.AddBossData(quickBossData("Death", {66, 0}, nil, {Horseman = true})) StageAPI.AddBossData(quickBossData("Duke of Flies", {67, 0})) StageAPI.AddBossData(quickBossData("The Husk", {67, 1})) StageAPI.AddBossData(quickBossData("Peep", {68, 0})) StageAPI.AddBossData(quickBossData("The Bloat", {68, 1}, nil, nil, "bloat")) StageAPI.AddBossData(quickBossData("Loki", {69, 0})) StageAPI.AddBossData(quickBossData("Lokii", {69, 1})) StageAPI.AddBossData(quickBossData("Fistula", {71, 0})) StageAPI.AddBossData(quickBossData("Teratoma", {71, 1})) StageAPI.AddBossData(quickBossData("Blastocyst", {74, 0})) StageAPI.AddBossData(quickBossData("Mom's Heart", {78, 0})) StageAPI.AddBossData(quickBossData("It Lives", {78, 1})) StageAPI.AddBossData(quickBossData("Gemini", {79, 0})) StageAPI.AddBossData(quickBossData("Steven", {79, 1})) StageAPI.AddBossData(quickBossData("Blighted Ovum", {79, 2})) StageAPI.AddBossData(quickBossData("The Fallen", {81, 0})) StageAPI.AddBossData(quickBossData("Krampus", {81, 1})) StageAPI.AddBossData(quickBossData("Headless Horseman", {82, 0})) StageAPI.AddBossData(quickBossData("Satan", {84, 0})) StageAPI.AddBossData(quickBossData("Mask of Infamy", {97, 0})) StageAPI.AddBossData(quickBossData("Gurdy Jr", {99, 0})) StageAPI.AddBossData(quickBossData("Widow", {100, 0})) StageAPI.AddBossData(quickBossData("The Wretched", {100, 1})) StageAPI.AddBossData(quickBossData("Daddy Long Legs", {101, 0})) StageAPI.AddBossData(quickBossData("Triachnid", {101, 1})) StageAPI.AddBossData(quickBossData("Isaac", {102, 0}, nil, {Bossname = "gfx/ui/boss/playername_01_isaac.png"})) StageAPI.AddBossData(quickBossData("Blue Baby", {102, 1})) StageAPI.AddBossData(quickBossData("The Haunt", {260, 0})) StageAPI.AddBossData(quickBossData("Dingle", {261, 0})) StageAPI.AddBossData(quickBossData("Dangle", {261, 1}, true)) StageAPI.AddBossData(quickBossData("Mega Maw", {262, 0})) StageAPI.AddBossData(quickBossData("The Gate", {263, 0}, nil, nil, "megamaw2")) StageAPI.AddBossData(quickBossData("Mega Fatty", {264, 0})) StageAPI.AddBossData(quickBossData("The Cage", {265, 0}, nil, nil, "fatty2")) StageAPI.AddBossData(quickBossData("Mama Gurdy", {266, 0})) StageAPI.AddBossData(quickBossData("Dark One", {267, 0})) StageAPI.AddBossData(quickBossData("The Adversary", {268, 0}, nil, nil, "darkone2")) StageAPI.AddBossData(quickBossData("Polycephalus", {269, 0})) StageAPI.AddBossData(quickBossData("Mr. Fred", {270, 0}, nil, nil, "megafred")) StageAPI.AddBossData(quickBossData("The Lamb", {273, 0})) StageAPI.AddBossData(quickBossData("Mega Satan", {274, 0})) StageAPI.AddBossData(quickBossData("Gurglings", {276, 0}, nil, {Entity = {Type = 276, Variant = 1}})) StageAPI.AddBossData(quickBossData("Turdlings", {276, 2}, true)) StageAPI.AddBossData(quickBossData("The Stain", {401, 0})) StageAPI.AddBossData(quickBossData("Brownie", {402, 0})) StageAPI.AddBossData(quickBossData("The Forsaken", {403, 0})) StageAPI.AddBossData(quickBossData("Little Horn", {404, 0})) StageAPI.AddBossData(quickBossData("Rag Man", {405, 0})) StageAPI.AddBossData(quickBossData("Ultra Greed", {406, 0})) StageAPI.AddBossData(quickBossData("Hush", {407, 0})) StageAPI.AddBossData(quickBossData("Rag Mega", {409, 0}, true)) StageAPI.AddBossData(quickBossData("Sisters Vis", {410, 0}, true)) StageAPI.AddBossData(quickBossData("Big Horn", {411, 0}, true)) StageAPI.AddBossData(quickBossData("Delirium", {412, 0}, true)) StageAPI.AddBossData(quickBossData("The Matriarch", {413, 0}, true, nil, "matriarch")) -- Repentance StageAPI.AddBossData(quickBossData("Tuff Twins", {19, 0}, true)) StageAPI.AddBossData(quickBossData("The Shell", {19, 1}, true, nil, "shell")) StageAPI.AddBossData(quickBossData("Wormwood", {62, 3}, true)) StageAPI.AddBossData(quickBossData("The Pile", {269, 1}, true, nil, "polycephalus2")) StageAPI.AddBossData(quickBossData("Reap Creep", {900, 0}, true)) StageAPI.AddBossData(quickBossData("Lil Blub", {901, 0}, true, nil, "beelzeblub")) StageAPI.AddBossData(quickBossData("The Rainmaker", {902, 0}, true, nil, "rainmaker")) StageAPI.AddBossData(quickBossData("The Visage", {903, 0}, true, nil, "visage")) StageAPI.AddBossData(quickBossData("The Siren", {904, 0}, true, nil, "siren")) StageAPI.AddBossData(quickBossData("The Heretic", {905, 0}, true, nil, "heretic")) StageAPI.AddBossData(quickBossData("Hornfel", {906, 0}, true)) StageAPI.AddBossData(quickBossData("Great Gideon", {907, 0}, true, nil, "gideon")) StageAPI.AddBossData(quickBossData("Baby Plum", {908, 0}, true)) StageAPI.AddBossData(quickBossData("The Scourge", {909, 0}, true, nil, "scourge")) StageAPI.AddBossData(quickBossData("Chimera", {910, 0}, true)) StageAPI.AddBossData(quickBossData("Rotgut", {911, 0}, true)) StageAPI.AddBossData(quickBossData("Mother", {912, 0}, true)) StageAPI.AddBossData(quickBossData("Min-Min", {913, 0}, true)) StageAPI.AddBossData(quickBossData("Clog", {914, 0}, true)) StageAPI.AddBossData(quickBossData("Singe", {915, 0}, true)) StageAPI.AddBossData(quickBossData("Bumbino", {916, 0}, true)) StageAPI.AddBossData(quickBossData("Colostomia", {917, 0}, true)) StageAPI.AddBossData(quickBossData("Turdlet", {918, 0}, true)) StageAPI.AddBossData(quickBossData("Raglich", {919, 0}, true)) StageAPI.AddBossData(quickBossData("Horny Boys", {920, 0}, true)) StageAPI.AddBossData(quickBossData("Clutch", {921, 0}, true)) StageAPI.AddBossData(quickBossData("Dogma", {950, 0}, true)) end do -- Base Floor Info local function poolWrap(pool) return {Pool = pool} end local settingStage = LevelStage.STAGE1_1 StageAPI.SetFloorInfo({ Prefix = "01_basement", VsBgColor = Color(26/255, 14/255, 12/255, 1, 0, 0, 0), VsDirtColor = Color(201/255, 114/255, 96/255, 1, 0, 0, 0), Backdrop = BackdropType.BASEMENT, RoomGfx = StageAPI.BaseRoomGfx.Basement, Bosses = poolWrap{ {BossID = "Monstro"}, {BossID = "Gemini"}, {BossID = "Larry Jr"}, {BossID = "Dingle"}, {BossID = "Dangle", Weight = 0.25}, {BossID = "Gurglings"}, {BossID = "Turdlings", Weight = 0.25}, {BossID = "Steven", Weight = 0.25}, {BossID = "Duke of Flies"}, {BossID = "Little Horn"}, {BossID = "Baby Plum"}, {BossID = "Famine", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_ORIGINAL) StageAPI.SetFloorInfo({ Prefix = "02_cellar", VsBgColor = Color(26/255, 17/255, 13/255, 1, 0, 0, 0), VsDirtColor = Color(229/255, 157/255, 111/255, 1, 0, 0, 0), Backdrop = BackdropType.CELLAR, RoomGfx = StageAPI.BaseRoomGfx.Cellar, Bosses = poolWrap{ {BossID = "Pin"}, {BossID = "Widow"}, {BossID = "Blighted Ovum"}, {BossID = "The Haunt"}, {BossID = "Duke of Flies"}, {BossID = "Little Horn"}, {BossID = "Rag Man"}, {BossID = "Baby Plum"}, {BossID = "Famine", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_WOTL) StageAPI.SetFloorInfo({ Prefix = "13_burning_basement", VsBgColor = Color(28/255, 12/255, 10/255, 1, 0, 0, 0), VsDirtColor = Color(252/255, 108/255, 90/255, 1, 0, 0, 0), Backdrop = BackdropType.BURNT_BASEMENT, RoomGfx = StageAPI.BaseRoomGfx.BurningBasement, FloorTextColor = Color(0.5,0.5,0.5,1,0,0,0), Bosses = poolWrap{ {BossID = "Monstro"}, {BossID = "Gemini"}, {BossID = "Larry Jr"}, {BossID = "Dingle"}, {BossID = "Dangle", Weight = 0.25}, {BossID = "Gurglings"}, {BossID = "Turdlings", Weight = 0.25}, {BossID = "Steven", Weight = 0.25}, {BossID = "Duke of Flies"}, {BossID = "Little Horn"}, {BossID = "Baby Plum"}, {BossID = "Famine", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_AFTERBIRTH) StageAPI.SetFloorInfo({ Prefix = "01x_downpour", VsBgColor = Color(29/255, 30/255, 32/255, 1, 0, 0, 0), VsDirtColor = Color(149/255, 157/255, 167/255, 1, 0, 0, 0), Backdrop = BackdropType.DOWNPOUR, RoomGfx = StageAPI.BaseRoomGfx.Downpour, Bosses = poolWrap{ {BossID = "Lil Blub"}, {BossID = "Wormwood"}, {BossID = "The Rainmaker"}, {BossID = "Min-Min"} } }, settingStage, StageType.STAGETYPE_REPENTANCE) local downpourTwo = StageAPI.GetBaseFloorInfo(settingStage + 1, StageType.STAGETYPE_REPENTANCE, false) downpourTwo.HasMirrorLevel = true StageAPI.SetFloorInfo({ Prefix = "02x_dross", VsBgColor = Color(35/255, 35/255, 29/255, 1, 0, 0, 0), VsDirtColor = Color(179/255, 179/255, 143/255, 1, 0, 0, 0), Backdrop = BackdropType.DROSS, RoomGfx = StageAPI.BaseRoomGfx.Dross, Bosses = poolWrap{ {BossID = "Lil Blub"}, {BossID = "Wormwood"}, {BossID = "Clog"}, {BossID = "Colostomia"}, {BossID = "Turdlet"} } }, settingStage, StageType.STAGETYPE_REPENTANCE_B) local downpourTwo = StageAPI.GetBaseFloorInfo(settingStage + 1, StageType.STAGETYPE_REPENTANCE_B, false) downpourTwo.HasMirrorLevel = true settingStage = LevelStage.STAGE2_1 StageAPI.SetFloorInfo({ Prefix = "03_caves", VsBgColor = Color(18/255, 13/255, 8/255, 1, 0, 0, 0), VsDirtColor = Color(167/255, 111/255, 75/255, 1, 0, 0, 0), Backdrop = BackdropType.CAVES, RoomGfx = StageAPI.BaseRoomGfx.Caves, Bosses = poolWrap{ {BossID = "Chub"}, {BossID = "Gurdy"}, {BossID = "Fistula"}, {BossID = "Mega Maw"}, {BossID = "Mega Fatty"}, {BossID = "Chad", Weight = 0.25}, {BossID = "Peep"}, {BossID = "Gurdy Jr"}, {BossID = "The Stain"}, {BossID = "Rag Mega"}, {BossID = "Big Horn"}, {BossID = "Bumbino"}, {BossID = "Pestilence", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_ORIGINAL) StageAPI.SetFloorInfo({ Prefix = "04_catacombs", VsBgColor = Color(15/255, 10/255, 8/255, 1, 0, 0, 0), VsDirtColor = Color(135/255, 90/255, 80/255, 1, 0, 0, 0), Backdrop = BackdropType.CATACOMBS, RoomGfx = StageAPI.BaseRoomGfx.Catacombs, Bosses = poolWrap{ {BossID = "The Hollow"}, {BossID = "The Husk"}, {BossID = "Dark One"}, {BossID = "Polycephalus"}, {BossID = "Carrion Queen"}, {BossID = "The Wretched"}, {BossID = "Peep"}, {BossID = "Gurdy Jr"}, {BossID = "The Forsaken"}, {BossID = "The Frail"}, {BossID = "Rag Mega"}, {BossID = "Big Horn"}, {BossID = "Bumbino"}, {BossID = "Pestilence", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_WOTL) StageAPI.SetFloorInfo({ Prefix = "14_drowned_caves", VsBgColor = Color(21/255, 28/255, 35/255, 1, 0, 0, 0), VsDirtColor = Color(111/255, 147/255, 180/255, 1, 0, 0, 0), Backdrop = BackdropType.FLOODED_CAVES, RoomGfx = StageAPI.BaseRoomGfx.FloodedCaves, Bosses = poolWrap{ {BossID = "Chub"}, {BossID = "Gurdy"}, {BossID = "Fistula"}, {BossID = "Mega Maw"}, {BossID = "Mega Fatty"}, {BossID = "Chad", Weight = 0.25}, {BossID = "Peep"}, {BossID = "Gurdy Jr"}, {BossID = "The Stain"}, {BossID = "The Forsaken"}, {BossID = "The Frail"}, {BossID = "Rag Mega"}, {BossID = "Big Horn"}, {BossID = "Bumbino"}, {BossID = "Pestilence", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_AFTERBIRTH) StageAPI.SetFloorInfo({ Prefix = "03x_mines", VsBgColor = Color(17/255, 15/255, 12/255, 1, 0, 0, 0), VsDirtColor = Color(93/255, 85/255, 72/255, 1, 0, 0, 0), Backdrop = BackdropType.MINES, RoomGfx = StageAPI.BaseRoomGfx.Mines, Bosses = poolWrap{ {BossID = "Reap Creep"}, {BossID = "Tuff Twins"}, {BossID = "Hornfel"}, {BossID = "Great Gideon"}, } }, settingStage, StageType.STAGETYPE_REPENTANCE) StageAPI.SetFloorInfo({ Prefix = "04x_ashpit", VsBgColor = Color(12/255, 10/255, 10/255, 1, 0, 0, 0), VsDirtColor = Color(106/255, 102/255, 94/255, 1, 0, 0, 0), Backdrop = BackdropType.ASHPIT, RoomGfx = StageAPI.BaseRoomGfx.Ashpit, Bosses = poolWrap{ {BossID = "The Pile"}, {BossID = "The Shell"}, {BossID = "Singe"}, {BossID = "Great Gideon"}, } }, settingStage, StageType.STAGETYPE_REPENTANCE_B) settingStage = LevelStage.STAGE3_1 StageAPI.SetFloorInfo({ Prefix = "05_depths", VsBgColor = Color(8/255, 8/255, 8/255, 1, 0, 0, 0), VsDirtColor = Color(70/255, 70/255, 72/255, 1, 0, 0, 0), Backdrop = BackdropType.DEPTHS, RoomGfx = StageAPI.BaseRoomGfx.Depths, Bosses = poolWrap{ {BossID = "The Cage"}, {BossID = "Monstro 2"}, {BossID = "The Gate"}, {BossID = "Gish", Weight = 0.25}, {BossID = "Loki"}, {BossID = "Brownie"}, {BossID = "Sisters Vis"}, {BossID = "Reap Creep"}, {BossID = "War", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_ORIGINAL) StageAPI.SetFloorInfo({ Prefix = "06_necropolis", VsBgColor = Color(10/255, 6/255, 6/255, 1, 0, 0, 0), VsDirtColor = Color(88/255, 67/255, 54/255, 1, 0, 0, 0), Backdrop = BackdropType.NECROPOLIS, RoomGfx = StageAPI.BaseRoomGfx.Necropolis, Bosses = poolWrap{ {BossID = "The Adversary"}, {BossID = "The Bloat"}, {BossID = "Mask of Infamy"}, {BossID = "Loki"}, {BossID = "Brownie"}, {BossID = "Sisters Vis"}, {BossID = "The Pile"}, {BossID = "War", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_WOTL) StageAPI.SetFloorInfo({ Prefix = "15_dank_depths", VsBgColor = Color(8/255, 8/255, 8/255, 1, 0, 0, 0), VsDirtColor = Color(70/255, 70/255, 72/255, 1, 0, 0, 0), Backdrop = BackdropType.DANK_DEPTHS, RoomGfx = StageAPI.BaseRoomGfx.DankDepths, Bosses = poolWrap{ {BossID = "The Cage"}, {BossID = "Monstro 2"}, {BossID = "The Gate"}, {BossID = "Gish", Weight = 0.25}, {BossID = "Loki"}, {BossID = "Brownie"}, {BossID = "Sisters Vis"}, {BossID = "Reap Creep"}, {BossID = "War", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_AFTERBIRTH) StageAPI.SetFloorInfo({ Prefix = "05x_mausoleum", VsBgColor = Color(14/255, 10/255, 14/255, 1, 0, 0, 0), VsDirtColor = Color(70/255, 59/255, 72/255, 1, 0, 0, 0), Backdrop = BackdropType.MAUSOLEUM, RoomGfx = StageAPI.BaseRoomGfx.Mausoleum, Bosses = poolWrap{ {BossID = "The Siren"}, {BossID = "The Heretic"}, } }, settingStage, StageType.STAGETYPE_REPENTANCE) StageAPI.SetFloorInfo({ Prefix = "06x_gehenna", VsBgColor = Color(15/255, 4/255, 4/255, 1, 0, 0, 0), VsDirtColor = Color(59/255, 41/255, 41/255, 1, 0, 0, 0), Backdrop = BackdropType.GEHENNA, RoomGfx = StageAPI.BaseRoomGfx.Gehenna, Bosses = poolWrap{ {BossID = "The Visage"}, {BossID = "Horny Boys"}, } }, settingStage, StageType.STAGETYPE_REPENTANCE_B) for stageType = StageType.STAGETYPE_ORIGINAL, StageType.STAGETYPE_REPENTANCE_B do if stageType ~= StageType.STAGETYPE_GREEDMODE then local floorInfo = StageAPI.GetBaseFloorInfo(LevelStage.STAGE3_2, stageType, false) floorInfo.Bosses = poolWrap{ {BossID = "Mom"} } end end settingStage = LevelStage.STAGE4_1 StageAPI.SetFloorInfo({ Prefix = "07_womb", VsBgColor = Color(27/255, 3/255, 3/255, 1, 0, 0, 0), VsDirtColor = Color(241/255, 28/255, 28/255, 1, 0, 0, 0), Backdrop = BackdropType.WOMB, RoomGfx = StageAPI.BaseRoomGfx.Womb, Bosses = poolWrap{ {BossID = "Scolex"}, {BossID = "Mama Gurdy"}, {BossID = "Lokii"}, {BossID = "Mr. Fred"}, {BossID = "Blastocyst"}, {BossID = "The Matriarch", Weight = 0.25}, {BossID = "Death", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Conquest", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_ORIGINAL) StageAPI.SetFloorInfo({ Prefix = "08_utero", VsBgColor = Color(22/255, 6/255, 5/255, 1, 0, 0, 0), VsDirtColor = Color(199/255, 60/255, 48/255, 1, 0, 0, 0), Backdrop = BackdropType.UTERO, RoomGfx = StageAPI.BaseRoomGfx.Utero, Bosses = poolWrap{ {BossID = "Teratoma"}, {BossID = "Lokii"}, {BossID = "Daddy Long Legs"}, {BossID = "Triachnid"}, {BossID = "The Bloat"}, {BossID = "Death", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Conquest", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_WOTL) StageAPI.SetFloorInfo({ Prefix = "16_scarred_womb", VsBgColor = Color(42/255, 19/255, 10/255, 1, 0, 0, 0), VsDirtColor = Color(247/255, 152/255, 88/255, 1, 0, 0, 0), Backdrop = BackdropType.SCARRED_WOMB, RoomGfx = StageAPI.BaseRoomGfx.ScarredWomb, Bosses = poolWrap{ {BossID = "Scolex"}, {BossID = "Mama Gurdy"}, {BossID = "Lokii"}, {BossID = "Mr. Fred"}, {BossID = "Blastocyst"}, {BossID = "Triachnid"}, {BossID = "The Matriarch", Weight = 2}, {BossID = "Death", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Conquest", Horseman = true, OnlyReplaceHorsemen = true}, {BossID = "Headless Horseman", Horseman = true, OnlyReplaceHorsemen = true}, } }, settingStage, StageType.STAGETYPE_AFTERBIRTH) for stageType = StageType.STAGETYPE_ORIGINAL, StageType.STAGETYPE_AFTERBIRTH do local floorInfo = StageAPI.GetBaseFloorInfo(LevelStage.STAGE4_2, stageType, false) floorInfo.Bosses = poolWrap{ {BossID = "Mom's Heart", OnlyReplaceSubtype = 8}, {BossID = "It Lives", OnlyReplaceSubtype = 25} } end StageAPI.SetFloorInfo({ Prefix = "07x_corpse", VsBgColor = Color(13/255, 14/255, 12/255, 1, 0, 0, 0), VsDirtColor = Color(124/255, 134/255, 111/255, 1, 0, 0, 0), Backdrop = BackdropType.CORPSE, RoomGfx = StageAPI.BaseRoomGfx.Corpse, Bosses = poolWrap{ {BossID = "The Scourge"}, {BossID = "Chimera"}, {BossID = "Rotgut"}, } }, settingStage, StageType.STAGETYPE_REPENTANCE) StageAPI.SetFloorInfo({ Prefix = "07x_corpse", Backdrop = BackdropType.MORTIS }, settingStage, StageType.STAGETYPE_REPENTANCE_B) settingStage = LevelStage.STAGE5 StageAPI.SetFloorInfo({ Prefix = "09_sheol", VsBgColor = Color(6/255, 6/255, 6/255, 1, 0, 0, 0), VsDirtColor = Color(60/255, 54/255, 54/255, 1, 0, 0, 0), Backdrop = BackdropType.SHEOL, RoomGfx = StageAPI.BaseRoomGfx.Sheol, Bosses = poolWrap{ {BossID = "Satan"} } }, settingStage, StageType.STAGETYPE_ORIGINAL, false) StageAPI.SetFloorInfo({ Prefix = "10_cathedral", VsBgColor = Color(6/255, 13/255, 17/255, 1, 0, 0, 0), VsDirtColor = Color(44/255, 100/255, 111/255, 1, 0, 0, 0), Backdrop = BackdropType.CATHEDRAL, RoomGfx = StageAPI.BaseRoomGfx.Cathedral, Bosses = poolWrap{ {BossID = "Isaac"} } }, settingStage, StageType.STAGETYPE_WOTL, false) settingStage = LevelStage.STAGE6 StageAPI.SetFloorInfo({ Prefix = "11_darkroom", VsBgColor = Color(9/255, 4/255, 3/255, 1, 0, 0, 0), VsDirtColor = Color(80/255, 38/255, 20/255, 1, 0, 0, 0), Backdrop = BackdropType.DARKROOM, RoomGfx = StageAPI.BaseRoomGfx.DarkRoom, Bosses = poolWrap{ {BossID = "The Lamb"} } }, settingStage, StageType.STAGETYPE_ORIGINAL, false) StageAPI.SetFloorInfo({ Prefix = "12_chest", VsBgColor = Color(15/255, 9/255, 6/255, 1, 0, 0, 0), VsDirtColor = Color(175/255, 108/255, 72/255, 1, 0, 0, 0), Backdrop = BackdropType.CHEST, RoomGfx = StageAPI.BaseRoomGfx.Chest, Bosses = poolWrap{ {BossID = "Blue Baby"} } }, settingStage, StageType.STAGETYPE_WOTL, false) -- Special Floors StageAPI.SetFloorInfo({ Prefix = "17_blue_womb", VsBgColor = Color(26/255, 32/255, 40/255, 1, 0, 0, 0), VsDirtColor = Color(157/255, 209/255, 255/255, 1, 0, 0, 0), Backdrop = BackdropType.BLUE_WOMB, RoomGfx = StageAPI.BaseRoomGfx.BlueWomb, Bosses = poolWrap{ {BossID = "Hush"} } }, LevelStage.STAGE4_3, true, false) StageAPI.SetFloorInfo({ Prefix = "19_void", VsBgColor = Color(0, 0, 0, 1, 0, 0, 0), VsDirtColor = Color(70/255, 5/255, 5/255, 1, 0, 0, 0), Backdrop = BackdropType.NUM_BACKDROPS }, LevelStage.STAGE7, true, false) StageAPI.SetFloorInfo({ Prefix = "0ex_dogma", Backdrop = BackdropType.ISAACS_BEDROOM, RoomGfx = StageAPI.BaseRoomGfx.Isaacs }, LevelStage.STAGE8, true, false) -- Greed Floors StageAPI.SetFloorInfo({ Prefix = "09_sheol", VsBgColor = Color(6/255, 6/255, 6/255, 1, 0, 0, 0), VsDirtColor = Color(60/255, 54/255, 54/255, 1, 0, 0, 0), Backdrop = BackdropType.SHEOL, RoomGfx = StageAPI.BaseRoomGfx.Sheol }, LevelStage.STAGE5_GREED, true, true) StageAPI.SetFloorInfo({ Prefix = "bossspot_18_shop", VsBgColor = Color(26/255, 17/255, 13/255, 1, 0, 0, 0), VsDirtColor = Color(229/255, 157/255, 111/255, 1, 0, 0, 0), Backdrop = BackdropType.SHOP, RoomGfx = StageAPI.BaseRoomGfx.Shop }, LevelStage.STAGE6_GREED, true, true) StageAPI.SetFloorInfo({ Prefix = "bossspot_18_shop", VsBgColor = Color(26/255, 17/255, 13/255, 1, 0, 0, 0), VsDirtColor = Color(229/255, 157/255, 111/255, 1, 0, 0, 0), Backdrop = BackdropType.SHOP, RoomGfx = StageAPI.BaseRoomGfx.Shop }, LevelStage.STAGE7_GREED, true, true) end
--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by yiguangzheng. --- DateTime: 2021/6/2 下午3:41 --- local t = { "a", "b", "c" } t[2] = "B" t["foo"] = "Bar" local s = t[3] .. t[2] .. t[1] .. t["foo"] .. #t
--[[ Title: Keepwork System Tag API Author(s): big Date: 2019.11.8 Place: Foshan use the lib: ------------------------------------------------------------ local KeepworkSystemTagApi = NPL.load("(gl)Mod/WorldShare/api/Keepwork/SystemTag.lua") ------------------------------------------------------------ ]] local KeepworkBaseApi = NPL.load('(gl)Mod/WorldShare/api/Keepwork/BaseApi.lua') local KeepworkSystemTagApi = NPL.export() -- url: /systemTags/search?classify=1&x-order=extra.sn-asc -- method: -- params: [[]] -- return: object function KeepworkSystemTagApi:Search(success, error) KeepworkBaseApi:Post('/systemTags/search?classify=1&x-order=extra.sn-asc', nil, nil, success, error) end
minetest.register_tool("rangedweapons:mp5_r", { stack_max= 1, wield_scale = {x=1.75,y=1.75,z=1.20}, description = "", rw_next_reload = "rangedweapons:mp5_rr", load_sound = "rangedweapons_handgun_mag_in", range = 0, groups = {not_in_creative_inventory = 1}, inventory_image = "rangedweapons_mp5_rld.png", }) minetest.register_tool("rangedweapons:mp5_rr", { stack_max= 1, wield_scale = {x=1.75,y=1.75,z=1.20}, description = "", rw_next_reload = "rangedweapons:mp5_rrr", load_sound = "rangedweapons_reload_a", range = 0, groups = {not_in_creative_inventory = 1}, inventory_image = "rangedweapons_mp5.png", }) minetest.register_tool("rangedweapons:mp5_rrr", { stack_max= 1, wield_scale = {x=1.75,y=1.75,z=1.20}, description = "", rw_next_reload = "rangedweapons:mp5", load_sound = "rangedweapons_reload_b", range = 0, groups = {not_in_creative_inventory = 1}, inventory_image = "rangedweapons_mp5.png", }) minetest.register_tool("rangedweapons:mp5", { stack_max= 1, wield_scale = {x=1.75,y=1.75,z=1.20}, description = "" ..core.colorize("#35cdff","MP5\n") ..core.colorize("#FFFFFF", "Gun damage: 3\n") ..core.colorize("#FFFFFF", "accuracy: 74%\n") ..core.colorize("#FFFFFF", "Gun knockback: 1\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 7%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n") ..core.colorize("#FFFFFF", "Clip size: 40/40\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum/10mm auto\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.075(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"), range = 0, inventory_image = "rangedweapons_mp5.png", RW_gun_capabilities = { automatic_gun = 1, gun_damage = {fleshy=3,knockback=1}, gun_crit = 7, gun_critEffc = 2.0, suitable_ammo = {{"rangedweapons:9mm",40},{"rangedweapons:10mm",40}}, gun_skill = {"smg_skill",75}, gun_magazine = "rangedweapons:machinepistol_mag", gun_icon = "rangedweapons_mp5_icon.png", gun_unloaded = "rangedweapons:mp5_r", gun_velocity = 25, gun_accuracy = 74, gun_cooldown = 0.075, gun_reload = 1.0/4, gun_projectiles = 1, has_shell = 1, gun_gravity = 0, gun_durability = 1600, gun_smokeSize = 4, gun_unload_sound = "rangedweapons_handgun_mag_out", gun_sound = "rangedweapons_machine_pistol", }, on_secondary_use = function(itemstack, user, pointed_thing) rangedweapons_reload_gun(itemstack, user) return itemstack end, })
return {'oester','oesterbank','oesterbar','oesterbed','oestercultuur','oesterkwekerij','oesterparel','oesterput','oestersaus','oesterschelp','oesterteelt','oesterzaad','oesterzwam','oestradiol','oestrogeen','oestrogeengehalte','oestrus','oestrogeensubstitutie','oestermes','oestervocht','oesterbeurs','oesterpark','oeselgem','oesterholt','oesterbanken','oesterkwekerijen','oesterkwekers','oesterpannen','oesterputten','oesters','oesterschelpen','oestertje','oestertjes','oestrogenen','oesterbedden','oesterparels','oesterzwammen','oestermessen'}
local function namespace(res) res = res or {} setmetatable(res, {__index= _G}) setfenv(2, res) return res end return namespace
-- Project: OiL - ORB in Lua -- Release: 0.6 -- Title : Client-side LuDO Protocol -- Authors: Renato Maia <maia@inf.puc-rio.br> local _G = require "_G" --[[VERBOSE]] local verbose = require "oil.verbose" local ipairs = _G.ipairs local pairs = _G.pairs local package = require "package" local loaded = package.loaded local proto = require "loop.proto" local clone = proto.clone local StringStream = require "loop.serial.StringStream" local oo = require "oil.oo" local class = oo.class local Codec = class() function Codec:localresources(resources) local names = {} local values = {} for name, resource in pairs(resources) do names[resource] = name values[name] = resource end local proxykind = resources.proxykind for _, kind in ipairs(proxykind) do local manager = proxykind[kind] local class = manager.class local name = kind.."ProxyClass" names[class] = name values[name] = class end self.encoderprototype = StringStream(names) self.decoderprototype = StringStream(values) self.encoderprototype:register(loaded) end function Codec:encoder() return clone(self.encoderprototype) end function Codec:decoder(stream) return clone(self.decoderprototype, { data = stream }) end return Codec
local CorePackages = game:GetService("CorePackages") local StarterPlayer = game:GetService("StarterPlayer") local Roact = require(CorePackages.Roact) local RoactRodux = require(CorePackages.RoactRodux) local Components = script.Parent local EmotesMenu = Components.Parent local CoreScriptsModules = EmotesMenu.Parent local Constants = require(EmotesMenu.Constants) local RobloxTranslator = require(CoreScriptsModules.RobloxTranslator) local WheelText = Roact.PureComponent:extend("WheelText") function WheelText:getWheelText() local currentEmotes = self.props.emotesPage.currentEmotes local locale = self.props.locale local numberEmotesLoaded = self.props.emotesPage.numberEmotesLoaded if next(currentEmotes) == nil then if StarterPlayer.UserEmotesEnabled and numberEmotesLoaded == 0 then return RobloxTranslator:FormatByKeyForLocale(Constants.LocalizationKeys.NoEmotesEquipped, locale) else return RobloxTranslator:FormatByKeyForLocale(Constants.LocalizationKeys.EmotesDisabled, locale) end end local focusedSlot = self.props.emotesWheel.focusedSegmentIndex local emoteName = currentEmotes[focusedSlot] if emoteName then return emoteName else return RobloxTranslator:FormatByKeyForLocale(Constants.LocalizationKeys.SelectAnEmote, locale) end end function WheelText:render() local LayoutConstants = Constants.Layouts[self.props.layout] local wheelText = self:getWheelText() return Roact.createElement("TextLabel", { AnchorPoint = Vector2.new(0.5, 0.5), Size = UDim2.new(Constants.InnerCircleSizeRatio, -Constants.TextPadding, Constants.InnerCircleSizeRatio, -Constants.TextPadding), Position = UDim2.new(0.5, 0, 0.5, 0), BackgroundTransparency = 1, Text = wheelText, TextScaled = true, TextSize = LayoutConstants.MiddleTextSize, TextColor3 = Constants.Colors.White, Font = LayoutConstants.MiddleTextFont, ZIndex = 5, -- TODO: Remove when CoreGui uses Sibling ZIndex }, { TextSizeConstraint = Roact.createElement("UITextSizeConstraint", { MaxTextSize = LayoutConstants.MiddleTextSize, }), }) end local function mapStateToProps(state) return { emotesWheel = state.emotesWheel, emotesPage = state.emotesPage, layout = state.layout, locale = state.locale, } end return RoactRodux.UNSTABLE_connect2(mapStateToProps, nil)(WheelText)
-- This module checks for the all the project dependencies. require('vstudio') require('premake/premake.fixes') require('premake/premake.extensions') newoption { trigger = "arch", description = "Choose a particular architecture / bitness", default = "x64", allowed = { { "x86", "x86 32-bits" }, { "x64", "x64 64-bits" }, } } newoption { trigger = "no-cxx11-abi", description = "disable C++-11 ABI on GCC 4.9+" } newoption { trigger = "disable-tests", description = "disable tests from being included" } newoption { trigger = "disable-examples", description = "disable examples from being included" } newoption { trigger = "configuration", description = "Choose a configuration", default = "Release", allowed = { { "Release", "Release" }, { "Debug", "Debug" }, } } rootdir = path.getabsolute("../") srcdir = path.join(rootdir, "src"); incdir = path.join(rootdir, "include"); examplesdir = path.join(rootdir, "examples"); testsdir = path.join(rootdir, "tests"); builddir = path.join(rootdir, "build") bindir = path.join(rootdir, "bin") objsdir = path.join(builddir, "obj"); gendir = path.join(builddir, "gen"); actionbuilddir = path.join(builddir, _ACTION == "gmake2" and "gmake" or (_ACTION and _ACTION or "")); bindircfg = path.join(bindir, "%{cfg.buildcfg}_%{cfg.platform}"); prjobjdir = path.join(objsdir, "%{prj.name}", "%{cfg.buildcfg}") msvc_buildflags = { "/MP", "/wd4267" } msvc_cpp_defines = { } default_gcc_version = "9.0.0" generate_build_config = true premake.path = premake.path .. ";" .. path.join(builddir, "modules") function string.starts(str, start) if str == nil then return end return string.sub(str, 1, string.len(start)) == start end function SafePath(path) return "\"" .. path .. "\"" end function target_architecture() return _OPTIONS["arch"] end function SetupNativeProject() location (path.join(actionbuilddir, "projects")) files { "*.lua" } filter { "configurations:Debug" } defines { "DEBUG" } filter { "configurations:Release" } defines { "NDEBUG" } optimize "On" -- Compiler-specific options filter { "toolset:msc*" } buildoptions { msvc_buildflags } defines { msvc_cpp_defines } filter { "system:linux" } buildoptions { gcc_buildflags } links { "stdc++" } filter { "toolset:clang", "system:not macosx" } linkoptions { "-fuse-ld=/usr/bin/ld.lld" } filter { "toolset:clang" } buildoptions { "-fstandalone-debug" } filter { "toolset:clang", "language:C++", "system:macosx" } buildoptions { gcc_buildflags, "-stdlib=libc++" } links { "c++" } filter { "toolset:not msc*", "language:C++" } cppdialect "C++14" buildoptions { "-fpermissive" } -- OS-specific options filter { "system:windows" } defines { "WIN32", "_WINDOWS" } -- For context: https://github.com/premake/premake-core/issues/935 filter {"system:windows", "toolset:msc*"} systemversion("latest") filter {} end function SetupManagedProject() language "C#" location "." filter {} end function IncludeDir(dir) local deps = os.matchdirs(dir .. "/*") for i,dep in ipairs(deps) do local fp = path.join(dep, "premake5.lua") fp = path.join(os.getcwd(), fp) if os.isfile(fp) then include(dep) return end fp = path.join(dep, "premake4.lua") fp = path.join(os.getcwd(), fp) if os.isfile(fp) then --print(string.format(" including %s", dep)) include(dep) end end end function StaticLinksOpt(libnames) local path = table.concat(cc.configset.libdirs, ";") local formats if os.is("windows") then formats = { "%s.lib" } else formats = { "lib%s.a" } end table.insert(formats, "%s"); local existing_libnames = {} for _, libname in ipairs(libnames) do for _, fmt in ipairs(formats) do local name = string.format(fmt, libname) if os.pathsearch(name, path) then table.insert(existing_libnames, libname) end end end links(existing_libnames) end function UseClang() local cc = _OPTIONS.cc or "" local env = os.getenv("CXX") or "" return string.match(cc, "clang") or string.match(env, "clang") end function GccVersion() local compiler = os.getenv("CXX") if compiler == nil then compiler = "gcc" end local out = os.outputof(compiler.." -v") if out == nil then return default_gcc_version end local version = string.match(out, "gcc[ -][Vv]ersion [0-9\\.]+") if version ~= nil then return string.sub(version, 13) end version = string.match(out, "clang[ -][Vv]ersion [0-9\\.]+") return string.sub(version, 15) end function UseCxx11ABI() if os.istarget("linux") and premake.checkVersion(GccVersion(), '4.9.0') and _OPTIONS["no-cxx11-abi"] == nil then return true end return false end function EnableNativeProjects() return not (string.starts(_ACTION, "vs") and not os.ishost("windows")) end function EnabledManagedProjects() return string.starts(_ACTION, "vs") end function EnabledCLIProjects() return EnabledManagedProjects() and os.istarget("windows") end function AddPlatformSpecificFiles(folder, filename) if os.istarget("windows") then filter { "toolset:msc*", "architecture:x86_64" } files { path.join(folder, "x86_64-pc-win32-msvc", filename) } filter { "toolset:msc*", "architecture:x86" } files { path.join(folder, "i686-pc-win32-msvc", filename) } elseif os.istarget("macosx") then filter { "architecture:x86_64" } files { path.join(folder, "x86_64-apple-darwin12.4.0", filename) } filter {"architecture:x86" } files { path.join(folder, "i686-apple-darwin12.4.0", filename) } elseif os.istarget("linux") then filter { "architecture:x86_64" } files { path.join(folder, "x86_64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) } else print "Unknown architecture" end end
return function() g.startify_lists = {{type = "dir", header = {" Most recently updated in " .. fn.getcwd()}}} -- use vsc root when enter file g.startify_change_to_vcs_root = 1 -- do not show 'edit' and 'quit' options g.startify_enable_special = 1 -- start from 1 when choosing g.startify_custom_indices = {"a", "r", "s", "t", "n", "e", "o", "i", 1, 2, 3, 4, 7, 8, 9, 0} end
require'compe'.setup { enabled = true; autocomplete = true; debug = false; min_length = 1; preselect = 'enable'; throttle_time = 80; source_timeout = 200; incomplete_delay = 400; max_abbr_width = 100; max_kind_width = 100; max_menu_width = 100; documentation = true; source = { -- Built-in buffer = true; calc = true; path = true; spell = true; tags = true; -- Neovim nvim_lsp = true; nvim_lua = true; -- External plugin treesitter = true; vsnip = true; -- External source tabnine = true; }; } vim.o.completeopt = "menuone,noselect"
AddCSLuaFile() AddCSLuaFile("sh_sounds.lua") include("sh_sounds.lua") SWEP.magType = "pistolMag" CustomizableWeaponry:registerAmmo(".380 ACP", ".380 ACP Rounds", 9, 17) SWEP.PrintName = "Micro Desert Eagle" if CLIENT then SWEP.DrawCrosshair = false SWEP.CSMuzzleFlashes = true SWEP.IconLetter = "y" killicon.Add( "", "", Color(255, 80, 0, 150)) SWEP.MuzzleEffect = "muzzleflash_pistol" SWEP.PosBasedMuz = true SWEP.Shell = "smallshell" SWEP.ShellScale = .45 SWEP.ShellOffsetMul = 0 SWEP.ShellPosOffset = {x = 0, y = 2, z = 0} SWEP.EffectiveRange_Orig = 34.2 * 39.37 SWEP.DamageFallOff_Orig = .47 SWEP.IronsightPos = Vector(3.7888, 0, 4.36) SWEP.IronsightAng = Vector(-4.1, 0.01, 0) SWEP.SprintPos = Vector(0, 0, 0) SWEP.SprintAng = Vector(-40, 0, 0) SWEP.CustomizePos = Vector(-4, -4.8889, 2.7778) SWEP.CustomizeAng = Vector(12.0805, -28.9933, -24.1611) SWEP.AlternativePos = Vector(1.3423, -2.2, 1.5) SWEP.AlternativeAng = Vector(0, 0, 0) SWEP.MoveType = 1 SWEP.ViewModelMovementScale = 1.5 SWEP.BoltBone = "slide" SWEP.BoltShootOffset = Vector(-1, 0, 0) SWEP.BoltReloadOffset = Vector(.85, 0, 0) SWEP.OffsetBoltDuringNonEmptyReload = true SWEP.ReloadBoltBonePositionRecoverySpeed = 25 SWEP.ReloadBoltBonePositionMoveSpeed = 999 SWEP.StopReloadBoneOffset = .8 SWEP.HoldBoltWhileEmpty = true SWEP.DontHoldWhenReloading = true SWEP.DisableSprintViewSimulation = true SWEP.LuaVMRecoilAxisMod = {vert = 1, hor = 2, roll = 4, forward = 1, pitch = 1} SWEP.CustomizationMenuScale = 0.013 SWEP.BoltBonePositionRecoverySpeed = 35 -- how fast does the bolt bone move back into it's initial position after the weapon has fired SWEP.AttachmentModelsVM = { ["md_tokasup"] = { type = "Model", model = "models/cw2/attachments/pbs1.mdl", bone = "body", rel = "", pos = Vector(-0.59, 5.86, .75), angle = Angle(90, 90, 90), size = Vector(0.48, 0.48, 0.48), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } end SWEP.MuzzleVelocity = 300 -- in meter/s SWEP.MagBGs = {main = 1, mag1 = 0, mag2 = 1} SWEP.LuaViewmodelRecoil = false SWEP.FullAimViewmodelRecoil = false SWEP.CanRestOnObjects = false SWEP.Attachments = {[1] = {header = "Magazine", offset = {-500, 50}, atts = {"bg_mdemag"}}, ["+reload"] = {header = "Ammo", offset = {400, -200}, atts = {"am_magnum", "am_matchgrade"}}} SWEP.Animations = {fire = {"shoot1","shoot2"}, reload = "reload", idle = "idle", draw = "draw"} SWEP.Sounds = {draw = {{time = 0, sound = "M92FS_DEPLOY"}}, reload = {[1] = {time = 0.6, sound = "RUBY_CLIPOUT"}, [2] = {time = 1.3, sound = "RUBY_CLIPIN"}, [3] = {time = 2, sound = "RUBY_SLIDEREL"}}} SWEP.SpeedDec = 5 SWEP.Slot = 1 SWEP.SlotPos = 0 SWEP.NormalHoldType = "pistol" SWEP.RunHoldType = "normal" SWEP.FireModes = {"semi"} SWEP.Base = "cw_base" SWEP.Category = "CW 2.0 - Pistols" SWEP.Author = "Khris" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Rack slide. Face barrel towards enemy. Do not eat." SWEP.ViewModelFOV = 75 SWEP.AimViewModelFOV = 75 SWEP.ViewModelFlip = true SWEP.ViewModel = "models/khrcw2/v_khri_microeagle.mdl" SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Primary.ClipSize = 6 SWEP.Primary.DefaultClip = 6 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = ".380 ACP" SWEP.FireDelay = 0.1 SWEP.FireSound = "RUBY_FIRE" SWEP.FireSoundSuppressed = "RUBY_FIRE_SUPPRESSED" SWEP.Recoil = 1.1 SWEP.FOVPerShot = 0.3 SWEP.HipSpread = 0.065 SWEP.AimSpread = 0.02 SWEP.VelocitySensitivity = .8 SWEP.MaxSpreadInc = 0.09 SWEP.SpreadPerShot = 0.01 SWEP.SpreadCooldown = 0.3 SWEP.Shots = 1 SWEP.Damage = 20 SWEP.DeployTime = 0.1 SWEP.ADSFireAnim = true SWEP.ReloadSpeed = .9 SWEP.ReloadTime = 1.9 SWEP.ReloadHalt = 1.9 SWEP.ReloadTime_Empty = 2.7 SWEP.ReloadHalt_Empty = 2.7 SWEP.SnapToIdlePostReload = true function SWEP:IndividualThink() self.EffectiveRange = 34.2 * 39.37 self.DamageFallOff = .47 if self.ActiveAttachments.am_matchgrade then self.EffectiveRange = ((self.EffectiveRange + 5.13 * 39.37)) self.DamageFallOff = ((self.DamageFallOff - .0705)) end end
module(..., package.seeall) function findMatchedTiles(gemsTable) local numberOfMarked = 0 -- set all tiles to false for i = 1, 8, 1 do for j = 1, 8, 1 do gemsTable[i][j].isMarked = false end end -- helper function to find matched tiles, set to true for all searched tiles local function checkMatchedTiles(self) self.isMarked = true numberOfMarked = numberOfMarked + 1 -- check on the left if self.i>1 then if (gemsTable[self.i-1][self.j]).isMarked == false then if (gemsTable[self.i-1][self.j]).gemType == self.gemType or (gemsTable[self.i-1][self.j]).gemType == "rainbow" then checkMatchedTiles( gemsTable[self.i-1][self.j] ) end end end -- check on the right if self.i<8 then if (gemsTable[self.i+1][self.j]).isMarked == false then if (gemsTable[self.i+1][self.j]).gemType == self.gemType or (gemsTable[self.i+1][self.j]).gemType == "rainbow" then checkMatchedTiles( gemsTable[self.i+1][self.j] ) end end end -- check above if self.j>1 then if (gemsTable[self.i][self.j-1]).isMarked == false then if (gemsTable[self.i][self.j-1]).gemType == self.gemType or (gemsTable[self.i][self.j-1]).gemType == "rainbow" then checkMatchedTiles( gemsTable[self.i][self.j-1] ) end end end -- check below if self.j<8 then if (gemsTable[self.i][self.j+1]).isMarked == false then if (gemsTable[self.i][self.j+1]).gemType == self.gemType or (gemsTable[self.i][self.j+1]).gemType == "rainbow" then checkMatchedTiles( gemsTable[self.i][self.j+1] ) end end end end for i = 1, 8, 1 do for j = 1, 8, 1 do numberOfMarked = 0 if gemsTable[i][j].class == "bomb" then return true end checkMatchedTiles(gemsTable[i][j]) if numberOfMarked >=3 then return true end end end return false end function findExplodedTiles(i, j, bombType, information) local bombSet = information["bombSet"] local gemsTable = information["gemsTable"] -- area if bombType == "area" then gemsTable[i][j].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i][j]) if i == 1 or i == 8 or j == 1 or j == 8 then if i == 1 and j == 1 then gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i+2][j].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i+1][j+1].isMarkedToDestroy = true gemsTable[i+2][j+1].isMarkedToDestroy = true gemsTable[i][j+2].isMarkedToDestroy = true gemsTable[i+1][j+2].isMarkedToDestroy = true gemsTable[i+2][j+2].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i+2][j]) table.insert(bombSet, gemsTable[i][j+1]) table.insert(bombSet, gemsTable[i+1][j+1]) table.insert(bombSet, gemsTable[i+2][j+1]) table.insert(bombSet, gemsTable[i][j+2]) table.insert(bombSet, gemsTable[i+1][j+2]) table.insert(bombSet, gemsTable[i+2][j+2]) elseif i == 1 and j == 8 then gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i+2][j].isMarkedToDestroy = true gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i+1][j-1].isMarkedToDestroy = true gemsTable[i+2][j-1].isMarkedToDestroy = true gemsTable[i][j-2].isMarkedToDestroy = true gemsTable[i+1][j-2].isMarkedToDestroy = true gemsTable[i+2][j-2].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i+2][j]) table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i+1][j-1]) table.insert(bombSet, gemsTable[i+2][j-1]) table.insert(bombSet, gemsTable[i][j-2]) table.insert(bombSet, gemsTable[i+1][j-2]) table.insert(bombSet, gemsTable[i+2][j-2]) elseif i == 8 and j == 1 then gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i-2][j].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i-1][j+1].isMarkedToDestroy = true gemsTable[i-2][j+1].isMarkedToDestroy = true gemsTable[i][j+2].isMarkedToDestroy = true gemsTable[i-1][j+2].isMarkedToDestroy = true gemsTable[i-2][j+2].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i-2][j]) table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i-1][j-1]) table.insert(bombSet, gemsTable[i-2][j-1]) table.insert(bombSet, gemsTable[i][j-2]) table.insert(bombSet, gemsTable[i-1][j-2]) table.insert(bombSet, gemsTable[i-2][j-2]) elseif i == 8 and j == 8 then gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i-2][j].isMarkedToDestroy = true gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i-1][j-1].isMarkedToDestroy = true gemsTable[i-2][j-1].isMarkedToDestroy = true gemsTable[i][j-2].isMarkedToDestroy = true gemsTable[i-1][j-2].isMarkedToDestroy = true gemsTable[i-2][j-2].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i-2][j]) table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i-1][j-1]) table.insert(bombSet, gemsTable[i-2][j-1]) table.insert(bombSet, gemsTable[i][j-2]) table.insert(bombSet, gemsTable[i-1][j-2]) table.insert(bombSet, gemsTable[i-2][j-2]) else if i == 1 then gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i+1][j-1].isMarkedToDestroy = true gemsTable[i+1][j+1].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i][j+1]) table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i+1][j-1]) table.insert(bombSet, gemsTable[i+1][j+1]) elseif i == 8 then gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i-1][j-1].isMarkedToDestroy = true gemsTable[i-1][j+1].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i][j+1]) table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i-1][j-1]) table.insert(bombSet, gemsTable[i-1][j+1]) elseif j == 1 then gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i+1][j+1].isMarkedToDestroy = true gemsTable[i-1][j+1].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i][j+1]) table.insert(bombSet, gemsTable[i+1][j+1]) table.insert(bombSet, gemsTable[i-1][j+1]) elseif j == 8 then gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i+1][j-1].isMarkedToDestroy = true gemsTable[i-1][j-1].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i+1][j-1]) table.insert(bombSet, gemsTable[i-1][j-1]) end end elseif 2 <= i and i <= 7 and 2 <= j and j <= 7 then gemsTable[i+1][j].isMarkedToDestroy = true gemsTable[i-1][j].isMarkedToDestroy = true gemsTable[i][j+1].isMarkedToDestroy = true gemsTable[i][j-1].isMarkedToDestroy = true gemsTable[i+1][j+1].isMarkedToDestroy = true gemsTable[i-1][j-1].isMarkedToDestroy = true gemsTable[i+1][j-1].isMarkedToDestroy = true gemsTable[i-1][j+1].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i+1][j]) table.insert(bombSet, gemsTable[i-1][j]) table.insert(bombSet, gemsTable[i][j+1]) table.insert(bombSet, gemsTable[i][j-1]) table.insert(bombSet, gemsTable[i+1][j+1]) table.insert(bombSet, gemsTable[i-1][j-1]) table.insert(bombSet, gemsTable[i+1][j-1]) table.insert(bombSet, gemsTable[i-1][j+1]) end -- cross explosion elseif bombType == "cross" then for k = 1, 8, 1 do if k == j then -- do nothing else gemsTable[i][k].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i][k]) end gemsTable[k][j].isMarkedToDestroy = true table.insert(bombSet, gemsTable[k][j]) end -- vertical explosion elseif bombType == "vertical" then for k = 1, 8, 1 do gemsTable[i][k].isMarkedToDestroy = true table.insert(bombSet, gemsTable[i][k]) end -- horizontal explosion elseif bombType == "horizontal" then for k = 1, 8, 1 do gemsTable[k][j].isMarkedToDestroy = true table.insert(bombSet, gemsTable[k][j]) end end information["bombSet"] = bombSet information["gemsTable"] = gemsTable return information end function isAdjacent(gem1, gem2) if (math.abs(gem1.i - gem2.i) + math.abs(gem1.j - gem2.j)) == 1 then return true else return false end end function updatePirateStatus(hp, mp, dmg, keys, table) -- initialize on the fly local colorsCount = { ["red"] = 0, ["green"] = 0, ["blue"] = 0, ["yellow"] = 0 } -- start counting for i = 1, #table, 1 do if table[i].gemType == "red" then colorsCount["red"] = colorsCount["red"] + 1 elseif table[i].gemType == "green" then colorsCount["green"] = colorsCount["green"] + 1 elseif table[i].gemType == "blue" then colorsCount["blue"] = colorsCount["blue"] + 1 elseif table[i].gemType == "yellow" then colorsCount["yellow"] = colorsCount["yellow"] + 1 end end -- update local currentHealth = hp:getHealth() local currentMana = mp:getMana() hp:addHpBy(colorsCount["green"], "percent") --mp:setMana(currentMana + colorsCount["blue"], 100) mp:addMpBy(colorsCount["blue"]) dmg:increaseDamageByN(colorsCount["red"]) keys:increaseKeysByN(colorsCount["yellow"]) end function updatePirateStatusWithCalculatedTable(hp, mp, dmg, keys, table) hp:addHpBy(table["green"], "percent") --mp:setMana(mp:getMana() + table["blue"], 100) mp:addMpBy(table["blue"]) dmg:increaseDamageByN(table["red"]) keys:increaseKeysByN(table["yellow"]) end
pg = pg or {} pg.enemy_data_statistics_67 = { [13048] = { cannon = 480, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, rarity = 4, dodge = 45, torpedo = 620, durability_growth = 46000, antiaircraft = 465, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 4, hit = 60, antisub_growth = 0, air_growth = 0, battle_unit_type = 55, base = 191, durability = 8700, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 24, luck = 10, id = 13048, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 340092, 340093, 340094, 340095 } }, [1305001] = { cannon = 350, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, rarity = 4, dodge = 95, torpedo = 420, durability_growth = 0, antiaircraft = 385, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 5, hit = 69, antisub_growth = 0, air_growth = 0, battle_unit_type = 60, base = 346, durability = 151800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 20, luck = 25, id = 1305001, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 340101, 340107, 340104, 340105, 340109 } }, [1305002] = { cannon = 300, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 480, rarity = 5, dodge = 75, torpedo = 0, durability_growth = 0, antiaircraft = 420, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 69, antisub_growth = 0, air_growth = 0, battle_unit_type = 70, base = 243, durability = 167900, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 16, luck = 25, id = 1305002, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 340111, 340113, 340114, 340115 } }, [1305003] = { cannon = 320, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 560, rarity = 5, dodge = 75, torpedo = 0, durability_growth = 0, antiaircraft = 450, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 72, antisub_growth = 0, air_growth = 0, battle_unit_type = 70, base = 243, durability = 149500, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 16, luck = 25, id = 1305003, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 340121, 340125 } }, [1305004] = { cannon = 320, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 560, rarity = 5, dodge = 75, torpedo = 0, durability_growth = 0, antiaircraft = 450, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 72, antisub_growth = 0, air_growth = 0, battle_unit_type = 70, base = 244, durability = 184000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 16, luck = 50, id = 1305004, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 340131, 340135 } }, [1305005] = { cannon = 520, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 680, rarity = 5, dodge = 75, torpedo = 0, durability_growth = 0, antiaircraft = 580, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 75, antisub_growth = 0, air_growth = 0, battle_unit_type = 60, base = 332, durability = 230000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 32, luck = 25, id = 1305005, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 340143, 340144, 340145, 340147 } }, [101000] = { cannon = 33, reload = 150, speed_growth = 0, cannon_growth = 300, pilot_ai_template_id = 20005, air = 0, rarity = 1, dodge = 0, torpedo = 46, durability_growth = 2600, antiaircraft = 25, reload_growth = 0, dodge_growth = 0, hit_growth = 120, star = 2, hit = 8, antisub_growth = 0, air_growth = 0, battle_unit_type = 20, base = 100, durability = 110, armor_growth = 0, torpedo_growth = 1440, luck_growth = 0, speed = 15, luck = 0, id = 101000, antiaircraft_growth = 666, antisub = 0, armor = 0, appear_fx = { "appearsmall" }, equipment_list = { 311002, 311004, 311092 } }, [101001] = { cannon = 33, reload = 150, speed_growth = 0, cannon_growth = 300, pilot_ai_template_id = 20005, air = 0, rarity = 1, dodge = 0, torpedo = 56, durability_growth = 2600, antiaircraft = 25, reload_growth = 0, dodge_growth = 0, hit_growth = 120, star = 2, hit = 8, antisub_growth = 0, air_growth = 0, battle_unit_type = 20, base = 105, durability = 120, armor_growth = 0, torpedo_growth = 1728, luck_growth = 0, speed = 15, luck = 0, id = 101001, antiaircraft_growth = 630, antisub = 0, armor = 0, appear_fx = { "appearsmall" }, equipment_list = { 311004, 311005, 311092 } }, [101002] = { cannon = 33, reload = 150, speed_growth = 0, cannon_growth = 300, pilot_ai_template_id = 20005, air = 0, rarity = 1, dodge = 0, torpedo = 56, durability_growth = 3000, antiaircraft = 25, reload_growth = 0, dodge_growth = 0, hit_growth = 120, star = 2, hit = 8, antisub_growth = 0, air_growth = 0, battle_unit_type = 20, base = 102, durability = 120, armor_growth = 0, torpedo_growth = 1728, luck_growth = 0, speed = 15, luck = 0, id = 101002, antiaircraft_growth = 630, antisub = 0, armor = 0, appear_fx = { "appearsmall" }, equipment_list = { 311007, 311008, 311092 } }, [101003] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 15, torpedo = 180, durability_growth = 12000, antiaircraft = 35, reload_growth = 0, dodge_growth = 222, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 169, durability = 280, armor_growth = 0, torpedo_growth = 4491, luck_growth = 0, speed = 24, luck = 0, id = 101003, antiaircraft_growth = 1638, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101004] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 14, torpedo = 180, durability_growth = 12000, antiaircraft = 35, reload_growth = 0, dodge_growth = 210, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 151, durability = 116, armor_growth = 0, torpedo_growth = 3744, luck_growth = 0, speed = 20, luck = 0, id = 101004, antiaircraft_growth = 1719, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101005] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 14, torpedo = 180, durability_growth = 12000, antiaircraft = 35, reload_growth = 0, dodge_growth = 210, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 153, durability = 180, armor_growth = 0, torpedo_growth = 3744, luck_growth = 0, speed = 30, luck = 0, id = 101005, antiaircraft_growth = 1719, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101006] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 15, torpedo = 165, durability_growth = 11800, antiaircraft = 35, reload_growth = 0, dodge_growth = 222, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 170, durability = 180, armor_growth = 0, torpedo_growth = 4491, luck_growth = 0, speed = 24, luck = 0, id = 101006, antiaircraft_growth = 1638, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101007] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 14, torpedo = 180, durability_growth = 12600, antiaircraft = 36, reload_growth = 0, dodge_growth = 210, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 150, durability = 132, armor_growth = 0, torpedo_growth = 3744, luck_growth = 0, speed = 24, luck = 0, id = 101007, antiaircraft_growth = 1719, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101008] = { cannon = 46, reload = 150, speed_growth = 0, cannon_growth = 520, pilot_ai_template_id = 10001, air = 0, rarity = 2, dodge = 14, torpedo = 165, durability_growth = 12600, antiaircraft = 36, reload_growth = 0, dodge_growth = 210, hit_growth = 210, star = 3, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 50, base = 152, durability = 132, armor_growth = 0, torpedo_growth = 3744, luck_growth = 0, speed = 24, luck = 0, id = 101008, antiaircraft_growth = 1719, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 100211, 100411 } }, [101009] = { cannon = 36, reload = 150, speed_growth = 0, cannon_growth = 600, pilot_ai_template_id = 20005, air = 0, rarity = 1, dodge = 0, torpedo = 45, durability_growth = 4700, antiaircraft = 24, reload_growth = 0, dodge_growth = 0, hit_growth = 120, star = 2, hit = 8, antisub_growth = 0, air_growth = 0, battle_unit_type = 25, base = 107, durability = 86, armor_growth = 0, torpedo_growth = 1296, luck_growth = 0, speed = 15, luck = 0, id = 101009, antiaircraft_growth = 1440, antisub = 0, armor = 0, appear_fx = { "appearsmall" }, equipment_list = { 311023, 311024, 311093 } } } return
local ROOT_DIR = path.getabsolute("..") function string.startwith(s, b) return s and b and string.sub(s, 1, string.len(b)) == b end local function crt_none() defines { "CRT_NONE=1", } buildoptions { "-nostdlib", "-nodefaultlibs", "-nostartfiles", "-Wa,--noexecstack", "-ffreestanding", } linkoptions { "-nostdlib", "-nodefaultlibs", "-nostartfiles", "-Wa,--noexecstack", "-ffreestanding", } configuration { "linux-*" } do buildoptions { "-mpreferred-stack-boundary=4", "-mstackrealign", } linkoptions { "-mpreferred-stack-boundary=4", "-mstackrealign", } end -- Clear config configuration {} end function toolchain(BUILD_DIR, LIB_DIR) newoption { trigger = "platform", value = "_PLATFORM", description = "Choose platform", allowed = { { "android-arm", "Android - ARM" }, { "android-x86", "Android - x86" }, { "wasm", "Emscripten/wasm" }, { "asmjs", "Emscripten/asm.js" }, --{ "freebsd", "FreeBSD" }, { "linux", "Linux" }, { "linux-afl", "Linux (AFL fuzzer)" }, { "linux-clang", "Linux (Clang compiler)" }, { "linux-clang-afl", "Linux (Clang + AFL fuzzer)" }, { "windows", "Windows (MSVC compiler)" }, { "windows-clang", "Windows (Clang compiler)" }, { "ios-arm", "iOS - ARM" }, { "ios-arm64", "iOS - ARM64" }, { "ios-simulator", "iOS - Simulator" }, { "ios-simulator64", "iOS - Simulator 64" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, { "mingw", "MinGW" }, --{ "mingw-clang", "MinGW (clang compiler)" }, --{ "netbsd", "NetBSD" }, { "osx", "OSX" }, --{ "orbis", "Orbis" }, --{ "riscv", "RISC-V" }, { "rpi", "RaspberryPi" }, }, } newoption { trigger = "vs", value = "toolset", description = "Choose VS toolset", allowed = { { "vs2012-clang", "Clang 3.6" }, { "vs2013-clang", "Clang 3.6" }, { "vs2015-clang", "Clang 3.9" }, { "vs2017-clang", "Clang with MS CodeGen" }, { "vs2012-xp", "Visual Studio 2012 targeting XP" }, { "vs2013-xp", "Visual Studio 2013 targeting XP" }, { "vs2015-xp", "Visual Studio 2015 targeting XP" }, { "vs2017-xp", "Visual Studio 2017 targeting XP" }, { "winstore100", "Universal Windows App 10.0" }, { "durango", "Durango" }, { "orbis", "Orbis" }, }, } newoption { trigger = "xcode", value = "xcode_target", description = "Choose XCode target", allowed = { { "osx", "OSX" }, { "ios", "iOS" }, { "tvos", "tvOS" }, } } newoption { trigger = "android", value = "#", description = "Set Android platform version (default: android-14).", } newoption { trigger = "ios", value = "#", description = "Set iOS target version (default: 8.0).", } newoption { trigger = "macos", value = "#", description = "Set macOS target version (default 10.11).", } newoption { trigger = "tvos", value = "#", description = "Set tvOS target version (default: 9.0).", } newoption { trigger = "windows", value = "#", description = "Set the Windows target platform version (default: $WindowsSDKVersion or 8.1).", } newoption { trigger = "dynamic-runtime", description = "Dynamically link with the runtime rather than statically", } newoption { trigger = "32bit-compiler", description = "Use 32-bit compiler instead 64-bit.", } newoption { trigger = "with-avx", description = "Use AVX extension.", } newaction { trigger = "android-studio", description = "Generate Android Studio project.", execute = function () os.execute("genie cmake") os.execute("cp -r android-studio " .. path.join(BUILD_DIR, "projects")) os.execute("cp -r " .. path.join(BUILD_DIR, "projects/cmake/*") .. " " .. path.join(BUILD_DIR, "projects/android-studio/app/jni")) end } -- Avoid error when invoking genie --help. if (_ACTION == nil) then return false end location (path.join(BUILD_DIR, "projects", _ACTION)) if _ACTION == "clean" then os.rmdir(BUILD_DIR) os.mkdir(BUILD_DIR) os.exit(1) end local android_platform = "android-24" if _OPTIONS["android"] then android_platform = "android-" .. _OPTIONS["android"] end local ios_platform = "" if _OPTIONS["ios"] then ios_platform = _OPTIONS["ios"] end local osx_platform = "" if _OPTIONS["osx"] then osx_platform = _OPTIONS["osx"] end local tvos_platform = "" if _OPTIONS["tvos"] then tvos_platform = _OPTIONS["tvos"] end local windows_platform = string.gsub(os.getenv("WindowsSDKVersion") or "8.1", "\\", "") if _OPTIONS["windows"] then windows_platform = _OPTIONS["windows"] end local compiler_32bit = false if _OPTIONS["32bit-compiler"] then compiler_32bit = true end flags { "Cpp14", "ExtraWarnings", } if string.startwith(_ACTION, "vs") then if not _OPTIONS["platform"] then _OPTIONS["platform"] = "windows" else print("Platform cannot specified when generate vs* projects.") os.exit(1) end end _PLATFORM = _OPTIONS["platform"] if _ACTION == "gmake" or _ACTION == "ninja" then if nil == _PLATFORM then print("Platform must be specified for gmake or ninja build!") os.exit(1) end if "windows" == _PLATFORM then print("Platform of gmake or ninja cannot be windows! Maybe your choice is windows-clang.") os.exit(1) end if "android-studio" == _PLATFORM then print("Platform of gmake or ninja cannot be windows! Maybe your choice is windows-clang.") os.exit(1) end if string.startwith(_PLATFORM, "android-") then if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ARM64") or not os.getenv("ANDROID_NDK_CLANG") or not os.getenv("ANDROID_NDK_ROOT") then print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, ANDROID_NDK_ARM64, and ANDROID_NDK_ROOT environment variables.") end premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++" premake.gcc.llvm = true location (path.join(BUILD_DIR, "projects", _ACTION .. "-" .. _PLATFORM)) if "android-arm" == _PLATFORM then premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar" premake.gcc.ld = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ld" elseif "android-arm64" == _PLATFORM then premake.gcc.ar = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ar" premake.gcc.ld = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ld" end elseif "asmjs" == _PLATFORM then if not os.getenv("EMSCRIPTEN") then print("Set EMSCRIPTEN environment variable.") end premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\"" premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\"" premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\"" premake.gcc.llvm = true location (path.join(BUILD_DIR, "projects", _ACTION .. "-asmjs")) elseif "wasm" == _PLATFORM then if not os.getenv("EMSCRIPTEN") then print("Set EMSCRIPTEN environment variable.") end premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\"" premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\"" premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\"" premake.gcc.llvm = true location (path.join(BUILD_DIR, "projects", _ACTION .. "-wasm")) elseif "freebsd" == _PLATFORM then location (path.join(BUILD_DIR, "projects", _ACTION .. "-freebsd")) elseif "ios-arm" == _PLATFORM or "ios-arm64" == _PLATFORM then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-" .. _PLATFORM)) elseif "ios-simulator" == _PLATFORM then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-ios-simulator")) elseif "ios-simulator64" == _PLATFORM then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-ios-simulator64")) elseif "tvos-arm64" == _PLATFORM then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-tvos-arm64")) elseif "tvos-simulator" == _PLATFORM then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-tvos-simulator")) elseif "linux" == _PLATFORM then premake.gcc.cc = "gcc" premake.gcc.cxx = "g++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-linux")) elseif "linux-afl" == _PLATFORM then premake.gcc.cc = "afl-gcc" premake.gcc.cxx = "afl-g++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-linux")) elseif "linux-clang" == _PLATFORM then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-linux-clang")) elseif "linux-clang-afl" == _PLATFORM then premake.gcc.cc = "afl-clang" premake.gcc.cxx = "afl-clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-linux-clang")) --[[ elseif "linux-steamlink" == _PLATFORM then if not os.getenv("MARVELL_SDK_PATH") then print("Set MARVELL_SDK_PATH environment variable.") end premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc" premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++" premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-linux-steamlink"))]] elseif "mingw" == _PLATFORM then if not os.getenv("MINGW") then --print("Set MINGW environment variable.") end local mingwToolchain = "x86_64-w64-mingw32" if compiler32bit then if os.is("linux") then mingwToolchain = "i686-w64-mingw32" else mingwToolchain = "mingw32" end end --premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc" --premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++" --premake.gcc.ar = "$(MINGW)/bin/ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-mingw")) elseif "mingw-clang" == _PLATFORM then premake.gcc.cc = "$(CLANG)/bin/clang" premake.gcc.cxx = "$(CLANG)/bin/clang++" premake.gcc.ar = "$(MINGW)/bin/ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-mingw-clang")) elseif "windows-clang" == _PLATFORM then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" premake.gcc.ar = "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-windows-clang")) --[[ elseif "netbsd" == _PLATFORM then location (path.join(BUILD_DIR, "projects", _ACTION .. "-netbsd"))]] elseif "osx" == _PLATFORM then if os.is("linux") then if not os.getenv("OSXCROSS") then print("Set OSXCROSS environment variable.") end local osx_toolchain = "x86_64-apple-darwin15-" premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osx_toolchain .. "clang" premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osx_toolchain .. "clang++" premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osx_toolchain .. "ar" end location (path.join(BUILD_DIR, "projects", _ACTION .. "-osx")) --[[ elseif "orbis" == _PLATFORM then if not os.getenv("SCE_ORBIS_SDK_DIR") then print("Set SCE_ORBIS_SDK_DIR environment variable.") end orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-" premake.gcc.cc = orbisToolchain .. "clang" premake.gcc.cxx = orbisToolchain .. "clang++" premake.gcc.ar = orbisToolchain .. "ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-orbis"))]] elseif "rpi" == _PLATFORM then location (path.join(BUILD_DIR, "projects", _ACTION .. "-rpi")) --[[ elseif "riscv" == _PLATFORM then premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc" premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++" premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar" location (path.join(BUILD_DIR, "projects", _ACTION .. "-riscv"))]] end elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" or _ACTION == "vs2017" then local action = premake.action.current() action.vstudio.windowsTargetPlatformVersion = windows_platform action.vstudio.windowsTargetPlatformMinVersion = windows_platform if (_ACTION .. "-clang") == _OPTIONS["vs"] then if "vs2017-clang" == _OPTIONS["vs"] then premake.vstudio.toolset = "v141_clang_c2" elseif "vs2015-clang" == _OPTIONS["vs"] then premake.vstudio.toolset = "LLVM-vs2014" else premake.vstudio.toolset = ("LLVM-" .. _ACTION) end location (path.join(BUILD_DIR, "projects", _ACTION .. "-clang")) elseif "winstore100" == _OPTIONS["vs"] then premake.vstudio.toolset = "v141" premake.vstudio.storeapp = "10.0" platforms { "ARM" } location (path.join(BUILD_DIR, "projects", _ACTION .. "-winstore100")) elseif "durango" == _OPTIONS["vs"] then if not os.getenv("DurangoXDK") then print("DurangoXDK not found.") end premake.vstudio.toolset = "v140" premake.vstudio.storeapp = "durango" platforms { "Durango" } location (path.join(BUILD_DIR, "projects", _ACTION .. "-durango")) elseif "orbis" == _OPTIONS["vs"] then if not os.getenv("SCE_ORBIS_SDK_DIR") then print("Set SCE_ORBIS_SDK_DIR environment variable.") end platforms { "Orbis" } location (path.join(BUILD_DIR, "projects", _ACTION .. "-orbis")) elseif ("vs2012-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v110_xp") location (path.join(BUILD_DIR, "projects", _ACTION .. "-xp")) elseif "vs2013-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v120_xp") location (path.join(BUILD_DIR, "projects", _ACTION .. "-xp")) elseif "vs2015-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v140_xp") location (path.join(BUILD_DIR, "projects", _ACTION .. "-xp")) elseif "vs2015-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v141_xp") location (path.join(BUILD_DIR, "projects", _ACTION .. "-xp")) end elseif _ACTION == "xcode4" or _ACTION == "xcode8" or _ACTION == "xcode9" then local action = premake.action.current() local str_or = function(str, def) return #str > 0 and str or def end if "osx" == _OPTIONS["xcode"] then action.xcode.macOSTargetPlatformVersion = str_or(osx_platform, "10.11") premake.xcode.toolset = "macosx" location (path.join(BUILD_DIR, "projects", _ACTION .. "-osx")) elseif "ios" == _OPTIONS["xcode"] then action.xcode.iOSTargetPlatformVersion = str_or(ios_platform, "8.0") premake.xcode.toolset = "iphoneos" location (path.join(BUILD_DIR, "projects", _ACTION .. "-ios")) elseif "tvos" == _OPTIONS["xcode"] then action.xcode.tvOSTargetPlatformVersion = str_or(tvos_platform, "9.0") premake.xcode.toolset = "appletvos" location (path.join(BUILD_DIR, "projects", _ACTION .. "-tvos")) end end if not _OPTIONS["dynamic-runtime"] then flags { "StaticRuntime" } end if _OPTIONS["with-avx"] then flags { "EnableAVX" } end if _OPTIONS["with-crtnone"] then crt_none() end flags { "NoPCH", "NativeWChar", "NoRTTI", "NoExceptions", "NoEditAndContinue", "NoFramePointer", } defines { "__STDC_LIMIT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_CONSTANT_MACROS", } configuration { "debug" } do targetsuffix ".debug" defines { "_DEBUG", } flags { "Symbols", } end configuration { "release" } do targetsuffix "" flags { "NoBufferSecurityCheck", "OptimizeSpeed", } defines { "NDEBUG", } end configuration { "qbs" } do flags { "ExtraWarnings", } end configuration { "vs*", "x32" } do flags { "EnableSSE2", } end configuration { "vs*", "not orbis", "not NX32", "not NX64" } --includedirs { path.join(ROOT_DIR, "include/compat/msvc") } defines { "WIN32", "_WIN32", "_HAS_EXCEPTIONS=0", "_HAS_ITERATOR_DEBUGGING=0", "_ITERATOR_DEBUG_LEVEL=0", "_SCL_SECURE=0", "_SECURE_SCL=0", "_SCL_SECURE_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS", "_CRT_SECURE_NO_DEPRECATE", } buildoptions { "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier "/Ob2", -- The Inline Function Expansion } linkoptions { "/ignore:4221", -- LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library } configuration { "vs2008" } --includedirs { path.join(ROOT_DIR, "include/compat/msvc/pre1600") } configuration { "x32", "vs*" } targetdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION, "bin")) objdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION, "obj")) libdirs { path.join(LIB_DIR, "lib/windows_x32_" .. _ACTION), } configuration { "x64", "vs*" } defines { "_WIN64" } targetdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION, "bin")) objdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION, "obj")) libdirs { path.join(LIB_DIR, "lib/windows_x64_" .. _ACTION), } configuration { "x32", "vs2017" } targetdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION, "bin")) objdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION, "obj")) libdirs { path.join(LIB_DIR, "lib/windows_x32_" .. _ACTION), } configuration { "x64", "vs2017" } defines { "_WIN64" } targetdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION, "bin")) objdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION, "obj")) libdirs { path.join(LIB_DIR, "lib/windows_x64_" .. _ACTION), } configuration { "ARM", "vs*" } targetdir (path.join(BUILD_DIR, "arm_" .. _ACTION, "bin")) objdir (path.join(BUILD_DIR, "arm_" .. _ACTION, "obj")) configuration { "vs*-clang" } buildoptions { "-Qunused-arguments", } configuration { "x32", "vs*-clang" } targetdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION .. "-clang/bin")) objdir (path.join(BUILD_DIR, "windows_x32_" .. _ACTION .. "-clang/obj")) configuration { "x64", "vs*-clang" } targetdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION .. "-clang/bin")) objdir (path.join(BUILD_DIR, "windows_x64_" .. _ACTION .. "-clang/obj")) configuration { "winstore*" } removeflags { "StaticRuntime", "NoBufferSecurityCheck", } buildoptions { "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc } linkoptions { "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata } configuration { "osx" } buildoptions { "-Wshadow", } configuration { "windows-clang" } buildoptions { "-fdeclspec", "-fms-extensions", --"-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++", --"-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32", --"-isystem$(MINGW)/x86_64-w64-mingw32/include", } linkoptions { "-Qunused-arguments", "-Wno-error=unused-command-line-argument-hard-error-in-future", } configuration { "x32", "windows-clang" } targetdir (path.join(BUILD_DIR, "windows_x32_clang/bin")) objdir (path.join(BUILD_DIR, "windows_x32_clang/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x32_clang"), } buildoptions { "-m32" } configuration { "x64", "windows-clang" } targetdir (path.join(BUILD_DIR, "windows_x64_clang/bin")) objdir (path.join(BUILD_DIR, "windows_x64_clang/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x64_clang"), } buildoptions { "-m64" } configuration { "mingw-*" } defines { "WIN32" } includedirs { path.join(ROOT_DIR, "include/compat/mingw") } defines { "MINGW_HAS_SECURE_API=1", } buildoptions { "-Wunused-value", "-fdata-sections", "-ffunction-sections", "-msse2", "-Wunused-value", "-Wundef", } linkoptions { "-Wl,--gc-sections", "-static", "-static-libgcc", "-static-libstdc++", } configuration { "x32", "mingw" } targetdir (path.join(BUILD_DIR, "windows_x32_mingw/bin")) objdir (path.join(BUILD_DIR, "windows_x32_mingw/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x32_mingw"), } buildoptions { "-m32" } configuration { "x64", "mingw" } targetdir (path.join(BUILD_DIR, "windows_x64_mingw/bin")) objdir (path.join(BUILD_DIR, "windows_x64_mingw/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x64_mingw"), } buildoptions { "-m64" } configuration { "x32", "mingw-clang" } targetdir (path.join(BUILD_DIR, "windows_x32_mingw-clang/bin")) objdir (path.join(BUILD_DIR, "windows_x32_mingw-clang/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x32_mingw-clang"), } buildoptions { "-m32" } configuration { "x64", "mingw-clang" } targetdir (path.join(BUILD_DIR, "windows_x64_mingw-clang/bin")) objdir (path.join(BUILD_DIR, "windows_x64_mingw-clang/obj")) libdirs { path.join(LIB_DIR, "lib/windows_x64_mingw-clang"), } buildoptions { "-m64" } configuration { "linux or linux-afl" } do buildoptions { "-msse2", -- "-Wdouble-promotion", -- "-Wduplicated-branches", -- "-Wduplicated-cond", -- "-Wjump-misses-init", --"-Wshadow", -- "-Wnull-dereference", "-Wunused-value", "-Wundef", -- "-Wuseless-cast", } links { "m", "rt", "dl", } linkoptions { "-Wl,--gc-sections", "-Wl,--as-needed", } end configuration { "linux or linux-afl", "x32" } targetdir (path.join(BUILD_DIR, "linux_x32/bin")) objdir (path.join(BUILD_DIR, "linux_x32/obj")) libdirs { path.join(LIB_DIR, "lib/linux_x32") } buildoptions { "-m32", } configuration { "linux or linux-afl", "x64" } targetdir (path.join(BUILD_DIR, "linux_x64/bin")) objdir (path.join(BUILD_DIR, "linux_x64/obj")) libdirs { path.join(LIB_DIR, "lib/linux_x64") } buildoptions { "-m64", } configuration { "linux-clang*" } do buildoptions { "-fdeclspec", "-fms-extensions", } end configuration { "linux-clang*", "x32" } do targetdir (path.join(BUILD_DIR, "linux_x32_clang/bin")) objdir (path.join(BUILD_DIR, "linux_x32_clang/obj")) libdirs { path.join(LIB_DIR, "lib/linux_x32_clang") } buildoptions { "-m32", } end configuration { "linux-clang*", "x64" } do targetdir (path.join(BUILD_DIR, "linux_x64_clang/bin")) objdir (path.join(BUILD_DIR, "linux_x64_clang/obj")) libdirs { path.join(LIB_DIR, "lib/linux_x64_clang") } buildoptions { "-m64", } end configuration { "android-*" } targetprefix ("lib") flags { "NoImportLib", } includedirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include", "${ANDROID_NDK_ROOT}/sysroot/usr/include", --"$(ANDROID_NDK_ROOT)/sources/android/native_app_glue", } linkoptions { --"-nostdlib", } links { "c", "dl", "m", "android", "log", "c++_shared", "gcc", } buildoptions { "-fdeclspec", "-fms-extensions", "-fPIC", "-no-canonical-prefixes", "-Wa,--noexecstack", "-fstack-protector-strong", "-ffunction-sections", "-Wunused-value", "-Wundef", } linkoptions { "-no-canonical-prefixes", "-Wl,--no-undefined", "-Wl,-z,noexecstack", "-Wl,-z,relro", "-Wl,-z,now", } --[[ configuration { "linux-steamlink" } targetdir (path.join(BUILD_DIR, "steamlink/bin")) objdir (path.join(BUILD_DIR, "steamlink/obj")) libdirs { path.join(LIB_DIR, "lib/steamlink") } includedirs { path.join(ROOT_DIR, "include/compat/linux") } defines { "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it. } buildoptions { "-Wfatal-errors", "-Wunused-value", "-Wundef", "-pthread", "-marm", "-mfloat-abi=hard", "--sysroot=$(MARVELL_SDK_PATH)/rootfs", } linkoptions { "-static-libgcc", "-static-libstdc++", "--sysroot=$(MARVELL_SDK_PATH)/rootfs", } ]] configuration { "android-arm", "x32" } do targetdir (path.join(BUILD_DIR, "android-arm/bin")) objdir (path.join(BUILD_DIR, "android-arm/obj")) libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a", } includedirs { "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi", } buildoptions { "-gcc-toolchain $(ANDROID_NDK_ARM)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm"), "-target armv7-none-linux-androideabi", "-mthumb", "-march=armv7-a", "-mfloat-abi=softfp", "-mfpu=neon", "-Wunused-value", "-Wundef", } linkoptions { "-gcc-toolchain $(ANDROID_NDK_ARM)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm/usr/lib/crtbegin_so.o"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm/usr/lib/crtend_so.o"), "-target armv7-none-linux-androideabi", "-march=armv7-a", "-Wl,--fix-cortex-a8", } end configuration { "android-arm", "x64" } do targetdir (path.join(BUILD_DIR, "android-arm64/bin")) objdir (path.join(BUILD_DIR, "android-arm64/obj")) libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a", } includedirs { "$(ANDROID_NDK_ROOT)/sysroot/usr/include/aarch64-linux-android", } buildoptions { "-gcc-toolchain $(ANDROID_NDK_ARM)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm64"), "-target arm64-none-linux-android", "-march=armv8-a", "-Wunused-value", "-Wundef", } linkoptions { "-gcc-toolchain $(ANDROID_NDK_ARM)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm64"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm64/usr/lib/crtbegin_so.o"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-arm64/usr/lib/crtend_so.o"), "-target arm64-none-linux-android", "-march=armv8-a", "-Wl,--fix-cortex-a8", } end configuration { "android-x86" } targetdir (path.join(BUILD_DIR, "android-x86/bin")) objdir (path.join(BUILD_DIR, "android-x86/obj")) libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86", } includedirs { "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android", } buildoptions { "-gcc-toolchain $(ANDROID_NDK_X86)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-x86"), "-target i686-none-linux-android", "-march=i686", "-mtune=atom", "-mstackrealign", "-msse3", "-mfpmath=sse", "-Wunused-value", "-Wundef", } linkoptions { "-gcc-toolchain $(ANDROID_NDK_X86)", "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-x86"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-x86/usr/lib/crtbegin_so.o"), path.join("$(ANDROID_NDK_ROOT)/platforms", android_platform, "arch-x86/usr/lib/crtend_so.o"), "-target i686-none-linux-android", } configuration { "asmjs" } targetdir (path.join(BUILD_DIR, "asmjs/bin")) objdir (path.join(BUILD_DIR, "asmjs/obj")) libdirs { path.join(LIB_DIR, "lib/asmjs") } buildoptions { "-s WASM=0", -- no Wasm "-fdeclspec", "-fms-extensions", --"-isystem\"$(EMSCRIPTEN)/system/include\"", --"-isystem\"$(EMSCRIPTEN)/system/include/libcxx\"", --"-isystem\"$(EMSCRIPTEN)/system/include/libc\"", "-Wunused-value", "-Wundef", } configuration { "wasm" } targetdir (path.join(BUILD_DIR, "wasm/bin")) objdir (path.join(BUILD_DIR, "wasm/obj")) libdirs { path.join(LIB_DIR, "lib/wasm") } buildoptions { "-s WASM=0", -- no Wasm "-fdeclspec", "-fms-extensions", --"-isystem\"$(EMSCRIPTEN)/system/include\"", --"-isystem\"$(EMSCRIPTEN)/system/include/libcxx\"", --"-isystem\"$(EMSCRIPTEN)/system/include/libc\"", "-Wunused-value", "-Wundef", } --[[ configuration { "freebsd" } targetdir (path.join(BUILD_DIR, "freebsd/bin")) objdir (path.join(BUILD_DIR, "freebsd/obj")) libdirs { path.join(LIB_DIR, "lib/freebsd") } includedirs { path.join(ROOT_DIR, "include/compat/freebsd"), } ]] configuration { "xbox360" } targetdir (path.join(BUILD_DIR, "xbox360/bin")) objdir (path.join(BUILD_DIR, "xbox360/obj")) includedirs { path.join(ROOT_DIR, "include/compat/msvc") } libdirs { path.join(LIB_DIR, "lib/xbox360") } defines { "NOMINMAX", } configuration { "durango" } targetdir (path.join(BUILD_DIR, "durango/bin")) objdir (path.join(BUILD_DIR, "durango/obj")) includedirs { path.join(ROOT_DIR, "include/compat/msvc") } libdirs { path.join(LIB_DIR, "lib/durango") } removeflags { "StaticRuntime" } defines { "NOMINMAX", } configuration { "netbsd" } targetdir (path.join(BUILD_DIR, "netbsd/bin")) objdir (path.join(BUILD_DIR, "netbsd/obj")) libdirs { path.join(LIB_DIR, "lib/netbsd") } includedirs { path.join(ROOT_DIR, "include/compat/freebsd"), } configuration { "osx", "x32" } targetdir (path.join(BUILD_DIR, "osx32_clang/bin")) objdir (path.join(BUILD_DIR, "osx32_clang/obj")) --libdirs { path.join(LIB_DIR, "lib/osx32_clang") } buildoptions { "-m32", } configuration { "osx", "x64" } targetdir (path.join(BUILD_DIR, "osx64_clang/bin")) objdir (path.join(BUILD_DIR, "osx64_clang/obj")) --libdirs { path.join(LIB_DIR, "lib/osx64_clang") } buildoptions { "-m64", } configuration { "osx", "Universal" } targetdir (path.join(BUILD_DIR, "osx_universal/bin")) objdir (path.join(BUILD_DIR, "osx_universal/bin")) configuration { "osx" } buildoptions { "-fdeclspec", "-fms-extensions", "-Wfatal-errors", "-msse2", "-Wunused-value", "-Wundef", } includedirs { path.join(ROOT_DIR, "include/compat/osx") } configuration { "ios*" } linkoptions { "-lc++", } buildoptions { "-fdeclspec", "-fms-extensions", "-Wfatal-errors", "-Wunused-value", "-Wundef", } includedirs { path.join(ROOT_DIR, "include/compat/ios") } configuration { "xcode*", "ios*" } targetdir (path.join(BUILD_DIR, "ios-arm/bin")) objdir (path.join(BUILD_DIR, "ios-arm/obj")) configuration { "ios-arm" } targetdir (path.join(BUILD_DIR, "ios-arm/bin")) objdir (path.join(BUILD_DIR, "ios-arm/obj")) libdirs { path.join(LIB_DIR, "lib/ios-arm") } linkoptions { "-arch armv7", } buildoptions { "-arch armv7", } configuration { "ios-arm64" } targetdir (path.join(BUILD_DIR, "ios-arm64/bin")) objdir (path.join(BUILD_DIR, "ios-arm64/obj")) libdirs { path.join(LIB_DIR, "lib/ios-arm64") } linkoptions { "-arch arm64", } buildoptions { "-arch arm64", } configuration { "ios-arm*" } linkoptions { "-miphoneos-version-min=7.0", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..ios_platform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..ios_platform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..ios_platform .. ".sdk/System/Library/Frameworks", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..ios_platform .. ".sdk/System/Library/PrivateFrameworks", } buildoptions { "-miphoneos-version-min=7.0", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..ios_platform .. ".sdk", "-fembed-bitcode", } configuration { "ios-simulator" } do targetdir (path.join(BUILD_DIR, "ios-simulator/bin")) objdir (path.join(BUILD_DIR, "ios-simulator/obj")) libdirs { path.join(LIB_DIR, "lib/ios-simulator") } linkoptions { "-mios-simulator-version-min=7.0", "-arch i386", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/System/Library/Frameworks", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/System/Library/PrivateFrameworks", } buildoptions { "-mios-simulator-version-min=7.0", "-arch i386", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk", } end configuration { "ios-simulator64" } do targetdir (path.join(BUILD_DIR, "ios-simulator64/bin")) objdir (path.join(BUILD_DIR, "ios-simulator64/obj")) libdirs { path.join(LIB_DIR, "lib/ios-simulator64") } linkoptions { "-mios-simulator-version-min=7.0", "-arch x86_64", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/System/Library/Frameworks", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk/System/Library/PrivateFrameworks", } buildoptions { "-mios-simulator-version-min=7.0", "-arch x86_64", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..ios_platform .. ".sdk", } end configuration { "tvos*" } do linkoptions { "-lc++", } buildoptions { "-fdeclspec", "-fms-extensions", "-Wfatal-errors", "-Wunused-value", "-Wundef", } includedirs { path.join(ROOT_DIR, "include/compat/ios") } end configuration { "xcode*", "tvos*" } do targetdir (path.join(BUILD_DIR, "tvos-arm64/bin")) objdir (path.join(BUILD_DIR, "tvos-arm64/obj")) end configuration { "tvos-arm64" } do targetdir (path.join(BUILD_DIR, "tvos-arm64/bin")) objdir (path.join(BUILD_DIR, "tvos-arm64/obj")) libdirs { path.join(LIB_DIR, "lib/tvos-arm64") } linkoptions { "-mtvos-version-min=9.0", "-arch arm64", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvos_platform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvos_platform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvos_platform .. ".sdk/System/Library/Frameworks", "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvos_platform .. ".sdk/System/Library/PrivateFrameworks", } buildoptions { "-mtvos-version-min=9.0", "-arch arm64", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvos_platform .. ".sdk", } end configuration { "tvos-simulator" } do targetdir (path.join(BUILD_DIR, "tvos-simulator/bin")) objdir (path.join(BUILD_DIR, "tvos-simulator/obj")) libdirs { path.join(LIB_DIR, "lib/tvos-simulator") } linkoptions { "-mtvos-simulator-version-min=9.0", "-arch i386", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvos_platform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvos_platform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvos_platform .. ".sdk/System/Library/Frameworks", "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvos_platform .. ".sdk/System/Library/PrivateFrameworks", } buildoptions { "-mtvos-simulator-version-min=9.0", "-arch i386", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvos_platform .. ".sdk", } end --[[ configuration { "orbis" } targetdir (path.join(BUILD_DIR, "orbis/bin")) objdir (path.join(BUILD_DIR, "orbis/obj")) libdirs { path.join(LIB_DIR, "lib/orbis") } includedirs { path.join(ROOT_DIR, "include/compat/freebsd"), "$(SCE_ORBIS_SDK_DIR)/target/include", "$(SCE_ORBIS_SDK_DIR)/target/include_common", }]] configuration { "rpi" } targetdir (path.join(BUILD_DIR, "rpi/bin")) objdir (path.join(BUILD_DIR, "rpi/obj")) libdirs { path.join(LIB_DIR, "lib/rpi"), "/opt/vc/lib", } defines { "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it. "__STDC_VERSION__=199901L", } buildoptions { "-Wunused-value", "-Wundef", } includedirs { "/opt/vc/include", "/opt/vc/include/interface/vcos/pthreads", "/opt/vc/include/interface/vmcs_host/linux", } links { "rt", "dl", } linkoptions { "-Wl,--gc-sections", } --[[ configuration { "riscv" } targetdir (path.join(BUILD_DIR, "riscv/bin")) objdir (path.join(BUILD_DIR, "riscv/obj")) defines { "__BSD_VISIBLE", "__MISC_VISIBLE", } includedirs { "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include", path.join(ROOT_DIR, "include/compat/riscv"), } buildoptions { "-Wunused-value", "-Wundef", "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf", } ]] configuration {} -- reset configuration return true end function strip() configuration { "android-arm", "release" } do postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\"" } end configuration { "android-x86", "release" } do postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\"" } end configuration { "linux-steamlink", "release" } do postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\"" } end configuration { "linux-* or rpi", "not linux-steamlink", "release" } do postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) strip -s \"$(TARGET)\"" } end configuration { "mingw*", "release" } do postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\"" } end configuration { "asmjs" } do postbuildcommands { "$(SILENT) echo Running asmjs finalize.", "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 " -- .. "-s ALLOW_MEMORY_GROWTH=1 " -- .. "-s ASSERTIONS=2 " -- .. "-s EMTERPRETIFY=1 " -- .. "-s EMTERPRETIFY_ASYNC=1 " .. "-s PRECISE_F32=1 " .. "-s TOTAL_MEMORY=268435456 " -- .. "-s USE_WEBGL2=1 " .. "-s WASM=0 " -- no wasm .. "--memory-init-file 1 " .. "\"$(TARGET)\" -o \"$(TARGET)\".html " -- .. "--preload-file ../../../examples/runtime@/ " } end configuration { "wasm" } do postbuildcommands { "$(SILENT) echo Running asmjs finalize.", "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 " -- .. "-s ALLOW_MEMORY_GROWTH=1 " -- .. "-s ASSERTIONS=2 " -- .. "-s EMTERPRETIFY=1 " -- .. "-s EMTERPRETIFY_ASYNC=1 " .. "-s PRECISE_F32=1 " .. "-s TOTAL_MEMORY=268435456 " -- .. "-s USE_WEBGL2=1 " .. "-s WASM=1 " -- has wasm .. "--memory-init-file 1 " .. "\"$(TARGET)\" -o \"$(TARGET)\".html " -- .. "--preload-file ../../../examples/runtime@/ " } end --[[ configuration { "riscv" } postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\"" } ]] configuration {} -- reset configuration end