Copy salient and essential scripts and models from Plane Building Roblox
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
Methods = require(_G.Modules.MethodModule)
|
||||
Placement = require(_G.Modules.PlacementModule)
|
||||
Statistics = {}
|
||||
Configuration = Statistics
|
||||
function GetValue(part,name,default)
|
||||
local instance = part:FindFirstChild(name)
|
||||
if not instance then return default
|
||||
else return instance.Value end
|
||||
end
|
||||
function GetInstance(part,name)
|
||||
return part:FindFirstChild(name) or error("Missing sub-instance "..name..":"..part:GetFullName(),3)
|
||||
end
|
||||
|
||||
function Print(instance,...)
|
||||
local text = table.concat({string.format("<b>@%.2f:</b>",tick() - _G.Begin),...}," ")
|
||||
if _G.PrintUpdate then _G.PrintUpdate(instance,text) end
|
||||
if _G.IsServer then _G.Remotes.DebugUpdate:FireAllClients(instance,...) end
|
||||
end
|
||||
|
||||
_G.Rules = {}
|
||||
_G.Rules.Sandbox = {
|
||||
GenerationVersion = "4",
|
||||
GenerationFollowPlayer = true,
|
||||
AutoSpawnIdlers = true,
|
||||
NeedsExperience = false,
|
||||
NeedsInventory = false,
|
||||
NeedsMaterial = false,
|
||||
NeedsCurrency = false,
|
||||
}
|
||||
_G.Rules.Survival = {
|
||||
GenerationVersion = "5",
|
||||
GenerationFollowPlayer = true,
|
||||
AutoSpawnIdlers = false,
|
||||
AutoSpawnPirates = true,
|
||||
AutoSpawnFreighters = true,
|
||||
NeedsExperience = true,
|
||||
NeedsInventory = true,
|
||||
NeedsMaterial = true,
|
||||
NeedsCurrency = false,
|
||||
}
|
||||
_G.Rules.War = {
|
||||
GenerationVersion = "4",
|
||||
GenerationFollowPlayer = false,
|
||||
AutoSpawnIdlers = false,
|
||||
AutoSpawnPirates = false,
|
||||
AutoSpawnFreighters = false,
|
||||
NeedsExperience = false,
|
||||
NeedsInventory = true,
|
||||
NeedsMaterial = true,
|
||||
NeedsCurrency = true
|
||||
}
|
||||
_G.RuleMode = "Sandbox"
|
||||
|
||||
_G.Notify = function(title,content)
|
||||
game.ReplicatedStorage.Remotes.Notification:FireAllClients(title,content)
|
||||
end
|
||||
|
||||
_G.SaveCompression = true
|
||||
_G.SaveFormat = "4"
|
||||
|
||||
_G.Changelog = [[
|
||||
DUCK5_0:
|
||||
Figuring out scripting with Lua and Rust.
|
||||
Bevy setup.
|
||||
|
||||
NEL0:
|
||||
Parser, interpreter and LI standard library complete.
|
||||
|
||||
PB3:
|
||||
More computer fixes, I forget.
|
||||
Added steam engines.
|
||||
Adding balloons.
|
||||
|
||||
DCT1:
|
||||
Scrapped old buildings for 'slice trees'
|
||||
|
||||
DCT0:
|
||||
Implemented working terrain engine.
|
||||
Loads of sorcery:
|
||||
Poly terrain (Mesh or WedgePart)
|
||||
Buildings Beta
|
||||
|
||||
PB2:
|
||||
Fixed ropes and rods scaling.
|
||||
Fixed ropes and rods.
|
||||
Fixed motors.
|
||||
Made some fixes to CreateToolScript and PaintToolScript.
|
||||
Made DebugWings deactivate correctly.
|
||||
Did various fixes on ProgramModule.
|
||||
Added meshes.
|
||||
Tried to fix propellers.
|
||||
Fixed wheel resizing.
|
||||
Fixed rod bug in save system.
|
||||
Fixed the anchor block bug.
|
||||
|
||||
PB1:
|
||||
Fixed fatal materials paint bug.
|
||||
Fixed model resizing bug.
|
||||
Fixed disconnectors bug.
|
||||
Fixed guns bug.
|
||||
Fixed notifications looking stupid.
|
||||
Fixed spring edit updates.
|
||||
Fixed a poly sticks save bug.
|
||||
Protected various objects from error.
|
||||
Fixed microcontroller dragger bug.
|
||||
Fixed microcontroller deletion bug.
|
||||
Fixed poly snapping.
|
||||
Added a changelog.
|
||||
|
||||
PB0:
|
||||
Object system 'Agnostic Ownership' overhaul.
|
||||
Added Microcontrollers.
|
||||
Added new engine models.
|
||||
Aero system implements viscosity (gliding).
|
||||
Made various changes to object properties.
|
||||
Poly now supports up to 9 nodes.
|
||||
Poly now supports thickness changes.
|
||||
Many unrecorded QOL changes. (like 200 more lines xD)
|
||||
]]
|
||||
|
||||
_G.Union(_G,getfenv()) -- Combine _G with this module
|
||||
|
||||
return getfenv()
|
||||
@@ -0,0 +1,161 @@
|
||||
function Union(this,other) -- Combine two tables
|
||||
for index,item in pairs(other) do
|
||||
this[index] = item
|
||||
end
|
||||
return this
|
||||
end
|
||||
|
||||
function Default(this,other)
|
||||
for index,item in pairs(other) do
|
||||
if not this[index] then this[index] = item end
|
||||
end
|
||||
end
|
||||
|
||||
local _string = {["string"] = true}
|
||||
local _number = {["number"] = true}
|
||||
local _table = {["table"] = true}
|
||||
local _boolean = {["boolean"] = true}
|
||||
local type = type
|
||||
IsString = function(value) return not not _string[type(value)] end
|
||||
IsNumber = function(value) return not not _number[type(value)] end
|
||||
IsTable = function(value) return not not _table[type(value)] end
|
||||
IsBoolean = function(value) return not not _boolean[type(value)] end
|
||||
|
||||
Modules = game.ReplicatedFirst:WaitForChild("Modules")
|
||||
Storage = game.ReplicatedStorage
|
||||
Assets = Storage:WaitForChild("Assets")
|
||||
Sounds = Assets:WaitForChild("Sounds")
|
||||
Events = game.ReplicatedFirst:WaitForChild("Events")
|
||||
Remotes = Storage:WaitForChild("Remotes")
|
||||
Debris = game:GetService("Debris")
|
||||
Tags = game:GetService("CollectionService")
|
||||
Tween = game:GetService("TweenService")
|
||||
Run = game:GetService("RunService")
|
||||
Input = game:GetService("UserInputService")
|
||||
Http = game:GetService("HttpService")
|
||||
IsServer = Run:IsServer()
|
||||
IsStudio = Run:IsStudio()
|
||||
IsClient = not IsServer
|
||||
if IsClient then Player = game.Players.LocalPlayer end
|
||||
|
||||
Begin = tick()
|
||||
|
||||
if IsServer then
|
||||
Data = game:GetService("DataStoreService")
|
||||
else
|
||||
Player = game.Players.LocalPlayer
|
||||
UserId = Player.UserId
|
||||
Gui = game.Players.LocalPlayer.PlayerGui
|
||||
end
|
||||
|
||||
|
||||
function Iterate(array)
|
||||
local i = 0
|
||||
local n = #array
|
||||
return function()
|
||||
i = i + 1
|
||||
if i <= n then return array[i] end
|
||||
end
|
||||
end
|
||||
|
||||
function WaitFor(tab,item,timeout)
|
||||
local t = 0
|
||||
timeout = timeout or 60
|
||||
repeat wait() t = t + 1 if t > timeout then error("Timeout for "..item,3) end until tab[item]
|
||||
return tab[item]
|
||||
end
|
||||
|
||||
Errors = {}
|
||||
|
||||
function Error(stuff)
|
||||
local traceback = debug.traceback("\nTraceback:",3)
|
||||
table.insert(Errors,tostring(stuff)..traceback)
|
||||
warn(stuff,traceback)
|
||||
end
|
||||
|
||||
function Protect(func)
|
||||
return function(...)
|
||||
local success,result = xpcall(func,function(err)
|
||||
Error(err)
|
||||
end,...)
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
function Protected(func,...)
|
||||
local success,result = xpcall(func,function(err)
|
||||
Error(err)
|
||||
end,...)
|
||||
if success then return result end
|
||||
end
|
||||
|
||||
String = tostring
|
||||
Append = table.insert
|
||||
ClassOf = getmetatable
|
||||
Percent = function(num)
|
||||
if not num then error("Number is nil.",2) end
|
||||
local val = math.ceil(num*3)
|
||||
local colour = "31"
|
||||
if val > 2 then
|
||||
colour = "32"
|
||||
elseif val > 1 then
|
||||
colour = "33"
|
||||
end
|
||||
local txt = "\27["..colour.."m"..String(math.floor(num*100)).."%".."\27[0m"
|
||||
return txt
|
||||
end
|
||||
|
||||
Unimplemented = function()
|
||||
error("Method unimplemented",2)
|
||||
end
|
||||
|
||||
Notify = function(...)
|
||||
Events.Notification:Fire(...)
|
||||
end
|
||||
|
||||
Class = function(properties)
|
||||
local template = {} -- Creates a metatable
|
||||
template.templates = {}
|
||||
template.Descends = function(other)
|
||||
return template.templates[getmetatable(other)]
|
||||
end
|
||||
template.__index = {}
|
||||
if properties.Inherits then -- Combine the template of the superclass
|
||||
template.__index = Union({},properties.Inherits.__index or {})
|
||||
template.__tostring = properties.Inherits.__tostring
|
||||
properties.Inherits.templates[template] = true
|
||||
template.super = properties.Inherits
|
||||
properties.Inherits = nil
|
||||
end
|
||||
properties.Class = template
|
||||
template.templates[template] = true -- Add this to the table of
|
||||
if properties.Construct then
|
||||
template.constructor = properties.Construct or function(_,...) end
|
||||
properties.Construct = nil
|
||||
end
|
||||
for index,item in pairs(properties) do -- The remaining items in properties are data
|
||||
template.__index[index] = item -- So all constants and methods go here
|
||||
end
|
||||
template.create = template.create or function(this,...) -- Call template to make this
|
||||
local new = {} -- Create a new instance table
|
||||
template.constructor(new,...) -- Construct it
|
||||
return setmetatable(new,template) -- Return the newly made instance
|
||||
end
|
||||
setmetatable(template,{
|
||||
__call = template.create,
|
||||
})
|
||||
template.__tostring = properties.String or template.__tostring
|
||||
return template
|
||||
end
|
||||
|
||||
Union(_G,getfenv()) -- Combine _G with this module
|
||||
|
||||
require(script.Parent.BuildingGlobals)
|
||||
|
||||
if IsServer then
|
||||
game.ReplicatedFirst.ReadyServer.Value = true
|
||||
else
|
||||
game.ReplicatedFirst.ReadyClient.Value = true
|
||||
end
|
||||
|
||||
return _G
|
||||
@@ -0,0 +1 @@
|
||||
require(script.Parent.DefaultGlobals)
|
||||
@@ -0,0 +1 @@
|
||||
require(script.Parent.DefaultGlobals)
|
||||
Reference in New Issue
Block a user