|
|
|
@ -1,159 +1,163 @@
|
|
|
|
local a,b,c,d,e,f,g,h,i,j,k,l,m={},string,math,table,error,tonumber,tostring,
|
|
|
|
local a,b,c={},assert,{buffer={}}function c:New()local d={}setmetatable(d,self)
|
|
|
|
type,setmetatable,pairs,ipairs,assert,{buffer={}}function m:New()local n={}i(n,
|
|
|
|
self.__index=self d.buffer={}return d end function c:Append(d)self.buffer[#self.
|
|
|
|
self)self.__index=self n.buffer={}return n end function m:Append(n)self.buffer[#
|
|
|
|
buffer+1]=d end function c:ToString()return table.concat(self.buffer)end local d
|
|
|
|
self.buffer+1]=n end function m:ToString()return d.concat(self.buffer)end local
|
|
|
|
={backslashes={['\b']='\\b',['\t']='\\t',['\n']='\\n',['\f']='\\f',['\r']='\\r',
|
|
|
|
n={backslashes={['\b']='\\b',['\t']='\\t',['\n']='\\n',['\f']='\\f',['\r']='\\r'
|
|
|
|
['"']='\\"',['\\']='\\\\',['/']='\\/'}}function d:New()local e={}e.writer=c:New(
|
|
|
|
,['"']='\\"',['\\']='\\\\',['/']='\\/'}}function n:New()local o={}o.writer=m:
|
|
|
|
)setmetatable(e,self)self.__index=self return e end function d:Append(e)self.
|
|
|
|
New()i(o,self)self.__index=self return o end function n:Append(o)self.writer:
|
|
|
|
writer:Append(e)end function d:ToString()return self.writer:ToString()end
|
|
|
|
Append(o)end function n:ToString()return self.writer:ToString()end function n:
|
|
|
|
function d:Write(e)local f=type(e)if f=='nil'then self:WriteNil()elseif f==
|
|
|
|
Write(o)local p=h(o)if p=='nil'then self:WriteNil()elseif p=='boolean'or p==
|
|
|
|
'boolean'or f=='number'then self:WriteString(e)elseif f=='string'then self:
|
|
|
|
'number'then self:WriteString(o)elseif p=='string'then self:ParseString(o)elseif
|
|
|
|
ParseString(e)elseif f=='table'then self:WriteTable(e)elseif f=='function'then
|
|
|
|
p=='table'then self:WriteTable(o)elseif p=='function'then self:WriteFunction(o)
|
|
|
|
self:WriteFunction(e)elseif f=='thread'or f=='userdata'then self:WriteError(e)
|
|
|
|
elseif p=='thread'or p=='userdata'then self:WriteError(o)end end function n:
|
|
|
|
end end function d:WriteNil()self:Append'null'end function d:WriteString(e)self:
|
|
|
|
WriteNil()self:Append'null'end function n:WriteString(o)self:Append(g(o))end
|
|
|
|
Append(tostring(e))end function d:ParseString(e)self:Append'"'self:Append(string
|
|
|
|
function n:ParseString(o)self:Append'"'self:Append(b.gsub(o,'[%z%c\\"/]',
|
|
|
|
.gsub(e,'[%z%c\\"/]',function(f)local g=self.backslashes[f]if g then return g
|
|
|
|
function(p)local q=self.backslashes[p]if q then return q end return b.format(
|
|
|
|
end return string.format('\\u%.4X',string.byte(f))end))self:Append'"'end
|
|
|
|
'\\u%.4X',b.byte(p))end))self:Append'"'end function n:IsArray(o)local p,q=0,
|
|
|
|
function d:IsArray(e)local f,g=0,function(f)if type(f)=='number'and f>0 then if
|
|
|
|
function(p)if h(p)=='number'and p>0 then if c.floor(p)==p then return true end
|
|
|
|
math.floor(f)==f then return true end end return false end for h,i in pairs(e)do
|
|
|
|
end return false end for r,s in j(o)do if not q(r)then return false,'{','}'else
|
|
|
|
if not g(h)then return false,'{','}'else f=math.max(f,h)end end return true,'[',
|
|
|
|
p=c.max(p,r)end end return true,'[',']',p end function n:WriteTable(o)local p,q,
|
|
|
|
']',f end function d:WriteTable(e)local f,g,h,i=self:IsArray(e)self:Append(g)if
|
|
|
|
r,s=self:IsArray(o)self:Append(q)if p then for t=1,s do self:Write(o[t])if t<s
|
|
|
|
f then for j=1,i do self:Write(e[j])if j<i then self:Append','end end else local
|
|
|
|
then self:Append','end end else local t=true for u,v in j(o)do if not t then
|
|
|
|
j=true for k,l in pairs(e)do if not j then self:Append','end j=false self:
|
|
|
|
self:Append','end t=false self:ParseString(u)self:Append':'self:Write(v)end end
|
|
|
|
ParseString(k)self:Append':'self:Write(l)end end self:Append(h)end function d:
|
|
|
|
self:Append(r)end function n:WriteError(o)e(b.format(
|
|
|
|
WriteError(e)error(string.format('Encoding of %s unsupported',tostring(e)))end
|
|
|
|
'Encoding of %s unsupported',g(o)))end function n:WriteFunction(o)if o==Null
|
|
|
|
function d:WriteFunction(e)if e==Null then self:WriteNil()else self:WriteError(e
|
|
|
|
then self:WriteNil()else self:WriteError(o)end end local o={s='',i=0}function o:
|
|
|
|
)end end local e={s='',i=0}function e:New(f)local g={}setmetatable(g,self)self.
|
|
|
|
New(p)local q={}i(q,self)self.__index=self q.s=p or q.s return q end function o:
|
|
|
|
__index=self g.s=f or g.s return g end function e:Peek()local f=self.i+1 if f<=#
|
|
|
|
Peek()local p=self.i+1 if p<=#self.s then return b.sub(self.s,p,p)end return nil
|
|
|
|
self.s then return string.sub(self.s,f,f)end return nil end function e:Next()
|
|
|
|
end function o:Next()self.i=self.i+1 if self.i<=#self.s then return b.sub(self.s
|
|
|
|
self.i=self.i+1 if self.i<=#self.s then return string.sub(self.s,self.i,self.i)
|
|
|
|
,self.i,self.i)end return nil end function o:All()return self.s end local p={
|
|
|
|
end return nil end function e:All()return self.s end local f={escapes={['t']=
|
|
|
|
escapes={['t']='\t',['n']='\n',['f']='\f',['r']='\r',['b']='\b'}}function p:New(
|
|
|
|
'\t',['n']='\n',['f']='\f',['r']='\r',['b']='\b'}}function f:New(g)local h={}h.
|
|
|
|
q)local r={}r.reader=o:New(q)i(r,self)self.__index=self return r end function p:
|
|
|
|
reader=e:New(g)setmetatable(h,self)self.__index=self return h end function f:
|
|
|
|
Read()self:SkipWhiteSpace()local q=self:Peek()if q==nil then e(b.format(
|
|
|
|
Read()self:SkipWhiteSpace()local g=self:Peek()if g==nil then error(string.
|
|
|
|
"Nil string: '%s'",self:All()))elseif q=='{'then return self:ReadObject()elseif
|
|
|
|
format("Nil string: '%s'",self:All()))elseif g=='{'then return self:ReadObject()
|
|
|
|
q=='['then return self:ReadArray()elseif q=='"'then return self:ReadString()
|
|
|
|
elseif g=='['then return self:ReadArray()elseif g=='"'then return self:
|
|
|
|
elseif b.find(q,'[%+%-%d]')then return self:ReadNumber()elseif q=='t'then return
|
|
|
|
ReadString()elseif string.find(g,'[%+%-%d]')then return self:ReadNumber()elseif
|
|
|
|
self:ReadTrue()elseif q=='f'then return self:ReadFalse()elseif q=='n'then return
|
|
|
|
g=='t'then return self:ReadTrue()elseif g=='f'then return self:ReadFalse()elseif
|
|
|
|
self:ReadNull()elseif q=='/'then self:ReadComment()return self:Read()else return
|
|
|
|
g=='n'then return self:ReadNull()elseif g=='/'then self:ReadComment()return self
|
|
|
|
nil end end function p:ReadTrue()self:TestReservedWord{'t','r','u','e'}return
|
|
|
|
:Read()else return nil end end function f:ReadTrue()self:TestReservedWord{'t',
|
|
|
|
true end function p:ReadFalse()self:TestReservedWord{'f','a','l','s','e'}return
|
|
|
|
'r','u','e'}return true end function f:ReadFalse()self:TestReservedWord{'f','a',
|
|
|
|
false end function p:ReadNull()self:TestReservedWord{'n','u','l','l'}return nil
|
|
|
|
'l','s','e'}return false end function f:ReadNull()self:TestReservedWord{'n','u',
|
|
|
|
end function p:TestReservedWord(q)for r,s in k(q)do if self:Next()~=s then e(b.
|
|
|
|
'l','l'}return nil end function f:TestReservedWord(g)for h,i in ipairs(g)do if
|
|
|
|
format("Error reading '%s': %s",d.concat(q),self:All()))end end end function p:
|
|
|
|
self:Next()~=i then error(string.format("Error reading '%s': %s",table.concat(g)
|
|
|
|
ReadNumber()local q,r=self:Next(),self:Peek()while r~=nil and b.find(r,
|
|
|
|
,self:All()))end end end function f:ReadNumber()local g,h=self:Next(),self:Peek(
|
|
|
|
'[%+%-%d%.eE]')do q=q..self:Next()r=self:Peek()end q=f(q)if q==nil then e(b.
|
|
|
|
)while h~=nil and string.find(h,'[%+%-%d%.eE]')do g=g..self:Next()h=self:Peek()
|
|
|
|
format("Invalid number: '%s'",q))else return q end end function p:ReadString()
|
|
|
|
end g=tonumber(g)if g==nil then error(string.format("Invalid number: '%s'",g))
|
|
|
|
local q=''l(self:Next()=='"')while self:Peek()~='"'do local r=self:Next()if r==
|
|
|
|
else return g end end function f:ReadString()local g=''b(self:Next()=='"')while
|
|
|
|
'\\'then r=self:Next()if self.escapes[r]then r=self.escapes[r]end end q=q..r end
|
|
|
|
self:Peek()~='"'do local h=self:Next()if h=='\\'then h=self:Next()if self.
|
|
|
|
l(self:Next()=='"')local r=function(r)return b.char(f(r,16))end return b.gsub(q,
|
|
|
|
escapes[h]then h=self.escapes[h]end end g=g..h end b(self:Next()=='"')local h=
|
|
|
|
'u%x%x(%x%x)',r)end function p:ReadComment()l(self:Next()=='/')local q=self:
|
|
|
|
function(h)return string.char(tonumber(h,16))end return string.gsub(g,
|
|
|
|
Next()if q=='/'then self:ReadSingleLineComment()elseif q=='*'then self:
|
|
|
|
'u%x%x(%x%x)',h)end function f:ReadComment()b(self:Next()=='/')local g=self:
|
|
|
|
ReadBlockComment()else e(b.format('Invalid comment: %s',self:All()))end end
|
|
|
|
Next()if g=='/'then self:ReadSingleLineComment()elseif g=='*'then self:
|
|
|
|
function p:ReadBlockComment()local q=false while not q do local r=self:Next()if
|
|
|
|
ReadBlockComment()else error(string.format('Invalid comment: %s',self:All()))end
|
|
|
|
r=='*'and self:Peek()=='/'then q=true end if not q and r=='/'and self:Peek()==
|
|
|
|
end function f:ReadBlockComment()local g=false while not g do local h=self:Next(
|
|
|
|
'*'then e(b.format("Invalid comment: %s, '/*' illegal.",self:All()))end end self
|
|
|
|
)if h=='*'and self:Peek()=='/'then g=true end if not g and h=='/'and self:Peek()
|
|
|
|
:Next()end function p:ReadSingleLineComment()local q=self:Next()while q~='\r'and
|
|
|
|
=='*'then error(string.format("Invalid comment: %s, '/*' illegal.",self:All()))
|
|
|
|
q~='\n'do q=self:Next()end end function p:ReadArray()local q={}l(self:Next()==
|
|
|
|
end end self:Next()end function f:ReadSingleLineComment()local g=self:Next()
|
|
|
|
'[')local r=false if self:Peek()==']'then r=true end while not r do local s=self
|
|
|
|
while g~='\r'and g~='\n'do g=self:Next()end end function f:ReadArray()local g={}
|
|
|
|
:Read()q[#q+1]=s self:SkipWhiteSpace()if self:Peek()==']'then r=true end if not
|
|
|
|
b(self:Next()=='[')local h=false if self:Peek()==']'then h=true end while not h
|
|
|
|
r then local t=self:Next()if t~=','then e(b.format(
|
|
|
|
do local i=self:Read()g[#g+1]=i self:SkipWhiteSpace()if self:Peek()==']'then h=
|
|
|
|
"Invalid array: '%s' due to: '%s'",self:All(),t))end end end l(']'==self:Next())
|
|
|
|
true end if not h then local j=self:Next()if j~=','then error(string.format(
|
|
|
|
return q end function p:ReadObject()local q={}l(self:Next()=='{')local r=false
|
|
|
|
"Invalid array: '%s' due to: '%s'",self:All(),j))end end end b(']'==self:Next())
|
|
|
|
if self:Peek()=='}'then r=true end while not r do local s=self:Read()if h(s)~=
|
|
|
|
return g end function f:ReadObject()local g={}b(self:Next()=='{')local h=false
|
|
|
|
'string'then e(b.format('Invalid non-string object key: %s',s))end self:
|
|
|
|
if self:Peek()=='}'then h=true end while not h do local i=self:Read()if type(i)
|
|
|
|
SkipWhiteSpace()local t=self:Next()if t~=':'then e(b.format(
|
|
|
|
~='string'then error(string.format('Invalid non-string object key: %s',i))end
|
|
|
|
"Invalid object: '%s' due to: '%s'",self:All(),t))end self:SkipWhiteSpace()local
|
|
|
|
self:SkipWhiteSpace()local j=self:Next()if j~=':'then error(string.format(
|
|
|
|
u=self:Read()q[s]=u self:SkipWhiteSpace()if self:Peek()=='}'then r=true end if
|
|
|
|
"Invalid object: '%s' due to: '%s'",self:All(),j))end self:SkipWhiteSpace()local
|
|
|
|
not r then t=self:Next()if t~=','then e(b.format(
|
|
|
|
k=self:Read()g[i]=k self:SkipWhiteSpace()if self:Peek()=='}'then h=true end if
|
|
|
|
"Invalid array: '%s' near: '%s'",self:All(),t))end end end l(self:Next()=='}')
|
|
|
|
not h then j=self:Next()if j~=','then error(string.format(
|
|
|
|
return q end function p:SkipWhiteSpace()local q=self:Peek()while q~=nil and b.
|
|
|
|
"Invalid array: '%s' near: '%s'",self:All(),j))end end end b(self:Next()=='}')
|
|
|
|
find(q,'[%s/]')do if q=='/'then self:ReadComment()else self:Next()end q=self:
|
|
|
|
return g end function f:SkipWhiteSpace()local g=self:Peek()while g~=nil and
|
|
|
|
Peek()end end function p:Peek()return self.reader:Peek()end function p:Next()
|
|
|
|
string.find(g,'[%s/]')do if g=='/'then self:ReadComment()else self:Next()end g=
|
|
|
|
return self.reader:Next()end function p:All()return self.reader:All()end
|
|
|
|
self:Peek()end end function f:Peek()return self.reader:Peek()end function f:Next
|
|
|
|
function Encode(q)local r=n:New()r:Write(q)return r:ToString()end function
|
|
|
|
()return self.reader:Next()end function f:All()return self.reader:All()end
|
|
|
|
Decode(q)local r=p:New(q)return r:Read()end function Null()return Null end a.
|
|
|
|
function Encode(g)local h=d:New()h:Write(g)return h:ToString()end function
|
|
|
|
DecodeJSON=function(q)pcall(function()warn
|
|
|
|
Decode(g)local h=f:New(g)return h:Read()end function Null()return Null end a.
|
|
|
|
|
|
|
|
DecodeJSON=function(g)pcall(function()warn
|
|
|
|
[[RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead.]]
|
|
|
|
[[RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead.]]
|
|
|
|
end)if h(q)=='string'then return Decode(q)end print
|
|
|
|
end)if type(g)=='string'then return Decode(g)end print
|
|
|
|
'RbxUtil.DecodeJSON expects string argument!'return nil end a.EncodeJSON=
|
|
|
|
'RbxUtil.DecodeJSON expects string argument!'return nil end a.EncodeJSON=
|
|
|
|
function(q)pcall(function()warn
|
|
|
|
function(g)pcall(function()warn
|
|
|
|
[[RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead.]]
|
|
|
|
[[RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead.]]
|
|
|
|
end)return Encode(q)end a.MakeWedge=function(q,r,s,t)return game:GetService
|
|
|
|
end)return Encode(g)end a.MakeWedge=function(g,h,i,j)return game:GetService
|
|
|
|
'Terrain':AutoWedgeCell(q,r,s)end a.SelectTerrainRegion=function(q,r,s,t)local u
|
|
|
|
'Terrain':AutoWedgeCell(g,h,i)end a.SelectTerrainRegion=function(g,h,i,j)local k
|
|
|
|
=game.Workspace:FindFirstChild'Terrain'if not u then return end l(q)l(r)if not
|
|
|
|
=game.Workspace:FindFirstChild'Terrain'if not k then return end b(g)b(h)if not
|
|
|
|
h(q)=='Region3'then e(
|
|
|
|
type(g)=='Region3'then error(
|
|
|
|
[[regionToSelect (first arg), should be of type Region3, but is type]],h(q))end
|
|
|
|
[[regionToSelect (first arg), should be of type Region3, but is type]],type(g))
|
|
|
|
if not h(r)=='BrickColor'then e(
|
|
|
|
end if not type(h)=='BrickColor'then error(
|
|
|
|
[[color (second arg), should be of type BrickColor, but is type]],h(r))end local
|
|
|
|
[[color (second arg), should be of type BrickColor, but is type]],type(h))end
|
|
|
|
v,w,x,y,z=u.GetCell,u.WorldToCellPreferSolid,u.CellCenterToWorld,Enum.
|
|
|
|
local l,m,n,o,p=k.GetCell,k.WorldToCellPreferSolid,k.CellCenterToWorld,Enum.
|
|
|
|
CellMaterial.Empty,Instance.new'Model'z.Name='SelectionContainer'z.Archivable=
|
|
|
|
CellMaterial.Empty,Instance.new'Model'p.Name='SelectionContainer'p.Archivable=
|
|
|
|
false if t then z.Parent=t else z.Parent=game.Workspace end local A,B,C,D,E,F,G=
|
|
|
|
false if j then p.Parent=j else p.Parent=game.Workspace end local q,r,s,t,u,v,w=
|
|
|
|
nil,nil,0,nil,{},{},Instance.new'Part'G.Name='SelectionPart'G.Transparency=1 G.
|
|
|
|
nil,nil,0,nil,{},{},Instance.new'Part'w.Name='SelectionPart'w.Transparency=1 w.
|
|
|
|
Anchored=true G.Locked=true G.CanCollide=false G.Size=Vector3.new(4.2,4.2,4.2)
|
|
|
|
Anchored=true w.Locked=true w.CanCollide=false w.Size=Vector3.new(4.2,4.2,4.2)
|
|
|
|
local H=Instance.new'SelectionBox'function createAdornment(I)local J,K=nil,nil
|
|
|
|
local x=Instance.new'SelectionBox'function createAdornment(y)local z,A=nil,nil
|
|
|
|
if#F>0 then J=F[1]['part']K=F[1]['box']d.remove(F,1)K.Visible=true else J=G:
|
|
|
|
if#v>0 then z=v[1]['part']A=v[1]['box']table.remove(v,1)A.Visible=true else z=w:
|
|
|
|
Clone()J.Archivable=false K=H:Clone()K.Archivable=false K.Adornee=J K.Parent=z K
|
|
|
|
Clone()z.Archivable=false A=x:Clone()A.Archivable=false A.Adornee=z A.Parent=p A
|
|
|
|
.Adornee=J K.Parent=z end if I then K.Color=I end return J,K end function
|
|
|
|
.Adornee=z A.Parent=p end if y then A.Color=y end return z,A end function
|
|
|
|
cleanUpAdornments()for I,J in j(E)do if J.KeepAlive~=B then J.SelectionBox.
|
|
|
|
cleanUpAdornments()for y,z in pairs(u)do if z.KeepAlive~=r then z.SelectionBox.
|
|
|
|
Visible=false d.insert(F,{part=J.SelectionPart,box=J.SelectionBox})E[I]=nil end
|
|
|
|
Visible=false table.insert(v,{part=z.SelectionPart,box=z.SelectionBox})u[y]=nil
|
|
|
|
end end function incrementAliveCounter()C=C+1 if C>1000000 then C=0 end return C
|
|
|
|
end end end function incrementAliveCounter()s=s+1 if s>1000000 then s=0 end
|
|
|
|
end function adornFullCellsInRegion(I,J)local K,L=I.CFrame.p-(I.Size/2)+Vector3.
|
|
|
|
return s end function adornFullCellsInRegion(y,z)local A,B=y.CFrame.p-(y.Size/2)
|
|
|
|
new(2,2,2),I.CFrame.p+(I.Size/2)-Vector3.new(2,2,2)local M,N=w(u,K),w(u,L)B=
|
|
|
|
+Vector3.new(2,2,2),y.CFrame.p+(y.Size/2)-Vector3.new(2,2,2)local C,D=m(k,A),m(k
|
|
|
|
incrementAliveCounter()for O=M.y,N.y do for P=M.z,N.z do for Q=M.x,N.x do local
|
|
|
|
,B)r=incrementAliveCounter()for E=C.y,D.y do for F=C.z,D.z do for G=C.x,D.x do
|
|
|
|
R=v(u,Q,O,P)if R~=y then local S,T,U=x(u,Q,O,P),Vector3int16.new(Q,O,P),false
|
|
|
|
local H=l(k,G,E,F)if H~=o then local I,J,K=n(k,G,E,F),Vector3int16.new(G,E,F),
|
|
|
|
for V,W in j(E)do if V==T then W.KeepAlive=B if J then W.SelectionBox.Color=J
|
|
|
|
false for L,M in pairs(u)do if L==J then M.KeepAlive=r if z then M.SelectionBox.
|
|
|
|
end U=true break end end if not U then local X,Y=createAdornment(J)X.Size=
|
|
|
|
Color=z end K=true break end end if not K then local N,O=createAdornment(z)N.
|
|
|
|
Vector3.new(4,4,4)X.CFrame=CFrame.new(S)local Z={SelectionPart=X,SelectionBox=Y,
|
|
|
|
Size=Vector3.new(4,4,4)N.CFrame=CFrame.new(I)local P={SelectionPart=N,
|
|
|
|
KeepAlive=B}E[T]=Z end end end end end cleanUpAdornments()end D=q if s then
|
|
|
|
SelectionBox=O,KeepAlive=r}u[J]=P end end end end end cleanUpAdornments()end t=g
|
|
|
|
local I,J=createAdornment(r)I.Size=q.Size I.CFrame=q.CFrame E.SelectionPart=I E.
|
|
|
|
if i then local y,z=createAdornment(h)y.Size=g.Size y.CFrame=g.CFrame u.
|
|
|
|
SelectionBox=J A=function(K,L)if K and K~=D then D=K I.Size=K.Size I.CFrame=K.
|
|
|
|
SelectionPart=y u.SelectionBox=z q=function(A,B)if A and A~=t then t=A y.Size=A.
|
|
|
|
CFrame end if L then J.Color=L end end else adornFullCellsInRegion(q,r)A=
|
|
|
|
Size y.CFrame=A.CFrame end if B then z.Color=B end end else
|
|
|
|
function(I,J)if I and I~=D then D=I adornFullCellsInRegion(I,J)end end end local
|
|
|
|
adornFullCellsInRegion(g,h)q=function(y,z)if y and y~=t then t=y
|
|
|
|
I=function()A=nil if z then z:Destroy()end E=nil end return A,I end function a.
|
|
|
|
adornFullCellsInRegion(y,z)end end end local y=function()q=nil if p then p:
|
|
|
|
CreateSignal()local q,r,s={},Instance.new'BindableEvent',{}function q:connect(t)
|
|
|
|
Destroy()end u=nil end return q,y end function a.CreateSignal()local g,h,i={},
|
|
|
|
if self~=q then e('connect must be called with `:`, not `.`',2)end if h(t)~=
|
|
|
|
Instance.new'BindableEvent',{}function g:connect(j)if self~=g then error(
|
|
|
|
'function'then e('Argument #1 of connect must be a function, got a '..h(t),2)end
|
|
|
|
'connect must be called with `:`, not `.`',2)end if type(j)~='function'then
|
|
|
|
local u=r.Event:connect(t)s[u]=true local v={}function v:disconnect()u:
|
|
|
|
error('Argument #1 of connect must be a function, got a '..type(j),2)end local k
|
|
|
|
disconnect()s[u]=nil end v.Disconnect=v.disconnect return v end function q:
|
|
|
|
=h.Event:connect(j)i[k]=true local l={}function l:disconnect()k:disconnect()i[k]
|
|
|
|
disconnect()if self~=q then e('disconnect must be called with `:`, not `.`',2)
|
|
|
|
=nil end l.Disconnect=l.disconnect return l end function g:disconnect()if self~=
|
|
|
|
end for t,u in j(s)do t:disconnect()s[t]=nil end end function q:wait()if self~=q
|
|
|
|
g then error('disconnect must be called with `:`, not `.`',2)end for j,k in
|
|
|
|
then e('wait must be called with `:`, not `.`',2)end return r.Event:wait()end
|
|
|
|
pairs(i)do j:disconnect()i[j]=nil end end function g:wait()if self~=g then
|
|
|
|
function q:fire(...)if self~=q then e('fire must be called with `:`, not `.`',2)
|
|
|
|
error('wait must be called with `:`, not `.`',2)end return h.Event:wait()end
|
|
|
|
end r:Fire(...)end q.Connect=q.connect q.Disconnect=q.disconnect q.Wait=q.wait q
|
|
|
|
function g:fire(...)if self~=g then error(
|
|
|
|
.Fire=q.fire return q end local function Create_PrivImpl(q)if h(q)~='string'then
|
|
|
|
'fire must be called with `:`, not `.`',2)end h:Fire(...)end g.Connect=g.connect
|
|
|
|
e('Argument of Create must be a string',2)end return function(r)r=r or{}local s,
|
|
|
|
g.Disconnect=g.disconnect g.Wait=g.wait g.Fire=g.fire return g end
|
|
|
|
t,u=Instance.new(q),nil,nil for v,w in j(r)do if h(v)=='string'then if v==
|
|
|
|
local function Create_PrivImpl(g)if type(g)~='string'then error(
|
|
|
|
'Parent'then t=w else s[v]=w end elseif h(v)=='number'then if h(w)~='userdata'
|
|
|
|
'Argument of Create must be a string',2)end return function(h)h=h or{}local i,j,
|
|
|
|
then e(
|
|
|
|
k=Instance.new(g),nil,nil for l,m in pairs(h)do if type(l)=='string'then if l==
|
|
|
|
|
|
|
|
'Parent'then j=m else i[l]=m end elseif type(l)=='number'then if type(m)~=
|
|
|
|
|
|
|
|
'userdata'then error(
|
|
|
|
[[Bad entry in Create body: Numeric keys must be paired with children, got a: ]]
|
|
|
|
[[Bad entry in Create body: Numeric keys must be paired with children, got a: ]]
|
|
|
|
..h(w),2)end w.Parent=s elseif h(v)=='table'and v.__eventname then if h(w)~=
|
|
|
|
..type(m),2)end m.Parent=i elseif type(l)=='table'and l.__eventname then if
|
|
|
|
'function'then e("Bad entry in Create body: Key `[Create.E'"..v.__eventname..
|
|
|
|
type(m)~='function'then error("Bad entry in Create body: Key `[Create.E'"..l.
|
|
|
|
"']` must have a function value, got: "..g(w),2)end s[v.__eventname]:connect(w)
|
|
|
|
__eventname.."']` must have a function value, got: "..tostring(m),2)end i[l.
|
|
|
|
elseif v==a.Create then if h(w)~='function'then e(
|
|
|
|
__eventname]:connect(m)elseif l==a.Create then if type(m)~='function'then error(
|
|
|
|
[[Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: ]]
|
|
|
|
[[Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: ]]
|
|
|
|
..g(w),2)elseif u then e(
|
|
|
|
..tostring(m),2)elseif k then error(
|
|
|
|
[[Bad entry in Create body: Only one constructor function is allowed]],2)end u=w
|
|
|
|
[[Bad entry in Create body: Only one constructor function is allowed]],2)end k=m
|
|
|
|
else e('Bad entry ('..g(v)..' => '..g(w)..') in Create body',2)end end if u then
|
|
|
|
else error('Bad entry ('..tostring(l)..' => '..tostring(m)..') in Create body',2
|
|
|
|
u(s)end if t then s.Parent=t end return s end end a.Create=i({},{__call=function
|
|
|
|
)end end if k then k(i)end if j then i.Parent=j end return i end end a.Create=
|
|
|
|
(q,...)return Create_PrivImpl(...)end})a.Create.E=function(q)return{__eventname=
|
|
|
|
setmetatable({},{__call=function(g,...)return Create_PrivImpl(...)end})a.Create.
|
|
|
|
q}end a.Help=function(q)if q=='DecodeJSON'or q==a.DecodeJSON then return
|
|
|
|
E=function(g)return{__eventname=g}end a.Help=function(g)if g=='DecodeJSON'or g==
|
|
|
|
|
|
|
|
a.DecodeJSON then return
|
|
|
|
[[Function DecodeJSON. Arguments: (string). Side effect: returns a table with all parsed JSON values]]
|
|
|
|
[[Function DecodeJSON. Arguments: (string). Side effect: returns a table with all parsed JSON values]]
|
|
|
|
end if q=='EncodeJSON'or q==a.EncodeJSON then return
|
|
|
|
end if g=='EncodeJSON'or g==a.EncodeJSON then return
|
|
|
|
[[Function EncodeJSON. Arguments: (table). Side effect: returns a string composed of argument table in JSON data format]]
|
|
|
|
[[Function EncodeJSON. Arguments: (table). Side effect: returns a string composed of argument table in JSON data format]]
|
|
|
|
end if q=='MakeWedge'or q==a.MakeWedge then return
|
|
|
|
end if g=='MakeWedge'or g==a.MakeWedge then return
|
|
|
|
[[Function MakeWedge. Arguments: (x, y, z, [default material]). Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was. Returns true if made a wedge, false if the cell remains a block ]]
|
|
|
|
[[Function MakeWedge. Arguments: (x, y, z, [default material]). Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was. Returns true if made a wedge, false if the cell remains a block ]]
|
|
|
|
end if q=='SelectTerrainRegion'or q==a.SelectTerrainRegion then return
|
|
|
|
end if g=='SelectTerrainRegion'or g==a.SelectTerrainRegion then return
|
|
|
|
[[Function SelectTerrainRegion. Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). Description: Selects all terrain via a series of selection boxes within the regionToSelect (this should be a region3 value). The selection box color is detemined by the color argument (should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional).SelectEmptyCells is bool, when true will select all cells in the region, otherwise we only select non-empty cells. Returns a function that can update the selection,arguments to said function are a new region3 to select, and the adornment color (color arg is optional). Also returns a second function that takes no arguments and destroys the selection]]
|
|
|
|
[[Function SelectTerrainRegion. Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). Description: Selects all terrain via a series of selection boxes within the regionToSelect (this should be a region3 value). The selection box color is detemined by the color argument (should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional).SelectEmptyCells is bool, when true will select all cells in the region, otherwise we only select non-empty cells. Returns a function that can update the selection,arguments to said function are a new region3 to select, and the adornment color (color arg is optional). Also returns a second function that takes no arguments and destroys the selection]]
|
|
|
|
end if q=='CreateSignal'or q==a.CreateSignal then return
|
|
|
|
end if g=='CreateSignal'or g==a.CreateSignal then return
|
|
|
|
[[Function CreateSignal. Arguments: None. Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class used for events in Objects, but is a Lua-side object so it can be used to create custom events inLua code. Methods of the Signal object: :connect, :wait, :fire, :disconnect. For more info you can pass the method name to the Help function, or view the wiki page for this library. EG: Help('Signal:connect').]]
|
|
|
|
[[Function CreateSignal. Arguments: None. Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class used for events in Objects, but is a Lua-side object so it can be used to create custom events inLua code. Methods of the Signal object: :connect, :wait, :fire, :disconnect. For more info you can pass the method name to the Help function, or view the wiki page for this library. EG: Help('Signal:connect').]]
|
|
|
|
end if q=='Signal:connect'then return
|
|
|
|
end if g=='Signal:connect'then return
|
|
|
|
[[Method Signal:connect. Arguments: (function handler). Return: A connection object which can be used to disconnect the connection to this handler. Description: Connectes a handler function to this Signal, so that when |fire| is called the handler function will be called with the arguments passed to |fire|.]]
|
|
|
|
[[Method Signal:connect. Arguments: (function handler). Return: A connection object which can be used to disconnect the connection to this handler. Description: Connectes a handler function to this Signal, so that when |fire| is called the handler function will be called with the arguments passed to |fire|.]]
|
|
|
|
end if q=='Signal:wait'then return
|
|
|
|
end if g=='Signal:wait'then return
|
|
|
|
[[Method Signal:wait. Arguments: None. Returns: The arguments passed to the next call to |fire|. Description: This call does not return until the next call to |fire| is made, at which point it will return the values which were passed as arguments to that |fire| call.]]
|
|
|
|
[[Method Signal:wait. Arguments: None. Returns: The arguments passed to the next call to |fire|. Description: This call does not return until the next call to |fire| is made, at which point it will return the values which were passed as arguments to that |fire| call.]]
|
|
|
|
end if q=='Signal:fire'then return
|
|
|
|
end if g=='Signal:fire'then return
|
|
|
|
[[Method Signal:fire. Arguments: Any number of arguments of any type. Returns: None. Description: This call will invoke any connected handler functions, and notify any waiting code attached to this Signal to continue, with the arguments passed to this function. Note: The calls to handlers are made asynchronously, so this call will return immediately regardless of how long it takes the connected handler functions to complete.]]
|
|
|
|
[[Method Signal:fire. Arguments: Any number of arguments of any type. Returns: None. Description: This call will invoke any connected handler functions, and notify any waiting code attached to this Signal to continue, with the arguments passed to this function. Note: The calls to handlers are made asynchronously, so this call will return immediately regardless of how long it takes the connected handler functions to complete.]]
|
|
|
|
end if q=='Signal:disconnect'then return
|
|
|
|
end if g=='Signal:disconnect'then return
|
|
|
|
[[Method Signal:disconnect. Arguments: None. Returns: None. Description: This call disconnects all handlers attacched to this function, note however, it does NOT make waiting code continue, as is the behavior of normal Roblox events. This method can also be called on the connection object which is returned from Signal:connect to only disconnect a single handler, as opposed to this method, which will disconnect all handlers.]]
|
|
|
|
[[Method Signal:disconnect. Arguments: None. Returns: None. Description: This call disconnects all handlers attacched to this function, note however, it does NOT make waiting code continue, as is the behavior of normal Roblox events. This method can also be called on the connection object which is returned from Signal:connect to only disconnect a single handler, as opposed to this method, which will disconnect all handlers.]]
|
|
|
|
end if q=='Create'then return
|
|
|
|
end if g=='Create'then return
|
|
|
|
[[Function Create. Arguments: A table containing information about how to construct a collection of objects. Returns: The constructed objects. Descrition: Create is a very powerfull function, whose description is too long to fit here, and is best described via example, please see the wiki page for a description of how to use it.]]
|
|
|
|
[[Function Create. Arguments: A table containing information about how to construct a collection of objects. Returns: The constructed objects. Descrition: Create is a very powerfull function, whose description is too long to fit here, and is best described via example, please see the wiki page for a description of how to use it.]]
|
|
|
|
end end return a
|
|
|
|
end end return a
|