Formatting improvements and other fixes
This commit is contained in:
parent
0a2138897c
commit
177e3c6e31
|
|
@ -1,9 +1,6 @@
|
|||
-- Unused by Mercury
|
||||
print "[Mercury]: Loaded corescript 157877000"
|
||||
for _ = 1, 4 do
|
||||
pcall(function()
|
||||
warn "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS"
|
||||
end)
|
||||
for _ = 1, 8 do
|
||||
print "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS"
|
||||
end
|
||||
|
||||
|
|
@ -13,7 +10,7 @@ local Create: (instance: string) -> ({ [string]: any }) -> Instance =
|
|||
|
||||
-- A Few Script Globals
|
||||
local gui
|
||||
if script.Parent:FindFirstChild "ControlFrame" then
|
||||
if script.Parent and script.Parent:FindFirstChild "ControlFrame" then
|
||||
gui = script.Parent:FindFirstChild "ControlFrame"
|
||||
else
|
||||
gui = script.Parent
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
-- Unused by Mercury
|
||||
print "[Mercury]: Loaded corescript 38037565"
|
||||
for _ = 1, 4 do
|
||||
pcall(function()
|
||||
warn "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS"
|
||||
end)
|
||||
for _ = 1, 8 do
|
||||
print "IF YOU SEE THIS MESSAGE, PLEASE REPORT IT TO THE MERCURY DEVELOPERS"
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
-- CoreGui.RobloxGui.CurrentLoadout.CoreScripts/BackpackScript
|
||||
print "[Mercury]: Loaded corescript 53878057"
|
||||
|
||||
local CoreGui = game:GetService "CoreGui"
|
||||
local GuiService = game:GetService "GuiService"
|
||||
local UserInputService = Game:GetService "UserInputService"
|
||||
|
||||
-- A couple of necessary functions
|
||||
local function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
|
|
@ -18,9 +22,8 @@ local currentLoadout = script.Parent
|
|||
local StaticTabName = "gear"
|
||||
local backpackEnabled = true
|
||||
|
||||
local robloxGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui"
|
||||
local robloxGui = CoreGui:FindFirstChild "RobloxGui"
|
||||
assert(robloxGui)
|
||||
local GuiService = game:GetService "GuiService"
|
||||
|
||||
local controlFrame = waitForChild(robloxGui, "ControlFrame")
|
||||
local backpackButton = waitForChild(controlFrame, "BackpackButton")
|
||||
|
|
@ -35,7 +38,7 @@ local clBackground = currentLoadout.Background
|
|||
local function IsTouchDevice()
|
||||
local touchEnabled = false
|
||||
pcall(function()
|
||||
touchEnabled = Game:GetService("UserInputService").TouchEnabled
|
||||
touchEnabled = UserInputService.TouchEnabled
|
||||
end)
|
||||
return touchEnabled
|
||||
end
|
||||
|
|
@ -124,6 +127,8 @@ local function backpackIsOpen()
|
|||
return false
|
||||
end
|
||||
|
||||
local reorganizeLoadout
|
||||
|
||||
local function kill(prop, con, gear)
|
||||
if con then
|
||||
con:disconnect()
|
||||
|
|
@ -282,7 +287,7 @@ local function insertGear(gear, addToSlot)
|
|||
end)
|
||||
end
|
||||
|
||||
local function reorganizeLoadout(gear, inserting, _, addToSlot)
|
||||
reorganizeLoadout = function(gear, inserting, _, addToSlot)
|
||||
if inserting then -- add in gear
|
||||
insertGear(gear, addToSlot)
|
||||
else
|
||||
|
|
@ -294,33 +299,36 @@ local function reorganizeLoadout(gear, inserting, _, addToSlot)
|
|||
end
|
||||
|
||||
local function checkToolAncestry(child, parent)
|
||||
if child:FindFirstChild "RobloxBuildTool" then
|
||||
if
|
||||
child:FindFirstChild "RobloxBuildTool" -- don't show roblox build tools
|
||||
or not (child:IsA "Tool" or child:IsA "HopperBin")
|
||||
then
|
||||
return
|
||||
end -- don't show roblox build tools
|
||||
if child:IsA "Tool" or child:IsA "HopperBin" then
|
||||
for i = 1, #gearSlots do
|
||||
if
|
||||
gearSlots[i] ~= "empty"
|
||||
and gearSlots[i].GearReference.Value == child
|
||||
then
|
||||
if parent == nil then
|
||||
gearSlots[i].Kill.Value = true
|
||||
return false
|
||||
elseif child.Parent == player.Character then
|
||||
gearSlots[i].Selected = true
|
||||
return true
|
||||
elseif child.Parent == player.Backpack then
|
||||
if child:IsA "Tool" or child:IsA "HopperBin" then
|
||||
gearSlots[i].Selected = false
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #gearSlots do
|
||||
if
|
||||
gearSlots[i] ~= "empty"
|
||||
and gearSlots[i].GearReference.Value == child
|
||||
then
|
||||
if parent == nil then
|
||||
gearSlots[i].Kill.Value = true
|
||||
return false
|
||||
elseif child.Parent == player.Character then
|
||||
gearSlots[i].Selected = true
|
||||
return true
|
||||
elseif child.Parent == player.Backpack then
|
||||
if child:IsA "Tool" or child:IsA "HopperBin" then
|
||||
gearSlots[i].Selected = false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
gearSlots[i].Kill.Value = true
|
||||
return false
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local function removeAllEquippedGear(physGear)
|
||||
|
|
@ -384,21 +392,14 @@ local function normaliseButton(button, speed)
|
|||
end
|
||||
|
||||
local function enlargeButton(button)
|
||||
if button.Size.Y.Scale > 1 then
|
||||
return
|
||||
end
|
||||
if not button.Parent then
|
||||
return
|
||||
end
|
||||
if not button.Selected then
|
||||
if button.Size.Y.Scale > 1 or not button.Parent or not button.Selected then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then
|
||||
break
|
||||
end
|
||||
if gearSlots[i] ~= button then
|
||||
elseif gearSlots[i] ~= button then
|
||||
normaliseButton(gearSlots[i])
|
||||
end
|
||||
end
|
||||
|
|
@ -720,11 +721,9 @@ local function addingPlayerChild(
|
|||
debounce = false
|
||||
return
|
||||
end -- don't show roblox build tools
|
||||
if not child:IsA "Tool" then
|
||||
if not child:IsA "HopperBin" then
|
||||
debounce = false
|
||||
return -- we don't care about anything besides tools (sigh...)
|
||||
end
|
||||
if not (child:IsA "Tool" or child:IsA "HopperBin") then
|
||||
debounce = false
|
||||
return -- we don't care about anything besides tools (sigh...)
|
||||
end
|
||||
|
||||
if not addToSlot then
|
||||
|
|
@ -812,10 +811,8 @@ local function addingPlayerChild(
|
|||
|
||||
if gearClone.Parent == nil then
|
||||
debounce = false
|
||||
return
|
||||
end -- couldn't fit in (hopper is full!)
|
||||
|
||||
if equipped then
|
||||
return -- couldn't fit in (hopper is full!)
|
||||
elseif equipped then
|
||||
gearClone.Selected = true
|
||||
unequipAllItems(child)
|
||||
delay(
|
||||
|
|
@ -843,10 +840,8 @@ local function addingPlayerChild(
|
|||
|
||||
local clickCon, buttonDeleteCon, mouseEnterCon, mouseLeaveCon, dragStop, dragBegin
|
||||
clickCon = gearClone.MouseButton1Click:connect(function()
|
||||
if characterInWorkspace() then
|
||||
if not gearClone.Draggable then
|
||||
activateGear(gearClone.SlotNumber.Text)
|
||||
end
|
||||
if characterInWorkspace() and not gearClone.Draggable then
|
||||
activateGear(gearClone.SlotNumber.Text)
|
||||
end
|
||||
end)
|
||||
mouseEnterCon = gearClone.MouseEnter:connect(function()
|
||||
|
|
|
|||
|
|
@ -1,467 +1,18 @@
|
|||
-- RbxUtility
|
||||
print "[Mercury]: Loaded corescript 60595411"
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------JSON Functions Begin----------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--JSON Encoder and Parser for Lua 5.1
|
||||
--
|
||||
--2007 Shaun Brown (http://www.chipmunkav.com)
|
||||
--All Rights Reserved.
|
||||
|
||||
--Permission is hereby granted, free of charge, to any person
|
||||
--obtaining a copy of this software to deal in the Software without
|
||||
--restriction, including without limitation the rights to use,
|
||||
--copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
--sell copies of the Software, and to permit persons to whom the
|
||||
--Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
--The above copyright notice and this permission notice shall be
|
||||
--included in all copies or substantial portions of the Software.
|
||||
--If you find this software useful please give www.chipmunkav.com a mention.
|
||||
|
||||
--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
--EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
--OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
--IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
--ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
--CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
--CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
local assert = assert
|
||||
|
||||
local StringBuilder = {
|
||||
buffer = {},
|
||||
}
|
||||
|
||||
function StringBuilder:New()
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.buffer = {}
|
||||
return o
|
||||
end
|
||||
|
||||
function StringBuilder:Append(s)
|
||||
self.buffer[#self.buffer + 1] = s
|
||||
end
|
||||
|
||||
function StringBuilder:ToString()
|
||||
return table.concat(self.buffer)
|
||||
end
|
||||
|
||||
local JsonWriter = {
|
||||
backslashes = {
|
||||
["\b"] = "\\b",
|
||||
["\t"] = "\\t",
|
||||
["\n"] = "\\n",
|
||||
["\f"] = "\\f",
|
||||
["\r"] = "\\r",
|
||||
['"'] = '\\"',
|
||||
["\\"] = "\\\\",
|
||||
["/"] = "\\/",
|
||||
},
|
||||
}
|
||||
|
||||
function JsonWriter:New()
|
||||
local o = {}
|
||||
o.writer = StringBuilder:New()
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
function JsonWriter:Append(s)
|
||||
self.writer:Append(s)
|
||||
end
|
||||
|
||||
function JsonWriter:ToString()
|
||||
return self.writer:ToString()
|
||||
end
|
||||
|
||||
function JsonWriter:Write(o)
|
||||
local t = type(o)
|
||||
if t == "nil" then
|
||||
self:WriteNil()
|
||||
elseif t == "boolean" or t == "number" then
|
||||
self:WriteString(o)
|
||||
elseif t == "string" then
|
||||
self:ParseString(o)
|
||||
elseif t == "table" then
|
||||
self:WriteTable(o)
|
||||
elseif t == "function" then
|
||||
self:WriteFunction(o)
|
||||
elseif t == "thread" or t == "userdata" then
|
||||
self:WriteError(o)
|
||||
end
|
||||
end
|
||||
|
||||
function JsonWriter:WriteNil()
|
||||
self:Append "null"
|
||||
end
|
||||
|
||||
function JsonWriter:WriteString(o)
|
||||
self:Append(tostring(o))
|
||||
end
|
||||
|
||||
function JsonWriter:ParseString(s)
|
||||
self:Append '"'
|
||||
local copy = string.gsub(s, '[%z%c\\"/]', function(n)
|
||||
return self.backslashes[n] or string.format("\\u%.4X", string.byte(n))
|
||||
end)
|
||||
self:Append(copy)
|
||||
self:Append '"'
|
||||
end
|
||||
|
||||
function JsonWriter:IsArray(t)
|
||||
local count = 0
|
||||
local function isindex(k)
|
||||
return type(k) == "number" and k > 0 and math.floor(k) == k
|
||||
end
|
||||
for k, _ in pairs(t) do
|
||||
if not isindex(k) then
|
||||
return false, "{", "}"
|
||||
end
|
||||
count = math.max(count, k)
|
||||
end
|
||||
return true, "[", "]", count
|
||||
end
|
||||
|
||||
function JsonWriter:WriteTable(t)
|
||||
local ba, st, et, n = self:IsArray(t)
|
||||
self:Append(st)
|
||||
if ba then
|
||||
for i = 1, n do
|
||||
self:Write(t[i])
|
||||
if i < n then
|
||||
self:Append ","
|
||||
end
|
||||
end
|
||||
else
|
||||
local first = true
|
||||
for k, v in pairs(t) do
|
||||
if not first then
|
||||
self:Append ","
|
||||
end
|
||||
first = false
|
||||
self:ParseString(k)
|
||||
self:Append ":"
|
||||
self:Write(v)
|
||||
end
|
||||
end
|
||||
self:Append(et)
|
||||
end
|
||||
|
||||
function JsonWriter:WriteError(o)
|
||||
error(string.format("Encoding of %s unsupported", tostring(o)))
|
||||
end
|
||||
|
||||
function JsonWriter:WriteFunction(o)
|
||||
if o == Null then
|
||||
self:WriteNil()
|
||||
else
|
||||
self:WriteError(o)
|
||||
end
|
||||
end
|
||||
|
||||
local StringReader = {
|
||||
s = "",
|
||||
i = 0,
|
||||
}
|
||||
|
||||
function StringReader:New(s)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.s = s or o.s
|
||||
return o
|
||||
end
|
||||
|
||||
function StringReader:Peek()
|
||||
local i = self.i + 1
|
||||
if i <= #self.s then
|
||||
return string.sub(self.s, i, i)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function StringReader:Next()
|
||||
self.i += 1
|
||||
if self.i <= #self.s then
|
||||
return string.sub(self.s, self.i, self.i)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function StringReader:All()
|
||||
return self.s
|
||||
end
|
||||
|
||||
local JsonReader = {
|
||||
escapes = {
|
||||
t = "\t",
|
||||
n = "\n",
|
||||
f = "\f",
|
||||
r = "\r",
|
||||
b = "\b",
|
||||
},
|
||||
}
|
||||
|
||||
function JsonReader:New(s)
|
||||
local o = {}
|
||||
o.reader = StringReader:New(s)
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
function JsonReader:Read()
|
||||
self:SkipWhiteSpace()
|
||||
local peek = self:Peek()
|
||||
if peek == nil then
|
||||
error(string.format("Nil string: '%s'", self:All()))
|
||||
elseif peek == "{" then
|
||||
return self:ReadObject()
|
||||
elseif peek == "[" then
|
||||
return self:ReadArray()
|
||||
elseif peek == '"' then
|
||||
return self:ReadString()
|
||||
elseif string.find(peek, "[%+%-%d]") then
|
||||
return self:ReadNumber()
|
||||
elseif peek == "t" then
|
||||
return self:ReadTrue()
|
||||
elseif peek == "f" then
|
||||
return self:ReadFalse()
|
||||
elseif peek == "n" then
|
||||
return self:ReadNull()
|
||||
elseif peek == "/" then
|
||||
self:ReadComment()
|
||||
return self:Read()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function JsonReader:ReadTrue()
|
||||
self:TestReservedWord { "t", "r", "u", "e" }
|
||||
return true
|
||||
end
|
||||
|
||||
function JsonReader:ReadFalse()
|
||||
self:TestReservedWord { "f", "a", "l", "s", "e" }
|
||||
return false
|
||||
end
|
||||
|
||||
function JsonReader:ReadNull()
|
||||
self:TestReservedWord { "n", "u", "l", "l" }
|
||||
return nil
|
||||
end
|
||||
|
||||
function JsonReader:TestReservedWord(t)
|
||||
for _, v in ipairs(t) do
|
||||
if self:Next() ~= v then
|
||||
error(
|
||||
string.format(
|
||||
"Error reading '%s': %s",
|
||||
table.concat(t),
|
||||
self:All()
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function JsonReader:ReadNumber()
|
||||
local result = self:Next()
|
||||
local peek = self:Peek()
|
||||
while peek ~= nil and string.find(peek, "[%+%-%d%.eE]") do
|
||||
result ..= self:Next()
|
||||
peek = self:Peek()
|
||||
end
|
||||
result = tonumber(result)
|
||||
if result == nil then
|
||||
error(`"Invalid number: '{result}'`)
|
||||
else
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
function JsonReader:ReadString()
|
||||
local result = ""
|
||||
assert(self:Next() == '"')
|
||||
while self:Peek() ~= '"' do
|
||||
local ch = self:Next()
|
||||
if ch == "\\" then
|
||||
ch = self:Next()
|
||||
if self.escapes[ch] then
|
||||
ch = self.escapes[ch]
|
||||
end
|
||||
end
|
||||
result ..= ch
|
||||
end
|
||||
assert(self:Next() == '"')
|
||||
local fromunicode = function(m)
|
||||
return string.char(tonumber(m, 16))
|
||||
end
|
||||
return string.gsub(result, "u%x%x(%x%x)", fromunicode)
|
||||
end
|
||||
|
||||
function JsonReader:ReadComment()
|
||||
assert(self:Next() == "/")
|
||||
local second = self:Next()
|
||||
if second == "/" then
|
||||
self:ReadSingleLineComment()
|
||||
elseif second == "*" then
|
||||
self:ReadBlockComment()
|
||||
else
|
||||
error(`Invalid comment: {self:All()}`)
|
||||
end
|
||||
end
|
||||
|
||||
function JsonReader:ReadBlockComment()
|
||||
local done = false
|
||||
while not done do
|
||||
local ch = self:Next()
|
||||
if ch == "*" and self:Peek() == "/" then
|
||||
done = true
|
||||
end
|
||||
if not done and ch == "/" and self:Peek() == "*" then
|
||||
error(`Invalid comment: {self:All()}, '/*' illegal.`)
|
||||
end
|
||||
end
|
||||
self:Next()
|
||||
end
|
||||
|
||||
function JsonReader:ReadSingleLineComment()
|
||||
local ch = self:Next()
|
||||
while ch ~= "\r" and ch ~= "\n" do
|
||||
ch = self:Next()
|
||||
end
|
||||
end
|
||||
|
||||
function JsonReader:ReadArray()
|
||||
local result = {}
|
||||
assert(self:Next() == "[")
|
||||
local done = false
|
||||
if self:Peek() == "]" then
|
||||
done = true
|
||||
end
|
||||
while not done do
|
||||
local item = self:Read()
|
||||
result[#result + 1] = item
|
||||
self:SkipWhiteSpace()
|
||||
if self:Peek() == "]" then
|
||||
done = true
|
||||
end
|
||||
if not done then
|
||||
local ch = self:Next()
|
||||
if ch ~= "," then
|
||||
error(`Invalid array: '{self:All()}' due to: '{ch}'`)
|
||||
end
|
||||
end
|
||||
end
|
||||
assert("]" == self:Next())
|
||||
return result
|
||||
end
|
||||
|
||||
function JsonReader:ReadObject()
|
||||
local result = {}
|
||||
assert(self:Next() == "{")
|
||||
local done = false
|
||||
if self:Peek() == "}" then
|
||||
done = true
|
||||
end
|
||||
while not done do
|
||||
local key = self:Read()
|
||||
if type(key) ~= "string" then
|
||||
error(`Invalid non-string object key: {key}`)
|
||||
end
|
||||
self:SkipWhiteSpace()
|
||||
local ch = self:Next()
|
||||
if ch ~= ":" then
|
||||
error(`Invalid object: '{self:All()}' due to: '{ch}'`)
|
||||
end
|
||||
self:SkipWhiteSpace()
|
||||
local val = self:Read()
|
||||
result[key] = val
|
||||
self:SkipWhiteSpace()
|
||||
if self:Peek() == "}" then
|
||||
done = true
|
||||
end
|
||||
if not done then
|
||||
ch = self:Next()
|
||||
if ch ~= "," then
|
||||
error(`Invalid array: '{self:All()}' near: '{ch}'`)
|
||||
end
|
||||
end
|
||||
end
|
||||
assert(self:Next() == "}")
|
||||
return result
|
||||
end
|
||||
|
||||
function JsonReader:SkipWhiteSpace()
|
||||
local p = self:Peek()
|
||||
while p ~= nil and string.find(p, "[%s/]") do
|
||||
if p == "/" then
|
||||
self:ReadComment()
|
||||
else
|
||||
self:Next()
|
||||
end
|
||||
p = self:Peek()
|
||||
end
|
||||
end
|
||||
|
||||
function JsonReader:Peek()
|
||||
return self.reader:Peek()
|
||||
end
|
||||
|
||||
function JsonReader:Next()
|
||||
return self.reader:Next()
|
||||
end
|
||||
|
||||
function JsonReader:All()
|
||||
return self.reader:All()
|
||||
end
|
||||
|
||||
function Encode(o)
|
||||
local writer = JsonWriter:New()
|
||||
writer:Write(o)
|
||||
return writer:ToString()
|
||||
end
|
||||
|
||||
function Decode(s)
|
||||
local reader = JsonReader:New(s)
|
||||
return reader:Read()
|
||||
end
|
||||
|
||||
function Null()
|
||||
return Null
|
||||
end
|
||||
-------------------- End JSON Parser ------------------------
|
||||
local Terrain = game:GetService "Terrain"
|
||||
|
||||
local RbxUtility = {}
|
||||
|
||||
RbxUtility.DecodeJSON = function(jsonString: string)
|
||||
pcall(function()
|
||||
warn "RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead."
|
||||
end)
|
||||
-- Fuq json
|
||||
|
||||
if type(jsonString) == "string" then
|
||||
return Decode(jsonString)
|
||||
end
|
||||
print "RbxUtil.DecodeJSON expects string argument!"
|
||||
return nil
|
||||
RbxUtility.DecodeJSON = function()
|
||||
error 'RbxUtility.DecodeJSON has been removed, please use Game:GetService("HttpService"):JSONDecode() instead.'
|
||||
end
|
||||
|
||||
RbxUtility.EncodeJSON = function(jsonTable: { [any]: any })
|
||||
pcall(function()
|
||||
warn "RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead."
|
||||
end)
|
||||
return Encode(jsonTable)
|
||||
RbxUtility.EncodeJSON = function()
|
||||
error 'RbxUtility.EncodeJSON has been removed, please use Game:GetService("HttpService"):JSONEncode() instead.'
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -475,7 +26,7 @@ end
|
|||
--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 w
|
||||
--returns true if made a wedge, false if the cell remains a block
|
||||
RbxUtility.MakeWedge = function(x, y, z, _)
|
||||
return game:GetService("Terrain"):AutoWedgeCell(x, y, z)
|
||||
return Terrain:AutoWedgeCell(x, y, z)
|
||||
end
|
||||
|
||||
RbxUtility.SelectTerrainRegion = function(
|
||||
|
|
|
|||
|
|
@ -486,14 +486,14 @@ local function findConfigAtMouseTarget(Mouse: Mouse, stampData: Instance)
|
|||
|
||||
-- This can happen sometimes, return if so
|
||||
if not Mouse then
|
||||
return nil
|
||||
return
|
||||
end
|
||||
if not stampData then
|
||||
error "findConfigAtMouseTarget: stampData is nil"
|
||||
return nil
|
||||
return
|
||||
end
|
||||
if not stampData.CurrentParts then
|
||||
return nil
|
||||
return
|
||||
end
|
||||
|
||||
local grid = 4.0
|
||||
|
|
@ -587,15 +587,27 @@ local function findConfigAtMouseTarget(Mouse: Mouse, stampData: Instance)
|
|||
targetVectorInWorld = targetPart.CFrame:vectorToWorldSpace(
|
||||
Vector3.FromNormalId(Mouse.TargetSurface)
|
||||
) -- better, but model cframe would be best
|
||||
--[[if targetPart.Parent:IsA("Model") then
|
||||
local hitFace = modelTargetSurface(targetPart.Parent, Mouse.Hit.p, game.Workspace.CurrentCamera.CoordinateFrame.p) -- best, if you get it right
|
||||
local WORLD_AXES = {Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1)}
|
||||
if hitFace > 0 then
|
||||
targetVectorInWorld = targetCFrame:vectorToWorldSpace(WORLD_AXES[hitFace])
|
||||
elseif hitFace < 0 then
|
||||
targetVectorInWorld = targetCFrame:vectorToWorldSpace(-WORLD_AXES[-hitFace])
|
||||
--[[
|
||||
if targetPart.Parent:IsA "Model" then
|
||||
local hitFace = modelTargetSurface(
|
||||
targetPart.Parent,
|
||||
Mouse.Hit.p,
|
||||
game.Workspace.CurrentCamera.CoordinateFrame.p
|
||||
) -- best, if you get it right
|
||||
local WORLD_AXES = {
|
||||
Vector3.new(1, 0, 0),
|
||||
Vector3.new(0, 1, 0),
|
||||
Vector3.new(0, 0, 1),
|
||||
}
|
||||
if hitFace > 0 then
|
||||
targetVectorInWorld =
|
||||
targetCFrame:vectorToWorldSpace(WORLD_AXES[hitFace])
|
||||
elseif hitFace < 0 then
|
||||
targetVectorInWorld =
|
||||
targetCFrame:vectorToWorldSpace(-WORLD_AXES[-hitFace])
|
||||
end
|
||||
end
|
||||
end]]
|
||||
]]
|
||||
end
|
||||
|
||||
local targetRefPointInTarget, insertRefPointInInsert
|
||||
|
|
@ -703,10 +715,9 @@ local function truncateToCircleEighth(bigValue, littleValue)
|
|||
-- between 22.5 and 45 degrees, so truncate to 45-degree tilt
|
||||
return 0.707106781 * hypotenuse * bigSign,
|
||||
0.707106781 * hypotenuse * littleSign
|
||||
else
|
||||
-- between 0 and 22.5 degrees, so truncate to 0-degree tilt
|
||||
return hypotenuse * bigSign, 0
|
||||
end
|
||||
-- between 0 and 22.5 degrees, so truncate to 0-degree tilt
|
||||
return hypotenuse * bigSign, 0
|
||||
end
|
||||
|
||||
local function saveTheWelds(object, manualWeldTable, manualWeldParentTable)
|
||||
|
|
@ -740,9 +751,7 @@ RbxStamper.CanEditRegion = function(partOrModel, EditRegion) -- todo: use model
|
|||
or minBB.Z < EditRegion.CFrame.p.Z - EditRegion.Size.Z / 2
|
||||
then
|
||||
return false, false
|
||||
end
|
||||
|
||||
if
|
||||
elseif
|
||||
maxBB.X > EditRegion.CFrame.p.X + EditRegion.Size.X / 2
|
||||
or maxBB.Y > EditRegion.CFrame.p.Y + EditRegion.Size.Y / 2
|
||||
or maxBB.Z > EditRegion.CFrame.p.Z + EditRegion.Size.Z / 2
|
||||
|
|
@ -1017,6 +1026,13 @@ RbxStamper.SetupStamperDragger = function(
|
|||
local gInitial90DegreeRotations = 0
|
||||
local stampData: {
|
||||
DisabledScripts: { LuaSourceContainer }?,
|
||||
TransparencyTable: {}?,
|
||||
MaterialTable: {}?,
|
||||
CanCollideTable: {}?,
|
||||
AnchoredTable: {}?,
|
||||
ArchivableTable: {}?,
|
||||
DecalTransparencyTable: {}?,
|
||||
SurfaceTypeTable: {}?,
|
||||
}
|
||||
local mouseTarget
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ local guiTweenSpeed = 0.25 -- how quickly we open/close the backpack
|
|||
|
||||
local searchDefaultText = "Search..."
|
||||
local tilde = "~"
|
||||
local backquote = "`"
|
||||
local backtick = "`"
|
||||
|
||||
local backpackSize = UDim2.new(0, 600, 0, 400)
|
||||
|
||||
|
|
@ -391,11 +391,11 @@ function coreGuiChanged(coreGuiType, enabled)
|
|||
if disabledByDeveloper then
|
||||
pcall(function()
|
||||
GuiService:RemoveKey(tilde)
|
||||
GuiService:RemoveKey(backquote)
|
||||
GuiService:RemoveKey(backtick)
|
||||
end)
|
||||
else
|
||||
GuiService:AddKey(tilde)
|
||||
GuiService:AddKey(backquote)
|
||||
GuiService:AddKey(backtick)
|
||||
end
|
||||
|
||||
resetSearch()
|
||||
|
|
@ -444,12 +444,12 @@ end)
|
|||
|
||||
-- GuiService key setup
|
||||
GuiService:AddKey(tilde)
|
||||
GuiService:AddKey(backquote)
|
||||
GuiService:AddKey(backtick)
|
||||
GuiService.KeyPressed:connect(function(key)
|
||||
if not active or disabledByDeveloper then
|
||||
return
|
||||
end
|
||||
if key == tilde or key == backquote then
|
||||
if key == tilde or key == backtick then
|
||||
toggleBackpack()
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
Loading…
Reference in New Issue