Advertisement
1m1m0

Project Einstein: BHv5 Branch

Apr 4th, 2025 (edited)
281
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.53 KB | None | 0 0
  1. local MathParser = require(script.StringToMath) -- API to calculate operations from expressions
  2. local IdRetriever = require(script.IdRetriever) -- API to generate a unique ID for each blackhole (60,466,176 possible IDs)
  3. local blackHole = script.Parent -- Reference to the black hole
  4.  
  5. --------------------------------------------------------------------------------------------------------------------
  6. -- This version is for purely technical & nerdy purposes. If you know how to code, you can screw around here, lol --
  7. --------------------------------------------------------------------------------------------------------------------
  8.  
  9. -- Assume these are StringValue objects containing expressions
  10. local GString = blackHole:FindFirstChild("G_(gravity)", true) -- e.g. "6.67e-11"
  11. local cString = blackHole:FindFirstChild("c_(light_speed)", true) -- e.g. "3e8"
  12. local customMassString = blackHole:FindFirstChild("CustomMass", true) -- optional string expression
  13.  
  14. local customMassEnabled = blackHole:FindFirstChild("UseCustomMass", true)
  15. local useEinsteinian = blackHole:FindFirstChild("UseEinsteinian", true)
  16.  
  17. -- New: OverridePhysics Boolean and Magnitude StringValue
  18. local overridePhysics = blackHole:FindFirstChild("OverridePhysics", true)
  19. local magnitudeString = blackHole:FindFirstChild("Magnitude", true)
  20.  
  21. -- Generate a unique identifier for this black hole
  22. local BHId = IdRetriever.FetchID(5) -- Number represents the length of the ID. longer means more unique IDs (MUST BE INTEGERS)
  23.  
  24. -- Ensure blackHole has an attachment for the line force target
  25. local blackHoleAttachment = blackHole:FindFirstChild("LineForceAttachment")
  26. if not blackHoleAttachment then
  27.     blackHoleAttachment = Instance.new("Attachment")
  28.     blackHoleAttachment.Name = "LineForceAttachment"
  29.     blackHoleAttachment.Parent = blackHole
  30. end
  31.  
  32. -- Helper function: parse a StringValue's expression and update its value
  33. -- If an error occurs during evaluation, rename the constant by appending "[ERROR]"
  34. -- If a valid value is returned, remove the "[ERROR]" substring if present
  35. local function parseAndSetValue(strValue)
  36.     local expr = strValue.Value
  37.     -- Try a direct conversion first
  38.     local numberVal = tonumber(expr)
  39.     if numberVal then
  40.         -- Update the string to the numeral equivalent
  41.         strValue.Value = tostring(numberVal)
  42.         -- Remove error indicator from the name if present
  43.         strValue.Name = string.gsub(strValue.Name, "%s*%[ERROR%]", "")
  44.         return numberVal
  45.     else
  46.         local success, result = pcall(function()
  47.             return MathParser.evaluateExpression(expr)
  48.         end)
  49.         if success and type(result) == "number" then
  50.             -- Replace the string with the computed number (as a string)
  51.             strValue.Value = tostring(result)
  52.             -- Remove error indicator from the name if present.
  53.             strValue.Name = string.gsub(strValue.Name, "%s*%[ERROR%]", "")
  54.             return result
  55.         else
  56.             -- Append "[ERROR]" to the current name if not already appended and set value to "ERROR - Unrecognized"
  57.             if not string.find(strValue.Name, "%[ERROR%]") then
  58.                 strValue.Name = strValue.Name .. " [ERROR]"
  59.                 strValue.Value = "ERROR - Syntax"
  60.                 warn("{" .. BHId .. "} Unrecognized operation. Only accepts: ( ) ^ E * / + - [Example: (2E1)^4/2+2]. Mathematical rules apply!")
  61.                 print("{" .. BHId .. "} Accepts pi, tau, phi, e (Euler's Number), sin(), cos(), tan(), asin(), acos(), atan(), csc(), sec(), cot(), ceil(), floor() or //, round()")
  62.             end
  63.             return 0
  64.         end
  65.     end
  66. end
  67.  
  68. -- Helper function to update the black hole's name and its attachment name
  69. local function updateBlackHoleName()
  70.     local method = useEinsteinian.Value and "Einstein" or "Newton"
  71.     local massType = customMassEnabled.Value and "Custom" or "Current"
  72.     blackHole.Name = "{BHv5} " .. method .. " | " .. massType .. " {" .. BHId .. "}"
  73.     -- Update blackHoleAttachment's name based on the gravity mode
  74.     if useEinsteinian.Value then
  75.         blackHoleAttachment.Name = "EinsteinianGravityAttachment"
  76.     else
  77.         blackHoleAttachment.Name = "NewtonianGravityAttachment"
  78.     end
  79. end
  80.  
  81. -- Call it once initially
  82. updateBlackHoleName()
  83.  
  84. -- When the gravity mode changes, update the name and remove forces that don't match this black hole
  85. useEinsteinian.Changed:Connect(function(newValue)
  86.     updateBlackHoleName()
  87.     if newValue then
  88.         -- Remove any Newtonian forces from objects that were created by this black hole
  89.         for _, object in pairs(workspace:GetDescendants()) do
  90.             if object:IsA("BasePart") then
  91.                 local force = object:FindFirstChild("NewtonianGravity_" .. BHId)
  92.                 if force then
  93.                     if force.Attachment0 then
  94.                         force.Attachment0:Destroy()
  95.                     end
  96.                     force:Destroy()
  97.                 end
  98.             end
  99.         end
  100.     else
  101.         -- Remove any Einsteinian forces from objects that were created by this black hole
  102.         for _, object in pairs(workspace:GetDescendants()) do
  103.             if object:IsA("BasePart") then
  104.                 local force = object:FindFirstChild("RelativisticGravity_" .. BHId)
  105.                 if force then
  106.                     if force.Attachment0 then
  107.                         force.Attachment0:Destroy()
  108.                     end
  109.                     force:Destroy()
  110.                 end
  111.             end
  112.         end
  113.     end
  114. end)
  115.  
  116. -- Also update the name if the CustomMassEnabled changes
  117. customMassEnabled.Changed:Connect(function()
  118.     updateBlackHoleName()
  119. end)
  120.  
  121. -- Function to get the current mass for the black hole
  122. local function getCurrentMass()
  123.     if customMassEnabled.Value == true and customMassString then
  124.         return parseAndSetValue(customMassString)
  125.     else
  126.         return blackHole:GetMass()
  127.     end
  128. end
  129.  
  130. -- Initially parse G and c
  131. local G_val = parseAndSetValue(GString)
  132. local c_val = parseAndSetValue(cString)
  133.  
  134. -- Initial calculation of event horizon (Schwarzschild radius) in meters
  135. local eventHorizon = 2 * G_val * getCurrentMass() / (c_val^2)
  136.  
  137. -- Convert Roblox scale to real-world scale (1 meter = 4 studs)
  138. local function studsToMeters(studs)
  139.     return studs / 4
  140. end
  141.  
  142. local function metersToStuds(meters)
  143.     return meters * 4
  144. end
  145.  
  146. -------------------------------------------------------------------
  147. -- Anchor/Unanchor Affected Objects on Parser Errors --
  148. -------------------------------------------------------------------
  149. local function checkAndToggleAnchors()
  150.     -- Check if any of the crucial StringValues report an error:
  151.     local hasError = false
  152.     if string.find(GString.Name, "%[ERROR%]") or string.find(cString.Name, "%[ERROR%]") then
  153.         hasError = true
  154.     end
  155.     if customMassEnabled.Value and customMassString then
  156.         if string.find(customMassString.Name, "%[ERROR%]") then
  157.             hasError = true
  158.         end
  159.     end
  160.     if overridePhysics and overridePhysics.Value and magnitudeString then
  161.         if string.find(magnitudeString.Name, "%[ERROR%]") then
  162.             hasError = true
  163.         end
  164.     end
  165.  
  166.     -- Iterate over all BaseParts with line forces created by this black hole
  167.     for _, object in pairs(workspace:GetDescendants()) do
  168.         if object:IsA("BasePart") then
  169.             -- Check for either Newtonian or Relativistic force from this black hole
  170.             local newtonForce = object:FindFirstChild("NewtonianGravity_" .. BHId)
  171.             local einsteinForce = object:FindFirstChild("RelativisticGravity_" .. BHId)
  172.             if newtonForce or einsteinForce then
  173.                 -- If error exists, anchor the object if not already anchored
  174.                 if hasError and not object.Anchored then
  175.                     -- Mark that we anchored it due to BH error
  176.                     object:SetAttribute("WasUnanchoredByBH", true)
  177.                     object.Anchored = true
  178.                 elseif not hasError and object:GetAttribute("WasUnanchoredByBH") then
  179.                     -- Remove our attribute and unanchor the object
  180.                     object:SetAttribute("WasUnanchoredByBH", nil)
  181.                     object.Anchored = false
  182.                 end
  183.             end
  184.         end
  185.     end
  186. end
  187.  
  188. --------------------------------------------
  189. -- Update Event Horizon and Check Anchors --
  190. --------------------------------------------
  191.  
  192. -- Function to update the event horizon when any number value changes
  193. local function updateEventHorizon()
  194.     G_val = parseAndSetValue(GString)
  195.     c_val = parseAndSetValue(cString)
  196.     local M_val = getCurrentMass()
  197.     eventHorizon = 2 * G_val * M_val / (c_val^2)
  198.     -- After updating, check and toggle anchors based on parser errors
  199.     checkAndToggleAnchors()
  200. end
  201.  
  202. -- Attach event listeners to update when the string expressions change
  203. GString.Changed:Connect(updateEventHorizon)
  204. cString.Changed:Connect(updateEventHorizon)
  205. if customMassString then
  206.     customMassString.Changed:Connect(updateEventHorizon)
  207. end
  208.  
  209. -- Also, if custom mass enabled changes, update both the name and the event horizon check:
  210. customMassEnabled.Changed:Connect(function()
  211.     updateBlackHoleName()
  212.     updateEventHorizon()
  213. end)
  214.  
  215. ----------------------------------------------------------
  216. -- Gravitational Force Functions (with OverridePhysics) --
  217. ----------------------------------------------------------
  218.  
  219. local MIN_FORCE_THRESHOLD = 0.001
  220.  
  221. -- Relativistic Gravity Function using the Schwarzschild approximation
  222. local function relativisticGravity(object)
  223.     if not object:IsA("BasePart") or object == blackHole or object.Anchored then
  224.         return -- Skip non-BaseParts, anchored objects, and the black hole itself
  225.     end
  226.  
  227.     local r = (blackHole.Position - object.Position).Magnitude
  228.     local r_meters = studsToMeters(r)
  229.     if r_meters <= (blackHole.Size.X / 16) then
  230.         -- Object has crossed the event horizon; in this example, we simply return
  231.         return
  232.     end
  233.  
  234.     local computedMagnitude = nil
  235.     -- Check if OverridePhysics is enabled
  236.     if overridePhysics and overridePhysics.Value and magnitudeString then
  237.         -- Use the override magnitude (parsed from magnitudeString) scaled via inverse-square law
  238.         local overrideForce = parseAndSetValue(magnitudeString)
  239.         computedMagnitude = overrideForce / (r_meters^2)
  240.     else
  241.         -- Normal Einsteinian gravity calculation
  242.         local g = (G_val * getCurrentMass()) / (r_meters^2) * (1 - (eventHorizon / r_meters))
  243.         local g_studs = metersToStuds(g)
  244.         computedMagnitude = g_studs * object:GetMass()
  245.     end
  246.  
  247.     -- Unique force name for this black hole instance in Einstein mode
  248.     local forceName = "RelativisticGravity_" .. BHId
  249.     local existingForce = object:FindFirstChild(forceName)
  250.     if math.abs(computedMagnitude) < MIN_FORCE_THRESHOLD then
  251.         if existingForce then
  252.             if existingForce.Attachment0 then
  253.                 existingForce.Attachment0:Destroy()
  254.             end
  255.             existingForce:Destroy()
  256.         end
  257.         return
  258.     end
  259.  
  260.     local force = existingForce
  261.     if not force then
  262.         force = Instance.new("LineForce")
  263.         force.Name = forceName
  264.         local objectAttachment = Instance.new("Attachment")
  265.         objectAttachment.Name = "EinsteinianGravityAttachment"
  266.         objectAttachment.Parent = object
  267.         force.Attachment0 = objectAttachment
  268.         force.Attachment1 = blackHoleAttachment
  269.         force.ApplyAtCenterOfMass = true
  270.         force.Visible = true
  271.         force.Parent = object
  272.     end
  273.  
  274.     force.Magnitude = computedMagnitude
  275. end
  276.  
  277. -- Newtonian Gravity Function using F = G * m1 * m2 / r^2
  278. local function newtonianGravity(object)
  279.     if not object:IsA("BasePart") or object == blackHole or object.Anchored then
  280.         return -- Skip non-BaseParts, anchored objects, and the black hole
  281.     end
  282.  
  283.     local r = (blackHole.Position - object.Position).Magnitude / 4
  284.     local r_meters = studsToMeters(r)
  285.     if r_meters <= 0 then return end
  286.  
  287.     local computedMagnitude = nil
  288.     -- Check if OverridePhysics is enabled
  289.     if overridePhysics and overridePhysics.Value and magnitudeString then
  290.         local overrideForce = parseAndSetValue(magnitudeString)
  291.         computedMagnitude = overrideForce / (r_meters^2)
  292.     else
  293.         local F = (G_val * getCurrentMass() * object:GetMass()) / (r_meters^2)
  294.         local F_studs = metersToStuds(F)
  295.         computedMagnitude = F_studs
  296.     end
  297.  
  298.     local forceName = "NewtonianGravity_" .. BHId
  299.     local existingForce = object:FindFirstChild(forceName)
  300.     if math.abs(computedMagnitude) < MIN_FORCE_THRESHOLD then
  301.         if existingForce then
  302.             if existingForce.Attachment0 then
  303.                 existingForce.Attachment0:Destroy()
  304.             end
  305.             existingForce:Destroy()
  306.         end
  307.         return
  308.     end
  309.  
  310.     local force = existingForce
  311.     if not force then
  312.         force = Instance.new("LineForce")
  313.         force.Name = forceName
  314.         local objectAttachment = Instance.new("Attachment")
  315.         objectAttachment.Name = "NewtonianGravityAttachment"
  316.         objectAttachment.Parent = object
  317.         force.Attachment0 = objectAttachment
  318.         force.Attachment1 = blackHoleAttachment
  319.         force.ApplyAtCenterOfMass = true
  320.         force.Visible = true
  321.         force.Parent = object
  322.     end
  323.  
  324.     force.Magnitude = computedMagnitude
  325. end
  326.  
  327. ------------------------------------------------------
  328. -- Apply gravitational effects on each heartbeat
  329. ------------------------------------------------------
  330. game:GetService("RunService").Heartbeat:Connect(function()
  331.     for _, object in pairs(workspace:GetDescendants()) do
  332.         if useEinsteinian.Value then
  333.             relativisticGravity(object) -- Einsteinian (Schwarzschild) approximation
  334.         else
  335.             newtonianGravity(object) -- Newtonian gravitational calculation
  336.         end
  337.     end
  338.     -- After applying forces, check and toggle anchors if needed
  339.     checkAndToggleAnchors()
  340. end)
  341.  
  342. ---------------------------------
  343. -- VFX Monitoring (Dont touch) --
  344. ---------------------------------
  345. local function updateBlackHoleColor()
  346.     local vfx = blackHole:FindFirstChild("VFX")
  347.     if not vfx then
  348.         blackHole.Color = Color3.fromRGB(0, 0, 0)
  349.         return
  350.     end
  351.  
  352.     local highlight = vfx:FindFirstChild("Highlight")
  353.     if not highlight or (highlight:IsA("Highlight") and not highlight.Enabled) then
  354.         blackHole.Color = Color3.fromRGB(0, 0, 0)
  355.     else
  356.         blackHole.Color = Color3.fromRGB(226, 155, 64)
  357.     end
  358. end
  359.  
  360. blackHole.ChildRemoved:Connect(function(child)
  361.     if child.Name == "VFX" then
  362.         updateBlackHoleColor()
  363.     end
  364. end)
  365.  
  366. blackHole.ChildAdded:Connect(function(child)
  367.     if child.Name == "VFX" then
  368.         local highlight = child:FindFirstChild("Highlight")
  369.         if highlight and highlight:IsA("Highlight") then
  370.             highlight.Changed:Connect(function(prop)
  371.                 if prop == "Enabled" then
  372.                     updateBlackHoleColor()
  373.                 end
  374.             end)
  375.         end
  376.         updateBlackHoleColor()
  377.     end
  378. end)
  379.  
  380. local vfx = blackHole:FindFirstChild("VFX")
  381. if vfx then
  382.     local highlight = vfx:FindFirstChild("Highlight")
  383.     if highlight and highlight:IsA("Highlight") then
  384.         highlight.Changed:Connect(function(prop)
  385.             if prop == "Enabled" then
  386.                 updateBlackHoleColor()
  387.             end
  388.         end)
  389.     end
  390. end
  391.  
  392. updateBlackHoleColor()
  393.  
  394. -----------------------------
  395. -- ID Locking (Dont touch) --
  396. -----------------------------
  397. local CollectionService = game:GetService("CollectionService")
  398. local function enforceIDName(idObj)
  399.     local identity = "ID: " .. BHId
  400.     if idObj.Name ~= identity then
  401.         idObj.Name = identity
  402.     end
  403.     -- Listen for changes to the Name property and reset if changed
  404.     idObj:GetPropertyChangedSignal("Name"):Connect(function()
  405.         if idObj.Name ~= identity then
  406.             idObj.Name = identity
  407.         end
  408.     end)
  409. end
  410.  
  411. for _, idObj in ipairs(CollectionService:GetTagged("ID")) do
  412.     if idObj.Parent == blackHole then
  413.         enforceIDName(idObj)
  414.     end
  415. end
Advertisement
Comments
  • 1m1m0
    6 days
    # Lua 4.47 KB | 0 0
    1. -- MathParserModule.lua
    2.  
    3. local MathParser = {}
    4.  
    5. -- Step 1: Tokenizer
    6. local function tokenize(expr)
    7.     local tokens = {}
    8.     local i = 1
    9.     while i <= #expr do
    10.         local c = expr:sub(i, i)
    11.         if c:match("%s") then
    12.             i = i + 1
    13.         elseif c:match("%d") or c == '.' then
    14.             local num = ""
    15.             -- Capture the base number (integer or float)
    16.             while i <= #expr and expr:sub(i, i):match("[%d%.]") do
    17.                 num = num .. expr:sub(i, i)
    18.                 i = i + 1
    19.             end
    20.             -- Check for scientific notation (immediately following without space)
    21.             if i <= #expr and (expr:sub(i, i) == "e" or expr:sub(i, i) == "E") then
    22.                 num = num .. expr:sub(i, i)
    23.                 i = i + 1
    24.                 -- Optional sign after e/E
    25.                 if i <= #expr and (expr:sub(i, i) == "+" or expr:sub(i, i) == "-") then
    26.                     num = num .. expr:sub(i, i)
    27.                     i = i + 1
    28.                 end
    29.                 -- Append the exponent digits
    30.                 while i <= #expr and expr:sub(i, i):match("%d") do
    31.                     num = num .. expr:sub(i, i)
    32.                     i = i + 1
    33.                 end
    34.             end
    35.             table.insert(tokens, {type = "number", value = tonumber(num)})
    36.         elseif c == "(" or c == ")" then
    37.             table.insert(tokens, {type = "paren", value = c})
    38.             i = i + 1
    39.         else
    40.             -- Try to match multi-character operators
    41.             local op = nil
    42.             -- If the operator "E" appears separated by spaces, treat it as an operator token.
    43.             if expr:sub(i, i) == "E" then
    44.                 op = "E"
    45.                 i = i + 1
    46.             else
    47.                 op = c
    48.                 i = i + 1
    49.             end
    50.             table.insert(tokens, {type = "operator", value = op})
    51.         end
    52.     end
    53.     return tokens
    54. end
    55.  
    56. -- Operator precedence and associativity
    57. local operators = {
    58.     ["E"] = {precedence = 5, associativity = "right"}, -- Scientific notation operator
    59.     ["^"] = {precedence = 4, associativity = "right"},
    60.     ["*"] = {precedence = 3, associativity = "left"},
    61.     ["/"] = {precedence = 3, associativity = "left"},
    62.     ["+"] = {precedence = 2, associativity = "left"},
    63.     ["-"] = {precedence = 2, associativity = "left"},
    64. }
    65.  
    66. -- Step 2: Parser using the shunting-yard algorithm
    67. local function shuntingYard(tokens)
    68.     local output = {}
    69.     local opStack = {}
    70.  
    71.     for _, token in ipairs(tokens) do
    72.         if token.type == "number" then
    73.             table.insert(output, token)
    74.         elseif token.type == "operator" then
    75.             local o1 = token.value
    76.             while #opStack > 0 do
    77.                 local top = opStack[#opStack]
    78.                 if top.type ~= "operator" then break end
    79.                 local o2 = top.value
    80.                 if (operators[o1].associativity == "left" and operators[o1].precedence <= operators[o2].precedence) or
    81.                     (operators[o1].associativity == "right" and operators[o1].precedence < operators[o2].precedence) then
    82.                     table.insert(output, table.remove(opStack))
    83.                 else
    84.                     break
    85.                 end
    86.             end
    87.             table.insert(opStack, token)
    88.         elseif token.type == "paren" then
    89.             if token.value == "(" then
    90.                 table.insert(opStack, token)
    91.             else  -- token.value == ")"
    92.                 while #opStack > 0 and opStack[#opStack].value ~= "(" do
    93.                     table.insert(output, table.remove(opStack))
    94.                 end
    95.                 if #opStack == 0 then
    96.                     error("Mismatched parentheses")
    97.                 end
    98.                 table.remove(opStack) -- remove "("
    99.             end
    100.         end
    101.     end
    102.  
    103.     while #opStack > 0 do
    104.         local top = table.remove(opStack)
    105.         if top.value == "(" or top.value == ")" then
    106.             error("Mismatched parentheses")
    107.         end
    108.         table.insert(output, top)
    109.     end
    110.  
    111.     return output
    112. end
    113.  
    114. -- Step 3: Evaluate Reverse Polish Notation (RPN)
    115. local function evaluateRPN(rpn)
    116.     local stack = {}
    117.     for _, token in ipairs(rpn) do
    118.         if token.type == "number" then
    119.             table.insert(stack, token.value)
    120.         elseif token.type == "operator" then
    121.             local b = table.remove(stack)
    122.             local a = table.remove(stack)
    123.             local result = nil
    124.             if token.value == "+" then
    125.                 result = a + b
    126.             elseif token.value == "-" then
    127.                 result = a - b
    128.             elseif token.value == "*" then
    129.                 result = a * b
    130.             elseif token.value == "/" then
    131.                 result = a / b
    132.             elseif token.value == "^" then
    133.                 result = a ^ b
    134.             elseif token.value == "E" then
    135.                 -- Evaluate as: a * (10^b)
    136.                 result = a * (10 ^ b)
    137.             else
    138.                 error("Unknown operator: " .. token.value)
    139.             end
    140.             table.insert(stack, result)
    141.         end
    142.     end
    143.     if #stack ~= 1 then
    144.         error("Invalid expression")
    145.     end
    146.     return stack[1]
    147. end
    148.  
    149. -- The universal parser function that catches errors and returns an error message
    150. function MathParser.evaluateExpression(expr)
    151.     local tokens = tokenize(expr)
    152.     local status, result = pcall(function()
    153.         local rpn = shuntingYard(tokens)
    154.         return evaluateRPN(rpn)
    155.     end)
    156.     if not status then
    157.         return "Error: " .. result
    158.     else
    159.         return result
    160.     end
    161. end
    162.  
    163. return MathParser
    164.  
  • 1m1m0
    6 days
    # Lua 0.29 KB | 0 0
    1. local IDGenerator = {}
    2.  
    3. local charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    4.  
    5. function IDGenerator.GenerateID(length)
    6.     local id = ""
    7.     for i = 1, length do
    8.         local randIndex = math.random(#charset)
    9.         id = id .. charset:sub(randIndex, randIndex)
    10.     end
    11.     return id
    12. end
    13.  
    14. return IDGenerator
    15.  
  • 1m1m0
    2 days
    # text 2.04 KB | 0 0
    1. [ Welcome to Blackhole 5.1 Experimental Branch! ]
    2.  
    3. ----------
    4. Quick Desc
    5. ----------
    6.  
    7. Blackhole 5.1 is a beta version of future blackholes, especially for effecient and accurate gravities!
    8. This Blackhole version does not support fancy absorptions like previous Blackhole versions, but has significant improvements on gravitation.
    9.  
    10. Please do not remove any asset within the Blackhole as they will cause errors!
    11.  
    12. ---------------
    13. Live Parameters
    14. ---------------
    15.  
    16. `G_(gravity)` (1) = Gravitation constant, very sensitive to different values, try 0.1 incrementals.
    17. `UseCustomMass` (false) = Use custom mass as current mass has restrictions. this does not affect the ACTUAL mass, it's only pseudo.
    18. `CustomMass` (5236) = The custom mass (default is current mass, but it may not be if resized).
    19. `UseEinsteinian` (true) = Use Einstein's gravity field equation: (G*M/r^2)*(1-Rs/r) where Rs is the Schwarzschild radius, else use Newtonian: (Gm1m2/r^2).
    20. `OverridePhysics` (false) = If true, disregard the gravity formulas and simply use (`Magnitude`/r^2), more info on `Magnitude`
    21. `Magnitude` (1000000) = The gravitational strength. (also typed as 1e6).
    22. c_(light_speed) (300000000) = Speed of light (used for Schwarzschild radius in Einsteinian gravity, also typed as 3e8).
    23.  
    24. Schwarzschild radius = Event Horizon (the actual radius of blackhole), which the script uses to cancel gravity as r->0 outputs infinity.
    25.  
    26. ------------
    27. Math Parsing
    28. ------------
    29.  
    30. Follows mathematical syntax!
    31.  
    32. Non boolean parameters can be hard to type for precise and or large values like 300000000 or 12300, but they can be typed as exponentials or scientific notations:
    33. 1.23e4 = 1.23*(10^4) = 12300
    34.  
    35. It may output an error, this is how to use the Math Parsing system:
    36. Accepts PEDMAS or BEDMAS (Parentheses, Exponents, Division, Multiplication, Addition & Subtraction)
    37. a^4 = a*a*a*a, for roots: a^(1/2) = square root of a, whatever number in a^(1/n) is the n-th root.
    38. a/b, but b =/= 0.
    39. a*b...
    40. etc.
    41.  
    42. Example:
    43. (1e2)^(3/4)+5-6 = 30.62...
Add Comment
Please, Sign In to add comment
Advertisement